Merge "Update microversion for for the tests which fail due to multiattach enabled" into mcp/yoga
diff --git a/tempest/api/compute/admin/test_live_migration.py b/tempest/api/compute/admin/test_live_migration.py
index c91b557..8243f71 100644
--- a/tempest/api/compute/admin/test_live_migration.py
+++ b/tempest/api/compute/admin/test_live_migration.py
@@ -363,3 +363,6 @@
     min_microversion = '2.25'
     max_microversion = 'latest'
     block_migration = 'auto'
+
+    if CONF.compute_feature_enabled.volume_multiattach:
+        min_microversion = '2.60'
diff --git a/tempest/api/compute/admin/test_volume.py b/tempest/api/compute/admin/test_volume.py
index 8eb5d62..7b50857 100644
--- a/tempest/api/compute/admin/test_volume.py
+++ b/tempest/api/compute/admin/test_volume.py
@@ -73,6 +73,9 @@
 class AttachSCSIVolumeTestJSON(BaseAttachSCSIVolumeTest):
     """Test attaching scsi volume to server"""
 
+    if CONF.compute_feature_enabled.volume_multiattach:
+        min_microversion = '2.60'
+
     @testtools.skipIf(
         CONF.compute_feature_enabled.barbican_integration_enabled,
         "Not supported when barbican integration enabled.")
diff --git a/tempest/api/compute/admin/test_volume_swap.py b/tempest/api/compute/admin/test_volume_swap.py
index c1236a7..66e2d12 100644
--- a/tempest/api/compute/admin/test_volume_swap.py
+++ b/tempest/api/compute/admin/test_volume_swap.py
@@ -70,6 +70,9 @@
 class TestVolumeSwap(TestVolumeSwapBase):
     """The test suite for swapping of volume with admin user"""
 
+    if CONF.compute_feature_enabled.volume_multiattach:
+        min_microversion = '2.60'
+
     # NOTE(mriedem): This is an uncommon scenario to call the compute API
     # to swap volumes directly; swap volume is primarily only for volume
     # live migration and retype callbacks from the volume service, and is slow
diff --git a/tempest/api/compute/admin/test_volumes_negative.py b/tempest/api/compute/admin/test_volumes_negative.py
index 10d522b..24b0a52 100644
--- a/tempest/api/compute/admin/test_volumes_negative.py
+++ b/tempest/api/compute/admin/test_volumes_negative.py
@@ -27,6 +27,10 @@
 
     create_default_network = True
 
+    if CONF.compute_feature_enabled.volume_multiattach:
+        min_microversion = '2.60'
+        max_microversion = 'latest'
+
     @classmethod
     def skip_checks(cls):
         super(VolumesAdminNegativeTest, cls).skip_checks()
diff --git a/tempest/api/compute/servers/test_delete_server.py b/tempest/api/compute/servers/test_delete_server.py
index fdf0975..178be16 100644
--- a/tempest/api/compute/servers/test_delete_server.py
+++ b/tempest/api/compute/servers/test_delete_server.py
@@ -29,6 +29,9 @@
     """Test deleting servers in various states"""
     create_default_network = True
 
+    if CONF.compute_feature_enabled.volume_multiattach:
+        min_microversion = '2.60'
+
     # NOTE: Server creations of each test class should be under 10
     # for preventing "Quota exceeded for instances"
 
diff --git a/tempest/api/compute/servers/test_device_tagging.py b/tempest/api/compute/servers/test_device_tagging.py
index 7d29a4d..c7ff4ba 100644
--- a/tempest/api/compute/servers/test_device_tagging.py
+++ b/tempest/api/compute/servers/test_device_tagging.py
@@ -115,6 +115,10 @@
     # 2.32 and 2.36 inclusive; the 2.37 microversion broke tags for networks.
     max_microversion = '2.32'
 
+    if CONF.compute_feature_enabled.volume_multiattach:
+        min_microversion = '2.60'
+        max_microversion = 'latest'
+
     def verify_device_metadata(self, md_json):
         try:
             md_dict = json.loads(md_json)
@@ -319,6 +323,10 @@
     min_microversion = '2.42'
     max_microversion = 'latest'
 
+    if CONF.compute_feature_enabled.volume_multiattach:
+        min_microversion = '2.60'
+        max_microversion = 'latest'
+
 
 class TaggedAttachmentsTest(DeviceTaggingBase):
     """Test tagged attachments with compute microversion greater than 2.48"""
