Merge "Skip adding host to aggregate with az if host already in other zone" into mcp/ussuri
diff --git a/tempest/api/compute/admin/test_migrations.py b/tempest/api/compute/admin/test_migrations.py
index 37f5aec..8c20c32 100644
--- a/tempest/api/compute/admin/test_migrations.py
+++ b/tempest/api/compute/admin/test_migrations.py
@@ -38,8 +38,9 @@
         self.client.list_migrations()
 
     @decorators.idempotent_id('1b512062-8093-438e-b47a-37d2f597cd64')
-    @testtools.skipUnless(CONF.compute_feature_enabled.resize,
-                          'Resize not available.')
+    @testtools.skipIf(not (CONF.compute_feature_enabled.cold_migration and
+                           CONF.compute_feature_enabled.resize),
+                      'Cold migration/Resize not available.')
     def test_list_migrations_in_flavor_resize_situation(self):
         """Admin can get the migrations list containing the resized server"""
         server = self.create_test_server(wait_until="ACTIVE")
@@ -60,8 +61,9 @@
             pass
 
     @decorators.idempotent_id('33f1fec3-ba18-4470-8e4e-1d888e7c3593')
-    @testtools.skipUnless(CONF.compute_feature_enabled.resize,
-                          'Resize not available.')
+    @testtools.skipIf(not (CONF.compute_feature_enabled.cold_migration and
+                           CONF.compute_feature_enabled.resize),
+                      'Cold migration/Resize not available.')
     def test_resize_server_revert_deleted_flavor(self):
         """Test reverting resized server with original flavor deleted
 
diff --git a/tempest/api/compute/admin/test_servers_negative.py b/tempest/api/compute/admin/test_servers_negative.py
index f720b84..5c3fe83 100644
--- a/tempest/api/compute/admin/test_servers_negative.py
+++ b/tempest/api/compute/admin/test_servers_negative.py
@@ -43,8 +43,9 @@
         cls.s1_id = server['id']
 
     @decorators.idempotent_id('28dcec23-f807-49da-822c-56a92ea3c687')
-    @testtools.skipUnless(CONF.compute_feature_enabled.resize,
-                          'Resize not available.')
+    @testtools.skipIf(not (CONF.compute_feature_enabled.cold_migration and
+                           CONF.compute_feature_enabled.resize),
+                      'Cold migration/Resize not available.')
     @decorators.attr(type=['negative'])
     def test_resize_server_using_overlimit_ram(self):
         # NOTE(mriedem): Avoid conflicts with os-quota-class-sets tests.
@@ -65,8 +66,9 @@
                           flavor_ref['id'])
 
     @decorators.idempotent_id('7368a427-2f26-4ad9-9ba9-911a0ec2b0db')
-    @testtools.skipUnless(CONF.compute_feature_enabled.resize,
-                          'Resize not available.')
+    @testtools.skipIf(not (CONF.compute_feature_enabled.cold_migration and
+                           CONF.compute_feature_enabled.resize),
+                      'Cold migration/Resize not available.')
     @decorators.attr(type=['negative'])
     def test_resize_server_using_overlimit_vcpus(self):
         # NOTE(mriedem): Avoid conflicts with os-quota-class-sets tests.
diff --git a/tempest/api/compute/servers/test_delete_server.py b/tempest/api/compute/servers/test_delete_server.py
index a7db88a..4d7d89e 100644
--- a/tempest/api/compute/servers/test_delete_server.py
+++ b/tempest/api/compute/servers/test_delete_server.py
@@ -93,8 +93,9 @@
         waiters.wait_for_server_termination(self.client, server['id'])
 
     @decorators.idempotent_id('ab0c38b4-cdd8-49d3-9b92-0cb898723c01')
-    @testtools.skipIf(not CONF.compute_feature_enabled.resize,
-                      'Resize not available.')
+    @testtools.skipIf(not (CONF.compute_feature_enabled.cold_migration and
+                           CONF.compute_feature_enabled.resize),
+                      'Cold migration/Resize not available.')
     def test_delete_server_while_in_verify_resize_state(self):
         # Delete a server while it's VM state is VERIFY_RESIZE
         server = self.create_test_server(wait_until='ACTIVE')
diff --git a/tempest/api/compute/servers/test_disk_config.py b/tempest/api/compute/servers/test_disk_config.py
index 5b8e7ab..531ab7e 100644
--- a/tempest/api/compute/servers/test_disk_config.py
+++ b/tempest/api/compute/servers/test_disk_config.py
@@ -86,8 +86,9 @@
         self.assertEqual('AUTO', server['OS-DCF:diskConfig'])
 
     @decorators.idempotent_id('414e7e93-45b5-44bc-8e03-55159c6bfc97')
-    @testtools.skipUnless(CONF.compute_feature_enabled.resize,
-                          'Resize not available.')
+    @testtools.skipIf(not (CONF.compute_feature_enabled.cold_migration and
+                           CONF.compute_feature_enabled.resize),
+                      'Cold migration/Resize not available.')
     def test_resize_server_from_manual_to_auto(self):
         # A server should be resized from manual to auto disk config
         server = self.create_test_server(wait_until='ACTIVE')
@@ -102,8 +103,9 @@
         self.assertEqual('AUTO', server['OS-DCF:diskConfig'])
 
     @decorators.idempotent_id('693d16f3-556c-489a-8bac-3d0ca2490bad')
-    @testtools.skipUnless(CONF.compute_feature_enabled.resize,
-                          'Resize not available.')
+    @testtools.skipIf(not (CONF.compute_feature_enabled.cold_migration and
+                           CONF.compute_feature_enabled.resize),
+                      'Cold migration/Resize not available.')
     def test_resize_server_from_auto_to_manual(self):
         # A server should be resized from auto to manual disk config
         server = self.create_test_server(wait_until='ACTIVE')
diff --git a/tempest/api/compute/servers/test_server_actions.py b/tempest/api/compute/servers/test_server_actions.py
index 6f8e297..ff50e64 100644
--- a/tempest/api/compute/servers/test_server_actions.py
+++ b/tempest/api/compute/servers/test_server_actions.py
@@ -300,15 +300,17 @@
             self.client.start_server(server_id)
 
     @decorators.idempotent_id('1499262a-9328-4eda-9068-db1ac57498d2')
-    @testtools.skipUnless(CONF.compute_feature_enabled.resize,
-                          'Resize not available.')
+    @testtools.skipIf(not (CONF.compute_feature_enabled.cold_migration and
+                           CONF.compute_feature_enabled.resize),
+                      'Cold migration/Resize not available.')
     def test_resize_server_confirm(self):
         self._test_resize_server_confirm(self.server_id, stop=False)
 
     @decorators.idempotent_id('e6c28180-7454-4b59-b188-0257af08a63b')
     @decorators.related_bug('1728603')
-    @testtools.skipUnless(CONF.compute_feature_enabled.resize,
-                          'Resize not available.')
+    @testtools.skipIf(not (CONF.compute_feature_enabled.cold_migration and
+                           CONF.compute_feature_enabled.resize),
+                      'Cold migration/Resize not available.')
     @utils.services('volume')
     def test_resize_volume_backed_server_confirm(self):
         # We have to create a new server that is volume-backed since the one
@@ -344,14 +346,16 @@
             linux_client.validate_authentication()
 
     @decorators.idempotent_id('138b131d-66df-48c9-a171-64f45eb92962')
-    @testtools.skipUnless(CONF.compute_feature_enabled.resize,
-                          'Resize not available.')
+    @testtools.skipIf(not (CONF.compute_feature_enabled.cold_migration and
+                           CONF.compute_feature_enabled.resize),
+                      'Cold migration/Resize not available.')
     def test_resize_server_confirm_from_stopped(self):
         self._test_resize_server_confirm(self.server_id, stop=True)
 
     @decorators.idempotent_id('c03aab19-adb1-44f5-917d-c419577e9e68')
-    @testtools.skipUnless(CONF.compute_feature_enabled.resize,
-                          'Resize not available.')
+    @testtools.skipIf(not (CONF.compute_feature_enabled.cold_migration and
+                           CONF.compute_feature_enabled.resize),
+                      'Cold migration/Resize not available.')
     def test_resize_server_revert(self):
         # The server's RAM and disk space should return to its original
         # values after a resize is reverted
@@ -368,8 +372,9 @@
 
     @decorators.idempotent_id('fbbf075f-a812-4022-bc5c-ccb8047eef12')
     @decorators.related_bug('1737599')
-    @testtools.skipUnless(CONF.compute_feature_enabled.resize,
-                          'Resize not available.')
+    @testtools.skipIf(not (CONF.compute_feature_enabled.cold_migration and
+                           CONF.compute_feature_enabled.resize),
+                      'Cold migration/Resize not available.')
     @utils.services('volume')
     def test_resize_server_revert_with_volume_attached(self):
         # Tests attaching a volume to a server instance and then resizing
diff --git a/tempest/api/compute/servers/test_servers_negative.py b/tempest/api/compute/servers/test_servers_negative.py
index 7fa30b0..ee2de58 100644
--- a/tempest/api/compute/servers/test_servers_negative.py
+++ b/tempest/api/compute/servers/test_servers_negative.py
@@ -125,8 +125,9 @@
                           self.create_test_server, accessIPv6=IPv6)
 
     @decorators.idempotent_id('7ea45b3e-e770-46fa-bfcc-9daaf6d987c0')
-    @testtools.skipUnless(CONF.compute_feature_enabled.resize,
-                          'Resize not available.')
+    @testtools.skipIf(not (CONF.compute_feature_enabled.cold_migration and
+                           CONF.compute_feature_enabled.resize),
+                      'Cold migration/Resize not available.')
     @decorators.attr(type=['negative'])
     def test_resize_nonexistent_server(self):
         # Resize a non-existent server
@@ -136,8 +137,9 @@
                           nonexistent_server, self.flavor_ref)
 
     @decorators.idempotent_id('ced1a1d7-2ab6-45c9-b90f-b27d87b30efd')
-    @testtools.skipUnless(CONF.compute_feature_enabled.resize,
-                          'Resize not available.')
+    @testtools.skipIf(not (CONF.compute_feature_enabled.cold_migration and
+                           CONF.compute_feature_enabled.resize),
+                      'Cold migration/Resize not available.')
     @decorators.attr(type=['negative'])
     def test_resize_server_with_non_existent_flavor(self):
         # Resize a server with non-existent flavor
@@ -146,8 +148,9 @@
                           self.server_id, flavor_ref=nonexistent_flavor)
 
     @decorators.idempotent_id('45436a7d-a388-4a35-a9d8-3adc5d0d940b')
-    @testtools.skipUnless(CONF.compute_feature_enabled.resize,
-                          'Resize not available.')
+    @testtools.skipIf(not (CONF.compute_feature_enabled.cold_migration and
+                           CONF.compute_feature_enabled.resize),
+                      'Cold migration/Resize not available.')
     @decorators.attr(type=['negative'])
     def test_resize_server_with_null_flavor(self):
         # Resize a server with null flavor
diff --git a/tempest/api/compute/volumes/test_attach_volume.py b/tempest/api/compute/volumes/test_attach_volume.py
index 97813a5..91aeccd 100644
--- a/tempest/api/compute/volumes/test_attach_volume.py
+++ b/tempest/api/compute/volumes/test_attach_volume.py
@@ -445,8 +445,9 @@
         self.volumes_client.wait_for_resource_deletion(volume['id'])
 
     @decorators.idempotent_id('f01c7169-a124-4fc7-ae60-5e380e247c9c')
-    @testtools.skipUnless(CONF.compute_feature_enabled.resize,
-                          'Resize not available.')
+    @testtools.skipIf(not (CONF.compute_feature_enabled.cold_migration and
+                           CONF.compute_feature_enabled.resize),
+                      'Cold migration/Resize not available.')
     def test_resize_server_with_multiattached_volume(self):
         # Attach a single volume to multiple servers, then resize the servers
         servers, volume, _ = self._create_and_multiattach()
diff --git a/tempest/api/volume/test_volumes_filters.py b/tempest/api/volume/test_volumes_filters.py
index ac164eb..74ba9cb 100644
--- a/tempest/api/volume/test_volumes_filters.py
+++ b/tempest/api/volume/test_volumes_filters.py
@@ -28,6 +28,10 @@
         "InstanceLocalityFilter" in CONF.volume.scheduler_default_filters,
         "Cinder InstanceLocalityFilter is disabled",
     )
+    @testtools.skipUnless(
+        CONF.volume_feature_enabled.instance_locality_enabled,
+        "InstanceLocalityFilter test is disabled",
+    )
     @decorators.idempotent_id("5c13f4f7-5add-4fad-8ef7-dccca0f76295")
     def test_instancelocalityfilter(self):
         # 1. Create instance
diff --git a/tempest/config.py b/tempest/config.py
index fdd4842..5e5bece 100644
--- a/tempest/config.py
+++ b/tempest/config.py
@@ -1011,7 +1011,11 @@
     cfg.BoolOpt('cluster_active_active',
                 default=False,
                 help='The boolean flag to indicate if active-active mode '
-                     'is used by volume backend.')
+                     'is used by volume backend.'),
+    cfg.BoolOpt('instance_locality_enabled',
+                default=False,
+                help='The boolean flag to run instance locality  tests '
+                     'on environment.')
 ]