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
diff --git a/tempest/scenario/manager.py b/tempest/scenario/manager.py
index 87d7e76..6ce5b78 100644
--- a/tempest/scenario/manager.py
+++ b/tempest/scenario/manager.py
@@ -274,6 +274,10 @@
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 @@
'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,