@@ -326,6 +334,10 @@
     min_microversion = '2.49'
     max_microversion = 'latest'
 
+    if CONF.compute_feature_enabled.volume_multiattach:
+        min_microversion = '2.60'
+        max_microversion = 'latest'
+
     @classmethod
     def skip_checks(cls):
         super(TaggedAttachmentsTest, cls).skip_checks()
diff --git a/tempest/api/compute/servers/test_server_actions.py b/tempest/api/compute/servers/test_server_actions.py
index 33ae501..0c6d164 100644
--- a/tempest/api/compute/servers/test_server_actions.py
+++ b/tempest/api/compute/servers/test_server_actions.py
@@ -37,6 +37,9 @@
 class ServerActionsTestJSON(base.BaseV2ComputeTest):
     """Test server actions"""
 
+    if CONF.compute_feature_enabled.volume_multiattach:
+        min_microversion = '2.60'
+
     def setUp(self):
         super(ServerActionsTestJSON, self).setUp()
         # Instead of reusing an instance which had been created before a new
diff --git a/tempest/api/compute/servers/test_server_rescue.py b/tempest/api/compute/servers/test_server_rescue.py
index 716ecda..697caaa 100644
--- a/tempest/api/compute/servers/test_server_rescue.py
+++ b/tempest/api/compute/servers/test_server_rescue.py
@@ -29,6 +29,9 @@
 class ServerRescueTestBase(base.BaseV2ComputeTest):
     create_default_network = True
 
+    if CONF.compute_feature_enabled.volume_multiattach:
+        min_microversion = '2.60'
+
     @classmethod
     def skip_checks(cls):
         super(ServerRescueTestBase, cls).skip_checks()
diff --git a/tempest/api/compute/servers/test_server_rescue_negative.py b/tempest/api/compute/servers/test_server_rescue_negative.py
index 955ba1c..5b11c3b 100644
--- a/tempest/api/compute/servers/test_server_rescue_negative.py
+++ b/tempest/api/compute/servers/test_server_rescue_negative.py
@@ -30,6 +30,9 @@
 class ServerRescueNegativeTestJSON(base.BaseV2ComputeTest):
     """Negative tests of server rescue"""
 
+    if CONF.compute_feature_enabled.volume_multiattach:
+        min_microversion = '2.60'
+
     @classmethod
     def skip_checks(cls):
         super(ServerRescueNegativeTestJSON, cls).skip_checks()
diff --git a/tempest/api/compute/volumes/test_attach_volume.py b/tempest/api/compute/volumes/test_attach_volume.py
index f0f95a1..ba02a4c 100644
--- a/tempest/api/compute/volumes/test_attach_volume.py
+++ b/tempest/api/compute/volumes/test_attach_volume.py
@@ -61,6 +61,9 @@
 class AttachVolumeTestJSON(BaseAttachVolumeTest):
     """Test attaching volume to server"""
 
+    if CONF.compute_feature_enabled.volume_multiattach:
+        min_microversion = '2.60'
+
     @decorators.idempotent_id('52e9045a-e90d-4c0d-9087-79d657faffff')
     # This test is conditionally marked slow if SSH validation is enabled.
     @decorators.attr(type='slow', condition=CONF.validation.run_validation)
diff --git a/tempest/api/compute/volumes/test_attach_volume_negative.py b/tempest/api/compute/volumes/test_attach_volume_negative.py
index 43b4bf5..09bf488 100644
--- a/tempest/api/compute/volumes/test_attach_volume_negative.py
+++ b/tempest/api/compute/volumes/test_attach_volume_negative.py
@@ -23,6 +23,9 @@
 class AttachVolumeNegativeTest(test_attach_volume.BaseAttachVolumeTest):
     """Negative tests of volume attaching"""
 
+    if CONF.compute_feature_enabled.volume_multiattach:
+        min_microversion = '2.60'
+
     @decorators.attr(type=['negative'])
     @decorators.related_bug('1630783', status_code=500)
     @decorators.idempotent_id('a313b5cd-fbd0-49cc-94de-870e99f763c7')
diff --git a/tempest/api/volume/base.py b/tempest/api/volume/base.py
index b90b5bb..e1321c0 100644
--- a/tempest/api/volume/base.py
+++ b/tempest/api/volume/base.py
@@ -200,6 +200,12 @@
             data_utils.rand_name(self.__class__.__name__ + '-instance'))
 
         tenant_network = self.get_tenant_network()
