From b233980c6207848d48967f1e8125e41e309a6f5a Mon Sep 17 00:00:00 2001 From: Delia Popescu Date: Tue, 9 Oct 2018 12:03:58 +0300 Subject: Ease configuring extra specs via env vars Ease configuring flavor extra specs, as well as image extra specs. Set environment variables for image_properties and flavor extra_specs for ovs|fdio scenario from the start. Image extra_properties and flavor extra_specs will continue to get updates from functest config file but so will from IMAGE_PROPERTIES and FLAVOR_EXTRA_SPECS env variables. Change-Id: Ie1c69e66d2e2e158915d214402fe44d9991c56d3 Signed-off-by: Delia Popescu (cherry picked from commit 1a00b9de56ef65eef2a0b269a514cb25491ac54b) --- functest/ci/config_patch.yaml | 176 ----------------------- functest/core/singlevm.py | 8 ++ functest/tests/unit/utils/test_functest_utils.py | 3 + functest/utils/env.py | 1 + functest/utils/functest_utils.py | 2 +- 5 files changed, 13 insertions(+), 177 deletions(-) diff --git a/functest/ci/config_patch.yaml b/functest/ci/config_patch.yaml index 3acb35553..42220832e 100644 --- a/functest/ci/config_patch.yaml +++ b/functest/ci/config_patch.yaml @@ -1,277 +1,101 @@ --- fdio: general: - flavor_extra_specs: {'hw:mem_page_size':'large'} - image_properties: {'hw_mem_page_size':'large'} openstack: flavor_ram: 1024 snaps: flavor_extra_specs: {'hw:mem_page_size':'large'} vmready1: - flavor_extra_specs: {'hw:mem_page_size':'large'} - extra_properties: {'hw_mem_page_size':'large'} flavor_ram: 1024 vmready2: - flavor_extra_specs: {'hw:mem_page_size':'large'} - extra_properties: {'hw_mem_page_size':'large'} flavor_ram: 1024 singlevm1: - flavor_extra_specs: {'hw:mem_page_size':'large'} - extra_properties: {'hw_mem_page_size':'large'} flavor_ram: 1024 singlevm2: - flavor_extra_specs: {'hw:mem_page_size':'large'} - extra_properties: {'hw_mem_page_size':'large'} flavor_ram: 1024 vping_ssh: - flavor_extra_specs: {'hw:mem_page_size':'large'} - extra_properties: {'hw_mem_page_size':'large'} flavor_ram: 1024 vping_userdata: - flavor_extra_specs: {'hw:mem_page_size':'large'} - extra_properties: {'hw_mem_page_size':'large'} flavor_ram: 1024 cinder_test: - flavor_extra_specs: {'hw:mem_page_size':'large'} - extra_properties: {'hw_mem_page_size':'large'} flavor_ram: 1024 tempest_smoke: - flavor_extra_specs: {'hw:mem_page_size':'large'} - flavor_alt_extra_specs: {'hw:mem_page_size':'large'} - extra_properties: {'hw_mem_page_size':'large'} - extra_alt_properties: {'hw_mem_page_size':'large'} flavor_ram: 1024 neutron-tempest-plugin-api: - flavor_extra_specs: {'hw:mem_page_size':'large'} - flavor_alt_extra_specs: {'hw:mem_page_size':'large'} - extra_properties: {'hw_mem_page_size':'large'} - extra_alt_properties: {'hw_mem_page_size':'large'} flavor_ram: 1024 refstack_defcore: - flavor_extra_specs: {'hw:mem_page_size':'large'} - flavor_alt_extra_specs: {'hw:mem_page_size':'large'} - extra_properties: {'hw_mem_page_size':'large'} - extra_alt_properties: {'hw_mem_page_size':'large'} flavor_ram: 1024 patrole: - flavor_extra_specs: {'hw:mem_page_size':'large'} - flavor_alt_extra_specs: {'hw:mem_page_size':'large'} - extra_properties: {'hw_mem_page_size':'large'} - extra_alt_properties: {'hw_mem_page_size':'large'} flavor_ram: 1024 vmtp: - flavor_extra_specs: {'hw:mem_page_size':'large'} - extra_properties: {'hw_mem_page_size':'large'} flavor_ram: 2048 shaker: - flavor_extra_specs: {'hw:mem_page_size':'large'} - extra_properties: {'hw_mem_page_size':'large'} flavor_ram: 1024 neutron_trunk: - flavor_extra_specs: {'hw:mem_page_size':'large'} - flavor_alt_extra_specs: {'hw:mem_page_size':'large'} - extra_properties: {'hw_mem_page_size':'large'} - extra_alt_properties: {'hw_mem_page_size':'large'} flavor_ram: 1024 networking-bgpvpn: - flavor_extra_specs: {'hw:mem_page_size':'large'} - flavor_alt_extra_specs: {'hw:mem_page_size':'large'} - extra_properties: {'hw_mem_page_size':'large'} - extra_alt_properties: {'hw_mem_page_size':'large'} flavor_ram: 1024 networking-sfc: - flavor_extra_specs: {'hw:mem_page_size':'large'} - flavor_alt_extra_specs: {'hw:mem_page_size':'large'} - extra_properties: {'hw_mem_page_size':'large'} - extra_alt_properties: {'hw_mem_page_size':'large'} flavor_ram: 1024 barbican: - flavor_extra_specs: {'hw:mem_page_size':'large'} - flavor_alt_extra_specs: {'hw:mem_page_size':'large'} - extra_properties: {'hw_mem_page_size':'large'} - extra_alt_properties: {'hw_mem_page_size':'large'} flavor_ram: 1024 tempest_full: - flavor_extra_specs: {'hw:mem_page_size':'large'} - flavor_alt_extra_specs: {'hw:mem_page_size':'large'} - extra_properties: {'hw_mem_page_size':'large'} - extra_alt_properties: {'hw_mem_page_size':'large'} flavor_ram: 1024 tempest_scenario: - flavor_extra_specs: {'hw:mem_page_size':'large'} - flavor_alt_extra_specs: {'hw:mem_page_size':'large'} - extra_properties: {'hw_mem_page_size':'large'} - extra_alt_properties: {'hw_mem_page_size':'large'} flavor_ram: 1024 rally_sanity: - flavor_extra_specs: {'hw:mem_page_size':'large'} - flavor_alt_extra_specs: {'hw:mem_page_size':'large'} - extra_properties: {'hw_mem_page_size':'large'} flavor_ram: 1024 rally_full: - flavor_extra_specs: {'hw:mem_page_size':'large'} - flavor_alt_extra_specs: {'hw:mem_page_size':'large'} - extra_properties: {'hw_mem_page_size':'large'} flavor_ram: 1024 - cloudify: - flavor_extra_specs: {'hw:mem_page_size':'large'} - flavor_alt_extra_specs: {'hw:mem_page_size':'large'} - extra_properties: {'hw_mem_page_size':'large'} - extra_alt_properties: {'hw_mem_page_size':'large'} - cloudify_ims: - flavor_extra_specs: {'hw:mem_page_size':'large'} - flavor_alt_extra_specs: {'hw:mem_page_size':'large'} - extra_properties: {'hw_mem_page_size':'large'} - extra_alt_properties: {'hw_mem_page_size':'large'} - heat_ims: - flavor_extra_specs: {'hw:mem_page_size':'large'} - extra_properties: {'hw_mem_page_size':'large'} - vyos_vrouter: - flavor_extra_specs: {'hw:mem_page_size':'large'} - flavor_alt_extra_specs: {'hw:mem_page_size':'large'} - extra_properties: {'hw_mem_page_size':'large'} - extra_alt_properties: {'hw_mem_page_size':'large'} - juju_epc: - flavor_extra_specs: {'hw:mem_page_size':'large'} - flavor_alt_extra_specs: {'hw:mem_page_size':'large'} - extra_properties: {'hw_mem_page_size':'large'} - extra_alt_properties: {'hw_mem_page_size':'large'} ovs: general: - flavor_extra_specs: {'hw:mem_page_size':'large'} - image_properties: {'hw_mem_page_size':'large'} openstack: flavor_ram: 1024 snaps: flavor_extra_specs: {'hw:mem_page_size':'large'} vmready1: - flavor_extra_specs: {'hw:mem_page_size':'large'} - extra_properties: {'hw_mem_page_size':'large'} flavor_ram: 1024 vmready2: - flavor_extra_specs: {'hw:mem_page_size':'large'} - extra_properties: {'hw_mem_page_size':'large'} flavor_ram: 1024 singlevm1: - flavor_extra_specs: {'hw:mem_page_size':'large'} - extra_properties: {'hw_mem_page_size':'large'} flavor_ram: 1024 singlevm2: - flavor_extra_specs: {'hw:mem_page_size':'large'} - extra_properties: {'hw_mem_page_size':'large'} flavor_ram: 1024 vping_ssh: - flavor_extra_specs: {'hw:mem_page_size':'large'} - extra_properties: {'hw_mem_page_size':'large'} flavor_ram: 1024 vping_userdata: - flavor_extra_specs: {'hw:mem_page_size':'large'} - extra_properties: {'hw_mem_page_size':'large'} flavor_ram: 1024 cinder_test: - flavor_extra_specs: {'hw:mem_page_size':'large'} - extra_properties: {'hw_mem_page_size':'large'} flavor_ram: 1024 tempest_smoke: - flavor_extra_specs: {'hw:mem_page_size':'large'} - flavor_alt_extra_specs: {'hw:mem_page_size':'large'} - extra_properties: {'hw_mem_page_size':'large'} - extra_alt_properties: {'hw_mem_page_size':'large'} flavor_ram: 1024 neutron-tempest-plugin-api: - flavor_extra_specs: {'hw:mem_page_size':'large'} - flavor_alt_extra_specs: {'hw:mem_page_size':'large'} - extra_properties: {'hw_mem_page_size':'large'} - extra_alt_properties: {'hw_mem_page_size':'large'} flavor_ram: 1024 refstack_defcore: - flavor_extra_specs: {'hw:mem_page_size':'large'} - flavor_alt_extra_specs: {'hw:mem_page_size':'large'} - extra_properties: {'hw_mem_page_size':'large'} - extra_alt_properties: {'hw_mem_page_size':'large'} flavor_ram: 1024 patrole: - flavor_extra_specs: {'hw:mem_page_size':'large'} - flavor_alt_extra_specs: {'hw:mem_page_size':'large'} - extra_properties: {'hw_mem_page_size':'large'} - extra_alt_properties: {'hw_mem_page_size':'large'} flavor_ram: 1024 vmtp: - flavor_extra_specs: {'hw:mem_page_size':'large'} - extra_properties: {'hw_mem_page_size':'large'} flavor_ram: 2048 shaker: - flavor_extra_specs: {'hw:mem_page_size':'large'} - extra_properties: {'hw_mem_page_size':'large'} flavor_ram: 1024 neutron_trunk: - flavor_extra_specs: {'hw:mem_page_size':'large'} - flavor_alt_extra_specs: {'hw:mem_page_size':'large'} - extra_properties: {'hw_mem_page_size':'large'} - extra_alt_properties: {'hw_mem_page_size':'large'} flavor_ram: 1024 networking-bgpvpn: - flavor_extra_specs: {'hw:mem_page_size':'large'} - flavor_alt_extra_specs: {'hw:mem_page_size':'large'} - extra_properties: {'hw_mem_page_size':'large'} - extra_alt_properties: {'hw_mem_page_size':'large'} flavor_ram: 1024 networking-sfc: - flavor_extra_specs: {'hw:mem_page_size':'large'} - flavor_alt_extra_specs: {'hw:mem_page_size':'large'} - extra_properties: {'hw_mem_page_size':'large'} - extra_alt_properties: {'hw_mem_page_size':'large'} flavor_ram: 1024 barbican: - flavor_extra_specs: {'hw:mem_page_size':'large'} - flavor_alt_extra_specs: {'hw:mem_page_size':'large'} - extra_properties: {'hw_mem_page_size':'large'} - extra_alt_properties: {'hw_mem_page_size':'large'} flavor_ram: 1024 tempest_full: - flavor_extra_specs: {'hw:mem_page_size':'large'} - flavor_alt_extra_specs: {'hw:mem_page_size':'large'} - extra_properties: {'hw_mem_page_size':'large'} - extra_alt_properties: {'hw_mem_page_size':'large'} flavor_ram: 1024 tempest_scenario: - flavor_extra_specs: {'hw:mem_page_size':'large'} - flavor_alt_extra_specs: {'hw:mem_page_size':'large'} - extra_properties: {'hw_mem_page_size':'large'} - extra_alt_properties: {'hw_mem_page_size':'large'} flavor_ram: 1024 rally_sanity: - flavor_extra_specs: {'hw:mem_page_size':'large'} - extra_properties: {'hw_mem_page_size':'large'} flavor_ram: 1024 rally_full: - flavor_extra_specs: {'hw:mem_page_size':'large'} - extra_properties: {'hw_mem_page_size':'large'} flavor_ram: 1024 - cloudify: - flavor_extra_specs: {'hw:mem_page_size':'large'} - flavor_alt_extra_specs: {'hw:mem_page_size':'large'} - extra_properties: {'hw_mem_page_size':'large'} - extra_alt_properties: {'hw_mem_page_size':'large'} - cloudify_ims: - flavor_extra_specs: {'hw:mem_page_size':'large'} - flavor_alt_extra_specs: {'hw:mem_page_size':'large'} - extra_properties: {'hw_mem_page_size':'large'} - extra_alt_properties: {'hw_mem_page_size':'large'} - heat_ims: - flavor_extra_specs: {'hw:mem_page_size':'large'} - extra_properties: {'hw_mem_page_size':'large'} - vyos_vrouter: - flavor_extra_specs: {'hw:mem_page_size':'large'} - flavor_alt_extra_specs: {'hw:mem_page_size':'large'} - extra_properties: {'hw_mem_page_size':'large'} - extra_alt_properties: {'hw_mem_page_size':'large'} - juju_epc: - flavor_extra_specs: {'hw:mem_page_size':'large'} - flavor_alt_extra_specs: {'hw:mem_page_size':'large'} - extra_properties: {'hw_mem_page_size':'large'} - extra_alt_properties: {'hw_mem_page_size':'large'} vio: vmready1: diff --git a/functest/core/singlevm.py b/functest/core/singlevm.py index b3a1417f6..ec7f967ec 100644 --- a/functest/core/singlevm.py +++ b/functest/core/singlevm.py @@ -155,6 +155,10 @@ class VmReady1(tenantnetwork.TenantNetwork1): self.flavor_disk)) self.__logger.debug("flavor: %s", flavor) flavor_extra_specs = self.flavor_extra_specs.copy() + if env.get('FLAVOR_EXTRA_SPECS'): + flavor_extra_specs.update( + functest_utils.convert_ini_to_dict( + env.get('FLAVOR_EXTRA_SPECS'))) flavor_extra_specs.update( getattr(config.CONF, '{}_flavor_extra_specs'.format(self.case_name), {})) @@ -183,6 +187,10 @@ class VmReady1(tenantnetwork.TenantNetwork1): self.flavor_alt_disk)) self.__logger.debug("flavor: %s", flavor) flavor_alt_extra_specs = self.flavor_alt_extra_specs.copy() + if env.get('FLAVOR_EXTRA_SPECS'): + flavor_alt_extra_specs.update( + functest_utils.convert_ini_to_dict( + env.get('FLAVOR_EXTRA_SPECS'))) flavor_alt_extra_specs.update( getattr(config.CONF, '{}_flavor_alt_extra_specs'.format(self.case_name), {})) diff --git a/functest/tests/unit/utils/test_functest_utils.py b/functest/tests/unit/utils/test_functest_utils.py index 0562e3bf6..dcbbd79e5 100644 --- a/functest/tests/unit/utils/test_functest_utils.py +++ b/functest/tests/unit/utils/test_functest_utils.py @@ -366,6 +366,9 @@ class FunctestUtilsTesting(unittest.TestCase): self.assertEqual( functest_utils.convert_ini_to_dict( "a:b,c:d"), {"a": "b", "c": "d"}) + self.assertEqual( + functest_utils.convert_ini_to_dict( + "a:b:c,d:e:f"), {"a:b": "c", "d:e": "f"}) with self.assertRaises(AssertionError): functest_utils.convert_list_to_ini({}) diff --git a/functest/utils/env.py b/functest/utils/env.py index d7c0814c4..41d1a4d86 100644 --- a/functest/utils/env.py +++ b/functest/utils/env.py @@ -33,6 +33,7 @@ INPUTS = { 'ENERGY_RECORDER_API_PASSWORD': env.INPUTS['ENERGY_RECORDER_API_PASSWORD'], 'VOLUME_DEVICE_NAME': 'vdb', 'IMAGE_PROPERTIES': '', + 'FLAVOR_EXTRA_SPECS': '', 'NAMESERVER': '8.8.8.8', 'NEW_USER_ROLE': 'Member', 'USE_DYNAMIC_CREDENTIALS': 'True', diff --git a/functest/utils/functest_utils.py b/functest/utils/functest_utils.py index 7ae74393d..b49337de2 100644 --- a/functest/utils/functest_utils.py +++ b/functest/utils/functest_utils.py @@ -155,7 +155,7 @@ def convert_ini_to_dict(value): "Convert oslo.conf input to dict" assert isinstance(value, str) try: - return {k: v for k, v in (x.split(':') for x in value.split(','))} + return {k: v for k, v in (x.rsplit(':', 1) for x in value.split(','))} except ValueError: return {} -- cgit 1.2.3-korg