From 979e494da246711751e97236e2681d6db9bd3e4e Mon Sep 17 00:00:00 2001 From: Marc Koderer Date: Thu, 8 Dec 2016 10:07:59 +0100 Subject: [PATCH] Specify availability zone to create instances and volumes For clouds with separate AZs (like two independent fire compartments) the cross_az_attach feature is typically used. But using this feature the scenario tests in tempest will fail since Cinder/Nova will schedule the AZ independently. This patch introduces a new parameter compute_volume_common_az to specify the availability zone to create instances and volumes, so that we can confirm that these resources are created in the same availability zone. Change-Id: I565adbe2a3ebbdd1d73143380b976df1a9502d0f Closes-bug: #1647999 --- .../notes/bug-1647999-7aeda50a8d082d4c.yaml | 8 ++++++++ tempest/config.py | 13 +++++++++++++ tempest/scenario/manager.py | 9 +++++++++ 3 files changed, 30 insertions(+) create mode 100644 releasenotes/notes/bug-1647999-7aeda50a8d082d4c.yaml diff --git a/releasenotes/notes/bug-1647999-7aeda50a8d082d4c.yaml b/releasenotes/notes/bug-1647999-7aeda50a8d082d4c.yaml new file mode 100644 index 0000000000..384f9167aa --- /dev/null +++ b/releasenotes/notes/bug-1647999-7aeda50a8d082d4c.yaml @@ -0,0 +1,8 @@ +--- +features: + - | + A new parameter, compute/compute_volume_common_az is introduced to + specify availability zone where tempest creates instances and volumes + for scenario tests, to allow us to run scenario tests in the deployment + which has multiple availability zones and cinder/cross_az_attach in + nova.conf is set to False. diff --git a/tempest/config.py b/tempest/config.py index 68301487a2..45eef644a5 100644 --- a/tempest/config.py +++ b/tempest/config.py @@ -357,6 +357,19 @@ ComputeGroup = [ "If both values are not specified, Tempest avoids tests " "which require a microversion. Valid values are string " "with format 'X.Y' or string 'latest'"), + cfg.StrOpt('compute_volume_common_az', + default=None, + help='AZ to be used for Cinder and Nova. Set this parameter ' + 'when the cloud has nova.conf: cinder.cross_az_attach ' + 'set to false. Which means volumes attached to an ' + 'instance must be in the same availability zone in Cinder ' + 'as the instance availability zone in Nova. Set the ' + 'common availability zone in this config which will be ' + 'used to boot an instance as well as creating a volume. ' + 'NOTE: If that AZ is not in Cinder (or ' + 'allow_availability_zone_fallback=False in cinder.conf), ' + 'the volume create request will fail and the instance ' + 'will fail the build request.'), ] placement_group = cfg.OptGroup(name='placement', diff --git a/tempest/scenario/manager.py b/tempest/scenario/manager.py index 87d7e765cc..6ce5b78471 100644 --- a/tempest/scenario/manager.py +++ b/tempest/scenario/manager.py @@ -274,6 +274,10 @@ class ScenarioTest(tempest.test.BaseTestCase): tenant_network = self.get_tenant_network() + if CONF.compute.compute_volume_common_az: + kwargs.setdefault('availability_zone', + CONF.compute.compute_volume_common_az) + body, _ = compute.create_test_server( clients, tenant_network=tenant_network, @@ -307,6 +311,11 @@ class ScenarioTest(tempest.test.BaseTestCase): 'imageRef': imageRef, 'volume_type': volume_type, 'size': size} + + if CONF.compute.compute_volume_common_az: + kwargs.setdefault('availability_zone', + CONF.compute.compute_volume_common_az) + volume = self.volumes_client.create_volume(**kwargs)['volume'] self.addCleanup(self.volumes_client.wait_for_resource_deletion,