From 88c1a895923b6d2e3afbefcd28ff154ceb597f67 Mon Sep 17 00:00:00 2001 From: FrantiĊĦek Zatloukal Date: Nov 03 2020 13:29:43 +0000 Subject: Parse CMD_LINE_ARGS and add CMD_LINE_ENVS Fixes https://pagure.io/testcloud/issue/49 --- diff --git a/conf/domain-template.jinja b/conf/domain-template.jinja index 7a7f437..0300a9b 100644 --- a/conf/domain-template.jinja +++ b/conf/domain-template.jinja @@ -1,8 +1,8 @@ - - {{ domain_name }} - {{ uuid }} - {{ memory }} - {{ memory }} + + {{ domain_name }} + {{ uuid }} + {{ memory }} + {{ memory }} 1 hvm @@ -61,4 +61,5 @@ /dev/urandom + {{ qemu_args }} diff --git a/conf/settings-example.py b/conf/settings-example.py index ce0c6c3..3643eab 100644 --- a/conf/settings-example.py +++ b/conf/settings-example.py @@ -44,6 +44,7 @@ ## Customize as needed :) #CMD_LINE_ARGS = [] +#CMD_LINE_ENVS = {} # The timeout, in seconds, to wait for an instance to boot before # failing the boot process. Setting this to 0 disables waiting and @@ -64,4 +65,4 @@ #STOP_RETRY_WAIT = 1 # Desired VM type: False = BIOS, True = UEFI -#UEFI = False \ No newline at end of file +#UEFI = False diff --git a/testcloud/config.py b/testcloud/config.py index 966d256..deb53d9 100644 --- a/testcloud/config.py +++ b/testcloud/config.py @@ -126,6 +126,7 @@ runcmd: # Customize as needed :) CMD_LINE_ARGS = [] + CMD_LINE_ENVS = {} # timeout, in seconds for instance boot process BOOT_TIMEOUT = 30 diff --git a/testcloud/instance.py b/testcloud/instance.py index 111eff4..01719f8 100644 --- a/testcloud/instance.py +++ b/testcloud/instance.py @@ -374,6 +374,17 @@ class Instance(object): 'uefi_loader': "", 'emulator_path': "/usr/bin/qemu-kvm"} + if config_data.CMD_LINE_ARGS or config_data.CMD_LINE_ENVS: + args_envs = " \n" + for qemu_arg in config_data.CMD_LINE_ARGS: + args_envs += " \n" % qemu_arg + + for qemu_env in config_data.CMD_LINE_ENVS: + args_envs += " \n" % (qemu_env, config_data.CMD_LINE_ENVS[qemu_env]) + + args_envs += " " + instance_values["qemu_args"] = args_envs + if config_data.UEFI: instance_values['uefi_loader'] = "/usr/share/edk2/ovmf/OVMF_CODE.fd"