Merge "Move verify-ipv6-only-deployments"
diff --git a/tempest/api/compute/admin/test_create_server.py b/tempest/api/compute/admin/test_create_server.py
index c4a8bf5..ccdfbf3 100644
--- a/tempest/api/compute/admin/test_create_server.py
+++ b/tempest/api/compute/admin/test_create_server.py
@@ -42,6 +42,8 @@
     @decorators.idempotent_id('b3c7bcfc-bb5b-4e22-b517-c7f686b802ca')
     @testtools.skipUnless(CONF.validation.run_validation,
                           'Instance validation tests are disabled.')
+    @testtools.skipIf("aarch64" in CONF.scenario.img_file,
+                      "Aarch64 does not support ephemeral disk test")
     def test_verify_created_server_ephemeral_disk(self):
         """Verify that the ephemeral disk is created when creating server"""
         flavor_base = self.flavors_client.show_flavor(
diff --git a/tempest/api/compute/servers/test_server_rescue.py b/tempest/api/compute/servers/test_server_rescue.py
index a9f8c09..354e3b9 100644
--- a/tempest/api/compute/servers/test_server_rescue.py
+++ b/tempest/api/compute/servers/test_server_rescue.py
@@ -168,6 +168,8 @@
             raise cls.skipException("IDE bus not available.")
 
     @decorators.idempotent_id('947004c3-e8ef-47d9-9f00-97b74f9eaf96')
+    @testtools.skipIf("aarch64" in CONF.scenario.img_file,
+                      "Aarch64 does not support ide bus for cdrom")
     def test_stable_device_rescue_cdrom_ide(self):
         """Test rescuing server with cdrom and ide as the rescue disk"""
         server_id, rescue_image_id = self._create_server_and_rescue_image(
diff --git a/tempest/lib/api_schema/response/volume/services.py b/tempest/lib/api_schema/response/volume/services.py
index 70de878..216631c 100644
--- a/tempest/lib/api_schema/response/volume/services.py
+++ b/tempest/lib/api_schema/response/volume/services.py
@@ -33,10 +33,6 @@
                         'frozen': {'type': 'boolean'},
                         'updated_at': parameter_types.date_time,
                         'zone': {'type': 'string'},
-                        # TODO(zhufl): cluster is added in 3.7, we should move
-                        # it to the 3.7 schema file when microversion is
-                        # supported in volume interfaces
-                        'cluster': {'type': 'string'},
                         'replication_status': {'type': 'string'},
                         'active_backend_id': {'type': ['string', 'null']},
                         'backend_state': {'type': 'string'},
diff --git a/tempest/lib/api_schema/response/volume/v3_7/__init__.py b/tempest/lib/api_schema/response/volume/v3_7/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tempest/lib/api_schema/response/volume/v3_7/__init__.py
diff --git a/tempest/lib/api_schema/response/volume/v3_7/services.py b/tempest/lib/api_schema/response/volume/v3_7/services.py
new file mode 100644
index 0000000..8d43188
--- /dev/null
+++ b/tempest/lib/api_schema/response/volume/v3_7/services.py
@@ -0,0 +1,34 @@
+# Copyright 2020 ZTE Corporation.  All rights reserved.
+#
+#    Licensed under the Apache License, Version 2.0 (the "License"); you may
+#    not use this file except in compliance with the License. You may obtain
+#    a copy of the License at
+#
+#         http://www.apache.org/licenses/LICENSE-2.0
+#
+#    Unless required by applicable law or agreed to in writing, software
+#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+#    License for the specific language governing permissions and limitations
+#    under the License.
+import copy
+
+from tempest.lib.api_schema.response.volume import services
+
+# Volume microversion 3.7:
+# 1. New optional attribute in 'services' dict.
+#      'cluster'
+
+list_services = copy.deepcopy(services.list_services)
+list_services['response_body']['properties']['services']['items'][
+    'properties'].update({'cluster': {'type': ['string', 'null']}})
+
+# NOTE(zhufl): Below are the unchanged schema in this microversion. We need
+# to keep this schema in this file to have the generic way to select the
+# right schema based on self.schema_versions_info mapping in service client.
+# ****** Schemas unchanged since microversion 3.0 ******
+enable_service = copy.deepcopy(services.enable_service)
+disable_service = copy.deepcopy(services.disable_service)
+disable_log_reason = copy.deepcopy(services.disable_log_reason)
+freeze_host = copy.deepcopy(services.freeze_host)
+thaw_host = copy.deepcopy(services.thaw_host)
diff --git a/tempest/lib/services/volume/base_client.py b/tempest/lib/services/volume/base_client.py
index c7fb21a..c0ac62d 100644
--- a/tempest/lib/services/volume/base_client.py
+++ b/tempest/lib/services/volume/base_client.py
@@ -13,8 +13,10 @@
 #    License for the specific language governing permissions and limitations
 #    under the License.
 
+from tempest.lib.common import api_version_request
 from tempest.lib.common import api_version_utils
 from tempest.lib.common import rest_client
+from tempest.lib import exceptions
 
 VOLUME_MICROVERSION = None
 
@@ -43,3 +45,39 @@
                 'volume %s' % VOLUME_MICROVERSION,
                 resp)
         return resp, resp_body
+
+    def get_schema(self, schema_versions_info):
+        """Get JSON schema
+
+        This method provides the matching schema for requested
+        microversion.
+
+        :param schema_versions_info: List of dict which provides schema
+                                     information with range of valid versions.
+
+        Example::
+
+         schema_versions_info = [
+             {'min': None, 'max': '2.1', 'schema': schemav21},
+             {'min': '2.2', 'max': '2.9', 'schema': schemav22},
+             {'min': '2.10', 'max': None, 'schema': schemav210}]
+        """
+        schema = None
+        version = api_version_request.APIVersionRequest(VOLUME_MICROVERSION)
+        for items in schema_versions_info:
+            min_version = api_version_request.APIVersionRequest(items['min'])
+            max_version = api_version_request.APIVersionRequest(items['max'])
+            # This is case where COMPUTE_MICROVERSION is None, which means
+            # request without microversion So select base v2.1 schema.
+            if version.is_null() and items['min'] is None:
+                schema = items['schema']
+                break
+            # else select appropriate schema as per COMPUTE_MICROVERSION
+            elif version.matches(min_version, max_version):
+                schema = items['schema']
+                break
+        if schema is None:
+            raise exceptions.JSONSchemaNotFound(
+                version=version.get_string(),
+                schema_versions_info=schema_versions_info)
+        return schema
diff --git a/tempest/lib/services/volume/v3/services_client.py b/tempest/lib/services/volume/v3/services_client.py
index 4672da8..1111f81 100644
--- a/tempest/lib/services/volume/v3/services_client.py
+++ b/tempest/lib/services/volume/v3/services_client.py
@@ -18,12 +18,18 @@
 from oslo_serialization import jsonutils as json
 
 from tempest.lib.api_schema.response.volume import services as schema
+from tempest.lib.api_schema.response.volume.v3_7 import services as schemav37
 from tempest.lib.common import rest_client
+from tempest.lib.services.volume import base_client
 
 
-class ServicesClient(rest_client.RestClient):
+class ServicesClient(base_client.BaseClient):
     """Client class to send CRUD Volume Services API requests"""
 
+    schema_versions_info = [
+        {'min': None, 'max': '3.6', 'schema': schema},
+        {'min': '3.7', 'max': None, 'schema': schemav37}]
+
     def list_services(self, **params):
         """List all Cinder services.
 
@@ -37,6 +43,7 @@
 
         resp, body = self.get(url)
         body = json.loads(body)
+        schema = self.get_schema(self.schema_versions_info)
         self.validate_response(schema.list_services, resp, body)
         return rest_client.ResponseBody(resp, body)