From 7929cf203768b46adb271f0db2c009df731399d9 Mon Sep 17 00:00:00 2001 From: Cleber Rosa Date: Wed, 12 Aug 2020 16:33:43 -0400 Subject: [PATCH] Options: remove duplicate and clearly unnecessary options There are options are not used anywhere else, one (vt_tests) is even set twice. Overall, all the needed configurations are already set in the VirtTestOptionsProcess class and in the command line option creation (such as the selinux option). Signed-off-by: Cleber Rosa --- avocado_vt/loader.py | 38 -------------------------------------- avocado_vt/options.py | 10 ---------- 2 files changed, 48 deletions(-) diff --git a/avocado_vt/loader.py b/avocado_vt/loader.py index 311ece0a..58a26f1b 100644 --- a/avocado_vt/loader.py +++ b/avocado_vt/loader.py @@ -109,7 +109,6 @@ class VirtTestLoader(loader.TestLoader): # new and old releases if hasattr(self, 'config'): self.args = self.config - self._fill_optional_args() if vt_extra_params: # We don't want to override the original args self.args = copy.deepcopy(self.args) @@ -120,43 +119,6 @@ class VirtTestLoader(loader.TestLoader): extra = vt_extra_params set_opt(self.args, 'vt_extra_params', extra) - def _fill_optional_args(self): - def _add_if_not_exist(arg, value): - if not get_opt(self.args, arg): - set_opt(self.args, arg, value) - _add_if_not_exist('vt_config', None) - _add_if_not_exist('vt_verbose', True) - _add_if_not_exist('vt_log_level', 'debug') - _add_if_not_exist('vt_console_level', 'debug') - _add_if_not_exist('vt_datadir', data_dir.get_data_dir()) - _add_if_not_exist('vt_tmp_dir', '') - _add_if_not_exist('vt_config', None) - _add_if_not_exist('vt_arch', None) - _add_if_not_exist('vt_machine_type', None) - _add_if_not_exist('vt_keep_guest_running', False) - _add_if_not_exist('vt_backup_image_before_test', True) - _add_if_not_exist('vt_restore_image_after_test', True) - _add_if_not_exist('vt_mem', 1024) - _add_if_not_exist('vt_no_filter', '') - _add_if_not_exist('vt_qemu_bin', None) - _add_if_not_exist('vt_dst_qemu_bin', None) - _add_if_not_exist('vt_nettype', 'user') - _add_if_not_exist('vt_only_type_specific', False) - _add_if_not_exist('vt_tests', '') - _add_if_not_exist('vt_connect_uri', 'qemu:///system') - _add_if_not_exist('vt_accel', 'kvm') - _add_if_not_exist('vt_monitor', 'human') - _add_if_not_exist('vt_smp', 1) - _add_if_not_exist('vt_image_type', 'qcow2') - _add_if_not_exist('vt_nic_model', 'virtio_net') - _add_if_not_exist('vt_disk_bus', 'virtio_blk') - _add_if_not_exist('vt_vhost', 'off') - _add_if_not_exist('vt_malloc_perturb', 'yes') - _add_if_not_exist('vt_qemu_sandbox', 'on') - _add_if_not_exist('vt_tests', '') - _add_if_not_exist('show_job_log', False) - _add_if_not_exist('test_lister', True) - def _get_parser(self): options_processor = VirtTestOptionsProcess(self.args) return options_processor.get_parser() diff --git a/avocado_vt/options.py b/avocado_vt/options.py index 275e751d..9d2d29d8 100644 --- a/avocado_vt/options.py +++ b/avocado_vt/options.py @@ -51,16 +51,6 @@ class VirtTestOptionsProcess(object): self.options = argparse.Namespace(**options) else: self.options = options - # There are a few options from the original virt-test runner - # that don't quite make sense for avocado (avocado implements a - # better version of the virt-test feature). - # So let's just inject some values into options. - set_opt(self.options, 'vt_verbose', False) - set_opt(self.options, 'vt_log_level', logging.DEBUG) - set_opt(self.options, 'vt_console_level', logging.DEBUG) - set_opt(self.options, 'vt_no_downloads', False) - set_opt(self.options, 'vt_selinux_setup', False) - # Here we'll inject values from the config file. # Doing this makes things configurable yet the number of options # is not overwhelming. -- GitLab