diff --git a/doc/source/microversion_testing.rst b/doc/source/microversion_testing.rst index f5da6f9303..8c8d3b2fe5 100644 --- a/doc/source/microversion_testing.rst +++ b/doc/source/microversion_testing.rst @@ -374,6 +374,10 @@ Microversion tests implemented in Tempest .. _2.42: https://docs.openstack.org/nova/latest/reference/api-microversion-history.html#maximum-in-ocata + * `2.45`_ + + .. _2.45: https://docs.openstack.org/nova/latest/reference/api-microversion-history.html#id41 + * `2.47`_ .. _2.47: https://docs.openstack.org/nova/latest/reference/api-microversion-history.html#id43 diff --git a/tempest/api/compute/servers/test_server_actions.py b/tempest/api/compute/servers/test_server_actions.py index c415c00db7..870c6f5419 100644 --- a/tempest/api/compute/servers/test_server_actions.py +++ b/tempest/api/compute/servers/test_server_actions.py @@ -792,3 +792,28 @@ class ServerActionsTestJSON(base.BaseV2ComputeTest): self.assertEqual('novnc', body['type']) self.assertNotEqual('', body['url']) self._validate_url(body['url']) + + +class ServersAaction247Test(base.BaseV2ComputeTest): + """Test compute server with microversion greater than 2.47 + + # NOTE(gmann): This test tests the Server create backup APIs + # response schema for 2.47 microversion. No specific assert + # or behaviour verification is needed. + """ + + min_microversion = '2.47' + + @testtools.skipUnless(CONF.compute_feature_enabled.snapshot, + 'Snapshotting not available, backup not possible.') + @utils.services('image') + @decorators.idempotent_id('252a4bdd-6366-4dae-9994-8c30aa660f23') + def test_create_backup(self): + server = self.create_test_server(wait_until='ACTIVE') + + backup1 = data_utils.rand_name('backup-1') + # Just check create_back to verify the schema with 2.47 + self.servers_client.create_backup(server['id'], + backup_type='daily', + rotation=2, + name=backup1) diff --git a/tempest/lib/api_schema/response/compute/v2_1/servers.py b/tempest/lib/api_schema/response/compute/v2_1/servers.py index 3300298d15..bd42afd2da 100644 --- a/tempest/lib/api_schema/response/compute/v2_1/servers.py +++ b/tempest/lib/api_schema/response/compute/v2_1/servers.py @@ -506,6 +506,10 @@ set_show_server_metadata_item = { } } +create_backup = { + 'status_code': [202] +} + server_actions_common_schema = { 'status_code': [202] } diff --git a/tempest/lib/api_schema/response/compute/v2_16/servers.py b/tempest/lib/api_schema/response/compute/v2_16/servers.py index dcd64cf72a..2b3ce38fe9 100644 --- a/tempest/lib/api_schema/response/compute/v2_16/servers.py +++ b/tempest/lib/api_schema/response/compute/v2_16/servers.py @@ -172,3 +172,4 @@ attach_volume = copy.deepcopy(servers.attach_volume) show_volume_attachment = copy.deepcopy(servers.show_volume_attachment) list_volume_attachments = copy.deepcopy(servers.list_volume_attachments) show_instance_action = copy.deepcopy(servers.show_instance_action) +create_backup = copy.deepcopy(servers.create_backup) diff --git a/tempest/lib/api_schema/response/compute/v2_19/servers.py b/tempest/lib/api_schema/response/compute/v2_19/servers.py index 0e4bd5c708..ba3d787740 100644 --- a/tempest/lib/api_schema/response/compute/v2_19/servers.py +++ b/tempest/lib/api_schema/response/compute/v2_19/servers.py @@ -62,3 +62,4 @@ attach_volume = copy.deepcopy(serversv216.attach_volume) show_volume_attachment = copy.deepcopy(serversv216.show_volume_attachment) list_volume_attachments = copy.deepcopy(serversv216.list_volume_attachments) show_instance_action = copy.deepcopy(serversv216.show_instance_action) +create_backup = copy.deepcopy(serversv216.create_backup) diff --git a/tempest/lib/api_schema/response/compute/v2_26/servers.py b/tempest/lib/api_schema/response/compute/v2_26/servers.py index 74c08f1015..123eb72d27 100644 --- a/tempest/lib/api_schema/response/compute/v2_26/servers.py +++ b/tempest/lib/api_schema/response/compute/v2_26/servers.py @@ -105,3 +105,4 @@ attach_volume = copy.deepcopy(servers219.attach_volume) show_volume_attachment = copy.deepcopy(servers219.show_volume_attachment) list_volume_attachments = copy.deepcopy(servers219.list_volume_attachments) show_instance_action = copy.deepcopy(servers219.show_instance_action) +create_backup = copy.deepcopy(servers219.create_backup) diff --git a/tempest/lib/api_schema/response/compute/v2_3/servers.py b/tempest/lib/api_schema/response/compute/v2_3/servers.py index 435e3ac855..d19f1ad62f 100644 --- a/tempest/lib/api_schema/response/compute/v2_3/servers.py +++ b/tempest/lib/api_schema/response/compute/v2_3/servers.py @@ -177,3 +177,4 @@ attach_volume = copy.deepcopy(servers.attach_volume) show_volume_attachment = copy.deepcopy(servers.show_volume_attachment) list_volume_attachments = copy.deepcopy(servers.list_volume_attachments) show_instance_action = copy.deepcopy(servers.show_instance_action) +create_backup = copy.deepcopy(servers.create_backup) diff --git a/tempest/lib/api_schema/response/compute/v2_45/servers.py b/tempest/lib/api_schema/response/compute/v2_45/servers.py new file mode 100644 index 0000000000..cb0fc13465 --- /dev/null +++ b/tempest/lib/api_schema/response/compute/v2_45/servers.py @@ -0,0 +1,49 @@ +# 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.compute.v2_26 import servers as servers226 + +create_backup = { + 'status_code': [202], + 'response_body': { + 'type': 'object', + 'properties': { + 'image_id': {'type': 'string', 'format': 'uuid'} + }, + 'additionalProperties': False, + 'required': ['image_id'] + } +} +# NOTE(gmann): 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 2.26 *** +get_server = copy.deepcopy(servers226.get_server) +list_servers_detail = copy.deepcopy(servers226.list_servers_detail) +update_server = copy.deepcopy(servers226.update_server) +rebuild_server = copy.deepcopy(servers226.rebuild_server) +rebuild_server_with_admin_pass = copy.deepcopy( + servers226.rebuild_server_with_admin_pass) +show_server_diagnostics = copy.deepcopy(servers226.show_server_diagnostics) +get_remote_consoles = copy.deepcopy(servers226.get_remote_consoles) +list_tags = copy.deepcopy(servers226.list_tags) +update_all_tags = copy.deepcopy(servers226.update_all_tags) +delete_all_tags = copy.deepcopy(servers226.delete_all_tags) +check_tag_existence = copy.deepcopy(servers226.check_tag_existence) +update_tag = copy.deepcopy(servers226.update_tag) +delete_tag = copy.deepcopy(servers226.delete_tag) +list_servers = copy.deepcopy(servers226.list_servers) +attach_volume = copy.deepcopy(servers226.attach_volume) +show_volume_attachment = copy.deepcopy(servers226.show_volume_attachment) +list_volume_attachments = copy.deepcopy(servers226.list_volume_attachments) diff --git a/tempest/lib/api_schema/response/compute/v2_47/servers.py b/tempest/lib/api_schema/response/compute/v2_47/servers.py index 70506026e1..1399c2d0ad 100644 --- a/tempest/lib/api_schema/response/compute/v2_47/servers.py +++ b/tempest/lib/api_schema/response/compute/v2_47/servers.py @@ -13,6 +13,7 @@ import copy from tempest.lib.api_schema.response.compute.v2_26 import servers as servers226 +from tempest.lib.api_schema.response.compute.v2_45 import servers as servers245 flavor = { 'type': 'object', @@ -34,39 +35,40 @@ flavor = { 'required': ['original_name', 'disk', 'ephemeral', 'ram', 'swap', 'vcpus'] } -get_server = copy.deepcopy(servers226.get_server) +get_server = copy.deepcopy(servers245.get_server) get_server['response_body']['properties']['server'][ 'properties'].update({'flavor': flavor}) -list_servers_detail = copy.deepcopy(servers226.list_servers_detail) +list_servers_detail = copy.deepcopy(servers245.list_servers_detail) list_servers_detail['response_body']['properties']['servers']['items'][ 'properties'].update({'flavor': flavor}) -update_server = copy.deepcopy(servers226.update_server) +update_server = copy.deepcopy(servers245.update_server) update_server['response_body']['properties']['server'][ 'properties'].update({'flavor': flavor}) -rebuild_server = copy.deepcopy(servers226.rebuild_server) +rebuild_server = copy.deepcopy(servers245.rebuild_server) rebuild_server['response_body']['properties']['server'][ 'properties'].update({'flavor': flavor}) rebuild_server_with_admin_pass = copy.deepcopy( - servers226.rebuild_server_with_admin_pass) + servers245.rebuild_server_with_admin_pass) rebuild_server_with_admin_pass['response_body']['properties']['server'][ 'properties'].update({'flavor': flavor}) # 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. -show_server_diagnostics = copy.deepcopy(servers226.show_server_diagnostics) -get_remote_consoles = copy.deepcopy(servers226.get_remote_consoles) -list_tags = copy.deepcopy(servers226.list_tags) -update_all_tags = copy.deepcopy(servers226.update_all_tags) -delete_all_tags = copy.deepcopy(servers226.delete_all_tags) -check_tag_existence = copy.deepcopy(servers226.check_tag_existence) -update_tag = copy.deepcopy(servers226.update_tag) -delete_tag = copy.deepcopy(servers226.delete_tag) -list_servers = copy.deepcopy(servers226.list_servers) -attach_volume = copy.deepcopy(servers226.attach_volume) -show_volume_attachment = copy.deepcopy(servers226.show_volume_attachment) -list_volume_attachments = copy.deepcopy(servers226.list_volume_attachments) +show_server_diagnostics = copy.deepcopy(servers245.show_server_diagnostics) +get_remote_consoles = copy.deepcopy(servers245.get_remote_consoles) +list_tags = copy.deepcopy(servers245.list_tags) +update_all_tags = copy.deepcopy(servers245.update_all_tags) +delete_all_tags = copy.deepcopy(servers245.delete_all_tags) +check_tag_existence = copy.deepcopy(servers245.check_tag_existence) +update_tag = copy.deepcopy(servers245.update_tag) +delete_tag = copy.deepcopy(servers245.delete_tag) +list_servers = copy.deepcopy(servers245.list_servers) +attach_volume = copy.deepcopy(servers245.attach_volume) +show_volume_attachment = copy.deepcopy(servers245.show_volume_attachment) +list_volume_attachments = copy.deepcopy(servers245.list_volume_attachments) show_instance_action = copy.deepcopy(servers226.show_instance_action) +create_backup = copy.deepcopy(servers245.create_backup) diff --git a/tempest/lib/api_schema/response/compute/v2_48/servers.py b/tempest/lib/api_schema/response/compute/v2_48/servers.py index af6344ba09..5b53906960 100644 --- a/tempest/lib/api_schema/response/compute/v2_48/servers.py +++ b/tempest/lib/api_schema/response/compute/v2_48/servers.py @@ -133,3 +133,4 @@ attach_volume = copy.deepcopy(servers247.attach_volume) show_volume_attachment = copy.deepcopy(servers247.show_volume_attachment) list_volume_attachments = copy.deepcopy(servers247.list_volume_attachments) show_instance_action = copy.deepcopy(servers247.show_instance_action) +create_backup = copy.deepcopy(servers247.create_backup) diff --git a/tempest/lib/api_schema/response/compute/v2_51/servers.py b/tempest/lib/api_schema/response/compute/v2_51/servers.py index e603287f7c..50d6aaa870 100644 --- a/tempest/lib/api_schema/response/compute/v2_51/servers.py +++ b/tempest/lib/api_schema/response/compute/v2_51/servers.py @@ -40,3 +40,4 @@ rebuild_server_with_admin_pass = copy.deepcopy( attach_volume = copy.deepcopy(servers248.attach_volume) show_volume_attachment = copy.deepcopy(servers248.show_volume_attachment) list_volume_attachments = copy.deepcopy(servers248.list_volume_attachments) +create_backup = copy.deepcopy(servers248.create_backup) diff --git a/tempest/lib/api_schema/response/compute/v2_54/servers.py b/tempest/lib/api_schema/response/compute/v2_54/servers.py index 135b3814be..9de30162dc 100644 --- a/tempest/lib/api_schema/response/compute/v2_54/servers.py +++ b/tempest/lib/api_schema/response/compute/v2_54/servers.py @@ -59,3 +59,4 @@ attach_volume = copy.deepcopy(servers251.attach_volume) show_volume_attachment = copy.deepcopy(servers251.show_volume_attachment) list_volume_attachments = copy.deepcopy(servers251.list_volume_attachments) show_instance_action = copy.deepcopy(servers251.show_instance_action) +create_backup = copy.deepcopy(servers251.create_backup) diff --git a/tempest/lib/api_schema/response/compute/v2_57/servers.py b/tempest/lib/api_schema/response/compute/v2_57/servers.py index bdff74b7a0..ee91391c69 100644 --- a/tempest/lib/api_schema/response/compute/v2_57/servers.py +++ b/tempest/lib/api_schema/response/compute/v2_57/servers.py @@ -63,3 +63,4 @@ attach_volume = copy.deepcopy(servers254.attach_volume) show_volume_attachment = copy.deepcopy(servers254.show_volume_attachment) list_volume_attachments = copy.deepcopy(servers254.list_volume_attachments) show_instance_action = copy.deepcopy(servers254.show_instance_action) +create_backup = copy.deepcopy(servers254.create_backup) diff --git a/tempest/lib/api_schema/response/compute/v2_58/servers.py b/tempest/lib/api_schema/response/compute/v2_58/servers.py index 62239cf58e..637b7653bb 100644 --- a/tempest/lib/api_schema/response/compute/v2_58/servers.py +++ b/tempest/lib/api_schema/response/compute/v2_58/servers.py @@ -42,3 +42,4 @@ rebuild_server_with_admin_pass = copy.deepcopy( attach_volume = copy.deepcopy(servers257.attach_volume) show_volume_attachment = copy.deepcopy(servers257.show_volume_attachment) list_volume_attachments = copy.deepcopy(servers257.list_volume_attachments) +create_backup = copy.deepcopy(servers257.create_backup) diff --git a/tempest/lib/api_schema/response/compute/v2_6/servers.py b/tempest/lib/api_schema/response/compute/v2_6/servers.py index 6103b7c784..e6b2c32b45 100644 --- a/tempest/lib/api_schema/response/compute/v2_6/servers.py +++ b/tempest/lib/api_schema/response/compute/v2_6/servers.py @@ -32,6 +32,7 @@ attach_volume = copy.deepcopy(servers.attach_volume) show_volume_attachment = copy.deepcopy(servers.show_volume_attachment) list_volume_attachments = copy.deepcopy(servers.list_volume_attachments) show_instance_action = copy.deepcopy(servers.show_instance_action) +create_backup = copy.deepcopy(servers.create_backup) # NOTE: The consolidated remote console API got introduced with v2.6 # with bp/consolidate-console-api. See Nova commit 578bafeda diff --git a/tempest/lib/api_schema/response/compute/v2_62/servers.py b/tempest/lib/api_schema/response/compute/v2_62/servers.py index 23eebbbacc..d761fe9e0a 100644 --- a/tempest/lib/api_schema/response/compute/v2_62/servers.py +++ b/tempest/lib/api_schema/response/compute/v2_62/servers.py @@ -45,3 +45,4 @@ rebuild_server_with_admin_pass = copy.deepcopy( attach_volume = copy.deepcopy(servers258.attach_volume) show_volume_attachment = copy.deepcopy(servers258.show_volume_attachment) list_volume_attachments = copy.deepcopy(servers258.list_volume_attachments) +create_backup = copy.deepcopy(servers258.create_backup) diff --git a/tempest/lib/api_schema/response/compute/v2_63/servers.py b/tempest/lib/api_schema/response/compute/v2_63/servers.py index db713b1fbb..865b4fdb2d 100644 --- a/tempest/lib/api_schema/response/compute/v2_63/servers.py +++ b/tempest/lib/api_schema/response/compute/v2_63/servers.py @@ -77,3 +77,4 @@ attach_volume = copy.deepcopy(servers262.attach_volume) show_volume_attachment = copy.deepcopy(servers262.show_volume_attachment) list_volume_attachments = copy.deepcopy(servers262.list_volume_attachments) show_instance_action = copy.deepcopy(servers262.show_instance_action) +create_backup = copy.deepcopy(servers262.create_backup) diff --git a/tempest/lib/api_schema/response/compute/v2_70/servers.py b/tempest/lib/api_schema/response/compute/v2_70/servers.py index 6103923371..6bb688a7eb 100644 --- a/tempest/lib/api_schema/response/compute/v2_70/servers.py +++ b/tempest/lib/api_schema/response/compute/v2_70/servers.py @@ -79,3 +79,4 @@ check_tag_existence = copy.deepcopy(servers263.check_tag_existence) update_tag = copy.deepcopy(servers263.update_tag) delete_tag = copy.deepcopy(servers263.delete_tag) show_instance_action = copy.deepcopy(servers263.show_instance_action) +create_backup = copy.deepcopy(servers263.create_backup) diff --git a/tempest/lib/api_schema/response/compute/v2_71/servers.py b/tempest/lib/api_schema/response/compute/v2_71/servers.py index 3e55c1c79e..b1c202b2c3 100644 --- a/tempest/lib/api_schema/response/compute/v2_71/servers.py +++ b/tempest/lib/api_schema/response/compute/v2_71/servers.py @@ -83,3 +83,4 @@ attach_volume = copy.deepcopy(servers270.attach_volume) show_volume_attachment = copy.deepcopy(servers270.show_volume_attachment) list_volume_attachments = copy.deepcopy(servers270.list_volume_attachments) show_instance_action = copy.deepcopy(servers270.show_instance_action) +create_backup = copy.deepcopy(servers270.create_backup) diff --git a/tempest/lib/api_schema/response/compute/v2_73/servers.py b/tempest/lib/api_schema/response/compute/v2_73/servers.py index e7a1d87d2a..89f100dcb8 100644 --- a/tempest/lib/api_schema/response/compute/v2_73/servers.py +++ b/tempest/lib/api_schema/response/compute/v2_73/servers.py @@ -80,3 +80,4 @@ attach_volume = copy.deepcopy(servers271.attach_volume) show_volume_attachment = copy.deepcopy(servers271.show_volume_attachment) list_volume_attachments = copy.deepcopy(servers271.list_volume_attachments) show_instance_action = copy.deepcopy(servers271.show_instance_action) +create_backup = copy.deepcopy(servers271.create_backup) diff --git a/tempest/lib/api_schema/response/compute/v2_79/servers.py b/tempest/lib/api_schema/response/compute/v2_79/servers.py index b5507f9a98..2e3a492b5b 100644 --- a/tempest/lib/api_schema/response/compute/v2_79/servers.py +++ b/tempest/lib/api_schema/response/compute/v2_79/servers.py @@ -66,3 +66,4 @@ check_tag_existence = copy.deepcopy(servers273.check_tag_existence) update_tag = copy.deepcopy(servers273.update_tag) delete_tag = copy.deepcopy(servers273.delete_tag) show_instance_action = copy.deepcopy(servers273.show_instance_action) +create_backup = copy.deepcopy(servers273.create_backup) diff --git a/tempest/lib/api_schema/response/compute/v2_8/servers.py b/tempest/lib/api_schema/response/compute/v2_8/servers.py index 119d8e2402..366fb1bc4c 100644 --- a/tempest/lib/api_schema/response/compute/v2_8/servers.py +++ b/tempest/lib/api_schema/response/compute/v2_8/servers.py @@ -39,3 +39,4 @@ attach_volume = copy.deepcopy(servers.attach_volume) show_volume_attachment = copy.deepcopy(servers.show_volume_attachment) list_volume_attachments = copy.deepcopy(servers.list_volume_attachments) show_instance_action = copy.deepcopy(servers.show_instance_action) +create_backup = copy.deepcopy(servers.create_backup) diff --git a/tempest/lib/api_schema/response/compute/v2_9/servers.py b/tempest/lib/api_schema/response/compute/v2_9/servers.py index 9258eec004..b4c786528e 100644 --- a/tempest/lib/api_schema/response/compute/v2_9/servers.py +++ b/tempest/lib/api_schema/response/compute/v2_9/servers.py @@ -58,3 +58,4 @@ attach_volume = copy.deepcopy(servers.attach_volume) show_volume_attachment = copy.deepcopy(servers.show_volume_attachment) list_volume_attachments = copy.deepcopy(servers.list_volume_attachments) show_instance_action = copy.deepcopy(servers.show_instance_action) +create_backup = copy.deepcopy(servers.create_backup) diff --git a/tempest/lib/services/compute/servers_client.py b/tempest/lib/services/compute/servers_client.py index ed3d4c0382..603fa8ab97 100644 --- a/tempest/lib/services/compute/servers_client.py +++ b/tempest/lib/services/compute/servers_client.py @@ -27,6 +27,7 @@ from tempest.lib.api_schema.response.compute.v2_16 import servers as schemav216 from tempest.lib.api_schema.response.compute.v2_19 import servers as schemav219 from tempest.lib.api_schema.response.compute.v2_26 import servers as schemav226 from tempest.lib.api_schema.response.compute.v2_3 import servers as schemav23 +from tempest.lib.api_schema.response.compute.v2_45 import servers as schemav245 from tempest.lib.api_schema.response.compute.v2_47 import servers as schemav247 from tempest.lib.api_schema.response.compute.v2_48 import servers as schemav248 from tempest.lib.api_schema.response.compute.v2_51 import servers as schemav251 @@ -57,7 +58,8 @@ class ServersClient(base_compute_client.BaseComputeClient): {'min': '2.9', 'max': '2.15', 'schema': schemav29}, {'min': '2.16', 'max': '2.18', 'schema': schemav216}, {'min': '2.19', 'max': '2.25', 'schema': schemav219}, - {'min': '2.26', 'max': '2.46', 'schema': schemav226}, + {'min': '2.26', 'max': '2.44', 'schema': schemav226}, + {'min': '2.45', 'max': '2.46', 'schema': schemav245}, {'min': '2.47', 'max': '2.47', 'schema': schemav247}, {'min': '2.48', 'max': '2.50', 'schema': schemav248}, {'min': '2.51', 'max': '2.53', 'schema': schemav251}, @@ -235,7 +237,9 @@ class ServersClient(base_compute_client.BaseComputeClient): API reference: https://docs.openstack.org/api-ref/compute/#create-server-back-up-createbackup-action """ - return self.action(server_id, "createBackup", **kwargs) + schema = self.get_schema(self.schema_versions_info) + return self.action(server_id, "createBackup", + schema.create_backup, **kwargs) def change_password(self, server_id, **kwargs): """Change the root password for the server.