+
+        # Since microversion v2.37 'networks' field is required
+        if self.compute_request_microversion >= '2.37' and 'networks'\
+                not in kwargs:
+            kwargs['networks'] = 'none'
+
         body, _ = compute.create_test_server(
             self.os_primary,
             tenant_network=tenant_network,
diff --git a/tempest/api/volume/test_volumes_backup.py b/tempest/api/volume/test_volumes_backup.py
index 138d120..1f5749d 100644
--- a/tempest/api/volume/test_volumes_backup.py
+++ b/tempest/api/volume/test_volumes_backup.py
@@ -29,6 +29,9 @@
 class VolumesBackupsTest(base.BaseVolumeTest):
     """Test volumes backup"""
 
+    if CONF.compute_feature_enabled.volume_multiattach:
+        min_microversion = '2.60'
+
     @classmethod
     def skip_checks(cls):
         super(VolumesBackupsTest, cls).skip_checks()
diff --git a/tempest/api/volume/test_volumes_extend.py b/tempest/api/volume/test_volumes_extend.py
index fcbc982..4e8c324 100644
--- a/tempest/api/volume/test_volumes_extend.py
+++ b/tempest/api/volume/test_volumes_extend.py
@@ -178,6 +178,9 @@
 
 class VolumesExtendAttachedTest(BaseVolumesExtendAttachedTest):
 
+    if CONF.compute_feature_enabled.volume_multiattach:
+        min_microversion = '2.60'
+
     @decorators.idempotent_id('301f5a30-1c6f-4ea0-be1a-91fd28d44354')
     @testtools.skipUnless(CONF.volume_feature_enabled.extend_attached_volume,
                           "Attached volume extend is disabled.")
diff --git a/tempest/api/volume/test_volumes_snapshots.py b/tempest/api/volume/test_volumes_snapshots.py
index a58da7e..e9e80bb 100644
--- a/tempest/api/volume/test_volumes_snapshots.py
+++ b/tempest/api/volume/test_volumes_snapshots.py
@@ -29,6 +29,9 @@
 
     create_default_network = True
 
+    if CONF.compute_feature_enabled.volume_multiattach:
+        min_microversion = '2.60'
+
     @classmethod
     def skip_checks(cls):
         super(VolumesSnapshotTestJSON, cls).skip_checks()
diff --git a/tempest/scenario/manager.py b/tempest/scenario/manager.py
index f8bdd9c..d298361 100644
--- a/tempest/scenario/manager.py
+++ b/tempest/scenario/manager.py
@@ -48,7 +48,10 @@
 
     credentials = ['primary', 'admin']
 
-    compute_min_microversion = None
+    if CONF.compute_feature_enabled.volume_multiattach:
+        compute_min_microversion = '2.60'
+    else:
+        compute_min_microversion = None
     compute_max_microversion = LATEST_MICROVERSION
     volume_min_microversion = None
     volume_max_microversion = LATEST_MICROVERSION
@@ -808,7 +811,12 @@
             name = data_utils.rand_name(self.__class__.__name__ + 'snapshot')
         LOG.debug("Creating a snapshot image for server: %s", server['name'])
         image = _images_client.create_image(server['id'], name=name, **kwargs)
-        image_id = image.response['location'].split('images/')[1]
+
+        if self.compute_min_microversion >= '2.60':
+            image_id = image['image_id']
+        else:
+            image_id = image.response['location'].split('images/')[1]
+
         waiters.wait_for_image_status(_image_client, image_id, 'active')
 
         self.addCleanup(_image_client.wait_for_resource_deletion,
diff --git a/tempest/scenario/test_network_advanced_server_ops.py b/tempest/scenario/test_network_advanced_server_ops.py
index b48ac3c..dc19e89 100644
--- a/tempest/scenario/test_network_advanced_server_ops.py
+++ b/tempest/scenario/test_network_advanced_server_ops.py
@@ -202,7 +202,11 @@
             self.assertEqual(resize_flavor, server['flavor']['id'])
         else:
             flavor = self.flavors_client.show_flavor(resize_flavor)['flavor']
-            self.assertEqual(flavor['name'], server['original_name'])
+            if self.compute_min_microversion >= '2.60':
+                self.assertEqual(flavor['name'],
+                                 server['flavor']['original_name'])
+            else:
+                self.assertEqual(flavor['name'], server['original_name'])
             for key in ['ram', 'vcpus', 'disk']:
                 self.assertEqual(flavor[key], server['flavor'][key])
         self._wait_server_status_and_check_network_connectivity(