From 8dee0c8e7e150e580d35704cde508e3f9cbe8c2f Mon Sep 17 00:00:00 2001 From: Ayumu Ueha Date: Fri, 26 Jul 2024 09:56:04 +0000 Subject: [PATCH] Fix broken jobs in V1 API gates This patch fixes the following issues: 1. Change the QueuePool settings to use the values recommended. The following error occurred in sol-vnflcm and sol-kubernetes job: ``` tacker.wsgi sqlalchemy.exc.TimeoutError: QueuePool limit of size 10 overflow 20 reached, connection timed out, timeout 10.00 ``` Change to remove the process of overriding the default value of oslo.db config. In Neutron, the process of overriding the default value of oslo.db has already been removed [1]. However, errors still occur when using the recommended value, so temporarily set `max_pool_size` to unlimited in FT. 2. Fix issue of `Show subscription (V1 API)`. A previous patch [2] included `sqlalchemy.row.LegacyRow` for backwards compatibility with oslo.db, which caused the error "Show subscription (V1 API)" to fail by upgrading SQLAlchemy. Fix it to work correctly by removing `row.LegacyRow`. 3. Fix to upload image successfully in FT. There was a process to get the image from the glance and upload the copy image, but it was not working properly. Changed the argument to glance so that it uploads correctly. 4. Increase wait time Terminate after Heal in sol-vnflcm job. A 409 error occurred at the time of Terminate because the process was to wait a fixed number of seconds after Heal before Terminate. The current 20 seconds may not be enough, so increase it to 60 seconds. This will be fixed to check if OpOcc is COMPLETED status in future work. 5. Split test jobs for sol-vnflcm. Split test jobs for sol-vnflcm because it takes longer to run and, it is executed using the full limit time. [1] https://review.opendev.org/c/openstack/neutron/+/456419 [2] https://review.opendev.org/c/openstack/tacker/+/910720 Closes-Bug: #2066047 Change-Id: If1cd835c8875fa844f9eac5bff5ba85103ad91aa --- .zuul.yaml | 27 +++++++++++++++++-- tacker/api/views/vnf_lcm.py | 5 +--- tacker/common/config.py | 9 ++----- tacker/tests/functional/sol/vnflcm/base.py | 6 ++--- .../sol/vnflcm/test_vnf_instance.py | 5 ++-- .../sol/vnflcm_userdata/__init__.py | 0 .../test_vnf_instance_with_user_data.py | 5 ++-- .../vnflcm/test_vnf_lcm_with_multi_tenant.py | 5 ++-- tacker/tests/unit/db/base.py | 9 +++++-- tox.ini | 6 +++++ 10 files changed, 52 insertions(+), 25 deletions(-) create mode 100644 tacker/tests/functional/sol/vnflcm_userdata/__init__.py rename tacker/tests/functional/sol/{vnflcm => vnflcm_userdata}/test_vnf_instance_with_user_data.py (99%) diff --git a/.zuul.yaml b/.zuul.yaml index a786a6a33..df06ce6e8 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -234,8 +234,26 @@ Multinodes job for SOL devstack-based functional tests for vnflcm host-vars: controller-tacker: + devstack_local_conf: + post-config: + $TACKER_CONF: + database: + max_pool_size: 0 tox_envlist: dsvm-functional-sol-vnflcm - voting: false + +- job: + name: tacker-functional-devstack-multinode-sol-vnflcm-userdata + parent: tacker-functional-devstack-multinode-sol-parent + description: | + Multinodes job for SOL devstack-based functional tests for vnflcm with userdata + host-vars: + controller-tacker: + devstack_local_conf: + post-config: + $TACKER_CONF: + database: + max_pool_size: 0 + tox_envlist: dsvm-functional-sol-vnflcm-userdata - job: name: tacker-functional-devstack-multinode-sol-vnfpkgm @@ -599,8 +617,12 @@ Multinodes job for SOL Kubernetes Multi tenant devstack-based functional tests host-vars: controller-tacker: + devstack_local_conf: + post-config: + $TACKER_CONF: + database: + max_pool_size: 0 tox_envlist: dsvm-functional-sol-kubernetes - voting: false - job: name: tacker-functional-devstack-multinode-sol-kubernetes-multi-tenant @@ -832,6 +854,7 @@ jobs: - tacker-functional-devstack-multinode-sol-legacy-nfvo - tacker-functional-devstack-multinode-sol-vnflcm + - tacker-functional-devstack-multinode-sol-vnflcm-userdata - tacker-functional-devstack-multinode-sol-vnfpkgm - tacker-functional-devstack-multinode-sol-separated-nfvo - tacker-functional-devstack-multinode-sol-kubernetes diff --git a/tacker/api/views/vnf_lcm.py b/tacker/api/views/vnf_lcm.py index 97d648583..624d11271 100644 --- a/tacker/api/views/vnf_lcm.py +++ b/tacker/api/views/vnf_lcm.py @@ -204,10 +204,7 @@ class ViewBuilder(base.BaseViewBuilder): def _basic_subscription_info(self, vnf_lcm_subscription, filter=None): def key_exists(obj, key): - # NOTE(ueha): Check `row.LegacyRow` type for back compatibility - # of oslo.db<15.0.0 environment. - if (isinstance(obj, LccnSubscriptionRequest) or - isinstance(obj, row.LegacyRow)): + if isinstance(obj, LccnSubscriptionRequest): return key in vnf_lcm_subscription elif isinstance(obj, row.Row): return key in vnf_lcm_subscription._mapping diff --git a/tacker/common/config.py b/tacker/common/config.py index 01fd95867..88272e2f9 100644 --- a/tacker/common/config.py +++ b/tacker/common/config.py @@ -89,13 +89,8 @@ oslo_messaging.set_transport_defaults(control_exchange='tacker') def set_db_defaults(): - # Update the default QueuePool parameters. These can be tweaked by the - # conf variables - max_pool_size, max_overflow and pool_timeout - db_options.set_defaults( - cfg.CONF, - connection='sqlite://', - max_pool_size=10, - max_overflow=20, pool_timeout=10) + # Call to register `database` option to cfg.CONF + db_options.set_defaults(cfg.CONF) set_db_defaults() diff --git a/tacker/tests/functional/sol/vnflcm/base.py b/tacker/tests/functional/sol/vnflcm/base.py index ba04d2227..a0884677d 100644 --- a/tacker/tests/functional/sol/vnflcm/base.py +++ b/tacker/tests/functional/sol/vnflcm/base.py @@ -384,11 +384,11 @@ class BaseVnfLcmTest(base.BaseTackerTest): return image @classmethod - def _create_glance_image(cls, image_data, file_url, glance_client=None): + def _create_glance_image(cls, image_props, image_data, glance_client=None): if glance_client is None: glance_client = cls.glance_client - image = glance_client.images.create(**image_data) - glance_client.images.upload(image.id, file_url) + image = glance_client.images.create(**image_props) + glance_client.images.upload(image.id, image_data) return image.id diff --git a/tacker/tests/functional/sol/vnflcm/test_vnf_instance.py b/tacker/tests/functional/sol/vnflcm/test_vnf_instance.py index 16b912476..58c3e42ef 100644 --- a/tacker/tests/functional/sol/vnflcm/test_vnf_instance.py +++ b/tacker/tests/functional/sol/vnflcm/test_vnf_instance.py @@ -32,7 +32,7 @@ VNF_TERMINATE_TIMEOUT = 600 VNF_HEAL_TIMEOUT = 600 VNF_CHANGE_EXT_CONN_TIMEOUT = 600 RETRY_WAIT_TIME = 5 -WAIT_HEAL = 20 # Time to wait until heal op is completed in sec. +WAIT_HEAL = 60 # Time to wait until heal op is completed in sec. def get_ext_managed_virtual_link(id, vl_desc_id, resource_id): @@ -942,8 +942,7 @@ class VnfLcmTest(base.BaseTackerTest): # vnfcResourceInfo after the stack status becomes UPDATE_COMPLETE. # There is no intermediate status set to VNF which can be used here # to confirm healing action is completed successfully. - # NOTE(yasufum): add extra 20 sec to avoid timeout. - time.sleep(WAIT_HEAL + 25) + time.sleep(WAIT_HEAL) vnf_instance_current = self._show_vnf_instance(vnf_instance['id']) self._verify_vnfc_resource_info(vnf_instance, vnf_instance_current, 3) diff --git a/tacker/tests/functional/sol/vnflcm_userdata/__init__.py b/tacker/tests/functional/sol/vnflcm_userdata/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/tacker/tests/functional/sol/vnflcm/test_vnf_instance_with_user_data.py b/tacker/tests/functional/sol/vnflcm_userdata/test_vnf_instance_with_user_data.py similarity index 99% rename from tacker/tests/functional/sol/vnflcm/test_vnf_instance_with_user_data.py rename to tacker/tests/functional/sol/vnflcm_userdata/test_vnf_instance_with_user_data.py index 37b6afc76..9bfbc18fc 100644 --- a/tacker/tests/functional/sol/vnflcm/test_vnf_instance_with_user_data.py +++ b/tacker/tests/functional/sol/vnflcm_userdata/test_vnf_instance_with_user_data.py @@ -36,7 +36,7 @@ class VnfLcmWithUserDataTest(vnflcm_base.BaseVnfLcmTest): # ModifyVNF specific image create. for image in images: specific_image_name = image.name + '2' - image_data = { + image_props = { "min_disk": image.min_disk, "min_ram": image.min_ram, "disk_format": image.disk_format, @@ -55,7 +55,8 @@ class VnfLcmWithUserDataTest(vnflcm_base.BaseVnfLcmTest): with tempfile.TemporaryFile('w+b') as f: for content in body: f.write(content) - cls._create_glance_image(image_data, f.read()) + f.seek(0) + cls._create_glance_image(image_props, f) except Exception as e: print("Fail, Modify-VNF specific image create.", e, flush=True) cls.is_setup_error = True diff --git a/tacker/tests/functional/sol_multi_tenant/vnflcm/test_vnf_lcm_with_multi_tenant.py b/tacker/tests/functional/sol_multi_tenant/vnflcm/test_vnf_lcm_with_multi_tenant.py index dc683d44e..36d60f21d 100644 --- a/tacker/tests/functional/sol_multi_tenant/vnflcm/test_vnf_lcm_with_multi_tenant.py +++ b/tacker/tests/functional/sol_multi_tenant/vnflcm/test_vnf_lcm_with_multi_tenant.py @@ -56,7 +56,7 @@ class VnfLcmWithMultiTenant(base.BaseVnfLcmMultiTenantTest): for image in images: specific_image_name = f'{image.name}{2}' - image_data = { + image_props = { "min_disk": image.min_disk, "min_ram": image.min_ram, "disk_format": image.disk_format, @@ -75,7 +75,8 @@ class VnfLcmWithMultiTenant(base.BaseVnfLcmMultiTenantTest): with tempfile.TemporaryFile('w+b') as f: for content in body: f.write(content) - cls._create_glance_image(image_data, f.read()) + f.seek(0) + cls._create_glance_image(image_props, f) except Exception as e: print("Fail, Modify-VNF specific image create.", e, flush=True) is_setup_error = True diff --git a/tacker/tests/unit/db/base.py b/tacker/tests/unit/db/base.py index 4d588c73d..080558530 100644 --- a/tacker/tests/unit/db/base.py +++ b/tacker/tests/unit/db/base.py @@ -15,12 +15,18 @@ import fixtures -from tacker.common import config +from oslo_db import options as db_options + +import tacker.conf from tacker.db import api as db_api from tacker.db import model_base from tacker.tests.unit import base +CONF = tacker.conf.CONF +db_options.set_defaults(CONF, connection='sqlite://') + + class SqlFixture(fixtures.Fixture): # flag to indicate that the models have been loaded @@ -46,6 +52,5 @@ class SqlFixture(fixtures.Fixture): class SqlTestCase(base.TestCase): def setUp(self): - config.set_db_defaults() super(SqlTestCase, self).setUp() self.useFixture(SqlFixture()) diff --git a/tox.ini b/tox.ini index b1226dde9..52b44ea83 100644 --- a/tox.ini +++ b/tox.ini @@ -45,6 +45,12 @@ setenv = {[testenv]setenv} commands = stestr --test-path=./tacker/tests/functional/sol/vnflcm run --slowest --concurrency 1 {posargs} +[testenv:dsvm-functional-sol-vnflcm-userdata] +setenv = {[testenv]setenv} + +commands = + stestr --test-path=./tacker/tests/functional/sol/vnflcm_userdata run --slowest --concurrency 1 {posargs} + [testenv:dsvm-functional-sol-vnfpkgm] setenv = {[testenv]setenv}