Merge "Add schema for compute 2.45 microversion"

This commit is contained in:
Zuul 2022-03-09 06:23:32 +00:00 committed by Gerrit Code Review
commit 5a7cc775a3
24 changed files with 125 additions and 19 deletions

View File

@ -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.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`_
.. _2.47: https://docs.openstack.org/nova/latest/reference/api-microversion-history.html#id43 .. _2.47: https://docs.openstack.org/nova/latest/reference/api-microversion-history.html#id43

View File

@ -792,3 +792,28 @@ class ServerActionsTestJSON(base.BaseV2ComputeTest):
self.assertEqual('novnc', body['type']) self.assertEqual('novnc', body['type'])
self.assertNotEqual('', body['url']) self.assertNotEqual('', body['url'])
self._validate_url(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)

View File

@ -506,6 +506,10 @@ set_show_server_metadata_item = {
} }
} }
create_backup = {
'status_code': [202]
}
server_actions_common_schema = { server_actions_common_schema = {
'status_code': [202] 'status_code': [202]
} }

View File

@ -172,3 +172,4 @@ attach_volume = copy.deepcopy(servers.attach_volume)
show_volume_attachment = copy.deepcopy(servers.show_volume_attachment) show_volume_attachment = copy.deepcopy(servers.show_volume_attachment)
list_volume_attachments = copy.deepcopy(servers.list_volume_attachments) list_volume_attachments = copy.deepcopy(servers.list_volume_attachments)
show_instance_action = copy.deepcopy(servers.show_instance_action) show_instance_action = copy.deepcopy(servers.show_instance_action)
create_backup = copy.deepcopy(servers.create_backup)

View File

@ -62,3 +62,4 @@ attach_volume = copy.deepcopy(serversv216.attach_volume)
show_volume_attachment = copy.deepcopy(serversv216.show_volume_attachment) show_volume_attachment = copy.deepcopy(serversv216.show_volume_attachment)
list_volume_attachments = copy.deepcopy(serversv216.list_volume_attachments) list_volume_attachments = copy.deepcopy(serversv216.list_volume_attachments)
show_instance_action = copy.deepcopy(serversv216.show_instance_action) show_instance_action = copy.deepcopy(serversv216.show_instance_action)
create_backup = copy.deepcopy(serversv216.create_backup)

View File

@ -105,3 +105,4 @@ attach_volume = copy.deepcopy(servers219.attach_volume)
show_volume_attachment = copy.deepcopy(servers219.show_volume_attachment) show_volume_attachment = copy.deepcopy(servers219.show_volume_attachment)
list_volume_attachments = copy.deepcopy(servers219.list_volume_attachments) list_volume_attachments = copy.deepcopy(servers219.list_volume_attachments)
show_instance_action = copy.deepcopy(servers219.show_instance_action) show_instance_action = copy.deepcopy(servers219.show_instance_action)
create_backup = copy.deepcopy(servers219.create_backup)

View File

@ -177,3 +177,4 @@ attach_volume = copy.deepcopy(servers.attach_volume)
show_volume_attachment = copy.deepcopy(servers.show_volume_attachment) show_volume_attachment = copy.deepcopy(servers.show_volume_attachment)
list_volume_attachments = copy.deepcopy(servers.list_volume_attachments) list_volume_attachments = copy.deepcopy(servers.list_volume_attachments)
show_instance_action = copy.deepcopy(servers.show_instance_action) show_instance_action = copy.deepcopy(servers.show_instance_action)
create_backup = copy.deepcopy(servers.create_backup)

View File

@ -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)

View File

@ -13,6 +13,7 @@
import copy import copy
from tempest.lib.api_schema.response.compute.v2_26 import servers as servers226 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 = { flavor = {
'type': 'object', 'type': 'object',
@ -34,39 +35,40 @@ flavor = {
'required': ['original_name', 'disk', 'ephemeral', 'ram', 'swap', 'vcpus'] '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'][ get_server['response_body']['properties']['server'][
'properties'].update({'flavor': flavor}) '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'][ list_servers_detail['response_body']['properties']['servers']['items'][
'properties'].update({'flavor': flavor}) 'properties'].update({'flavor': flavor})
update_server = copy.deepcopy(servers226.update_server) update_server = copy.deepcopy(servers245.update_server)
update_server['response_body']['properties']['server'][ update_server['response_body']['properties']['server'][
'properties'].update({'flavor': flavor}) 'properties'].update({'flavor': flavor})
rebuild_server = copy.deepcopy(servers226.rebuild_server) rebuild_server = copy.deepcopy(servers245.rebuild_server)
rebuild_server['response_body']['properties']['server'][ rebuild_server['response_body']['properties']['server'][
'properties'].update({'flavor': flavor}) 'properties'].update({'flavor': flavor})
rebuild_server_with_admin_pass = copy.deepcopy( 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'][ rebuild_server_with_admin_pass['response_body']['properties']['server'][
'properties'].update({'flavor': flavor}) 'properties'].update({'flavor': flavor})
# NOTE(zhufl): Below are the unchanged schema in this microversion. We need # 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 # 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. # right schema based on self.schema_versions_info mapping in service client.
show_server_diagnostics = copy.deepcopy(servers226.show_server_diagnostics) show_server_diagnostics = copy.deepcopy(servers245.show_server_diagnostics)
get_remote_consoles = copy.deepcopy(servers226.get_remote_consoles) get_remote_consoles = copy.deepcopy(servers245.get_remote_consoles)
list_tags = copy.deepcopy(servers226.list_tags) list_tags = copy.deepcopy(servers245.list_tags)
update_all_tags = copy.deepcopy(servers226.update_all_tags) update_all_tags = copy.deepcopy(servers245.update_all_tags)
delete_all_tags = copy.deepcopy(servers226.delete_all_tags) delete_all_tags = copy.deepcopy(servers245.delete_all_tags)
check_tag_existence = copy.deepcopy(servers226.check_tag_existence) check_tag_existence = copy.deepcopy(servers245.check_tag_existence)
update_tag = copy.deepcopy(servers226.update_tag) update_tag = copy.deepcopy(servers245.update_tag)
delete_tag = copy.deepcopy(servers226.delete_tag) delete_tag = copy.deepcopy(servers245.delete_tag)
list_servers = copy.deepcopy(servers226.list_servers) list_servers = copy.deepcopy(servers245.list_servers)
attach_volume = copy.deepcopy(servers226.attach_volume) attach_volume = copy.deepcopy(servers245.attach_volume)
show_volume_attachment = copy.deepcopy(servers226.show_volume_attachment) show_volume_attachment = copy.deepcopy(servers245.show_volume_attachment)
list_volume_attachments = copy.deepcopy(servers226.list_volume_attachments) list_volume_attachments = copy.deepcopy(servers245.list_volume_attachments)
show_instance_action = copy.deepcopy(servers226.show_instance_action) show_instance_action = copy.deepcopy(servers226.show_instance_action)
create_backup = copy.deepcopy(servers245.create_backup)

View File

@ -133,3 +133,4 @@ attach_volume = copy.deepcopy(servers247.attach_volume)
show_volume_attachment = copy.deepcopy(servers247.show_volume_attachment) show_volume_attachment = copy.deepcopy(servers247.show_volume_attachment)
list_volume_attachments = copy.deepcopy(servers247.list_volume_attachments) list_volume_attachments = copy.deepcopy(servers247.list_volume_attachments)
show_instance_action = copy.deepcopy(servers247.show_instance_action) show_instance_action = copy.deepcopy(servers247.show_instance_action)
create_backup = copy.deepcopy(servers247.create_backup)

View File

@ -40,3 +40,4 @@ rebuild_server_with_admin_pass = copy.deepcopy(
attach_volume = copy.deepcopy(servers248.attach_volume) attach_volume = copy.deepcopy(servers248.attach_volume)
show_volume_attachment = copy.deepcopy(servers248.show_volume_attachment) show_volume_attachment = copy.deepcopy(servers248.show_volume_attachment)
list_volume_attachments = copy.deepcopy(servers248.list_volume_attachments) list_volume_attachments = copy.deepcopy(servers248.list_volume_attachments)
create_backup = copy.deepcopy(servers248.create_backup)

View File

@ -59,3 +59,4 @@ attach_volume = copy.deepcopy(servers251.attach_volume)
show_volume_attachment = copy.deepcopy(servers251.show_volume_attachment) show_volume_attachment = copy.deepcopy(servers251.show_volume_attachment)
list_volume_attachments = copy.deepcopy(servers251.list_volume_attachments) list_volume_attachments = copy.deepcopy(servers251.list_volume_attachments)
show_instance_action = copy.deepcopy(servers251.show_instance_action) show_instance_action = copy.deepcopy(servers251.show_instance_action)
create_backup = copy.deepcopy(servers251.create_backup)

View File

@ -63,3 +63,4 @@ attach_volume = copy.deepcopy(servers254.attach_volume)
show_volume_attachment = copy.deepcopy(servers254.show_volume_attachment) show_volume_attachment = copy.deepcopy(servers254.show_volume_attachment)
list_volume_attachments = copy.deepcopy(servers254.list_volume_attachments) list_volume_attachments = copy.deepcopy(servers254.list_volume_attachments)
show_instance_action = copy.deepcopy(servers254.show_instance_action) show_instance_action = copy.deepcopy(servers254.show_instance_action)
create_backup = copy.deepcopy(servers254.create_backup)

View File

@ -42,3 +42,4 @@ rebuild_server_with_admin_pass = copy.deepcopy(
attach_volume = copy.deepcopy(servers257.attach_volume) attach_volume = copy.deepcopy(servers257.attach_volume)
show_volume_attachment = copy.deepcopy(servers257.show_volume_attachment) show_volume_attachment = copy.deepcopy(servers257.show_volume_attachment)
list_volume_attachments = copy.deepcopy(servers257.list_volume_attachments) list_volume_attachments = copy.deepcopy(servers257.list_volume_attachments)
create_backup = copy.deepcopy(servers257.create_backup)

View File

@ -32,6 +32,7 @@ attach_volume = copy.deepcopy(servers.attach_volume)
show_volume_attachment = copy.deepcopy(servers.show_volume_attachment) show_volume_attachment = copy.deepcopy(servers.show_volume_attachment)
list_volume_attachments = copy.deepcopy(servers.list_volume_attachments) list_volume_attachments = copy.deepcopy(servers.list_volume_attachments)
show_instance_action = copy.deepcopy(servers.show_instance_action) 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 # NOTE: The consolidated remote console API got introduced with v2.6
# with bp/consolidate-console-api. See Nova commit 578bafeda # with bp/consolidate-console-api. See Nova commit 578bafeda

View File

@ -45,3 +45,4 @@ rebuild_server_with_admin_pass = copy.deepcopy(
attach_volume = copy.deepcopy(servers258.attach_volume) attach_volume = copy.deepcopy(servers258.attach_volume)
show_volume_attachment = copy.deepcopy(servers258.show_volume_attachment) show_volume_attachment = copy.deepcopy(servers258.show_volume_attachment)
list_volume_attachments = copy.deepcopy(servers258.list_volume_attachments) list_volume_attachments = copy.deepcopy(servers258.list_volume_attachments)
create_backup = copy.deepcopy(servers258.create_backup)

View File

@ -77,3 +77,4 @@ attach_volume = copy.deepcopy(servers262.attach_volume)
show_volume_attachment = copy.deepcopy(servers262.show_volume_attachment) show_volume_attachment = copy.deepcopy(servers262.show_volume_attachment)
list_volume_attachments = copy.deepcopy(servers262.list_volume_attachments) list_volume_attachments = copy.deepcopy(servers262.list_volume_attachments)
show_instance_action = copy.deepcopy(servers262.show_instance_action) show_instance_action = copy.deepcopy(servers262.show_instance_action)
create_backup = copy.deepcopy(servers262.create_backup)

View File

@ -79,3 +79,4 @@ check_tag_existence = copy.deepcopy(servers263.check_tag_existence)
update_tag = copy.deepcopy(servers263.update_tag) update_tag = copy.deepcopy(servers263.update_tag)
delete_tag = copy.deepcopy(servers263.delete_tag) delete_tag = copy.deepcopy(servers263.delete_tag)
show_instance_action = copy.deepcopy(servers263.show_instance_action) show_instance_action = copy.deepcopy(servers263.show_instance_action)
create_backup = copy.deepcopy(servers263.create_backup)

View File

@ -83,3 +83,4 @@ attach_volume = copy.deepcopy(servers270.attach_volume)
show_volume_attachment = copy.deepcopy(servers270.show_volume_attachment) show_volume_attachment = copy.deepcopy(servers270.show_volume_attachment)
list_volume_attachments = copy.deepcopy(servers270.list_volume_attachments) list_volume_attachments = copy.deepcopy(servers270.list_volume_attachments)
show_instance_action = copy.deepcopy(servers270.show_instance_action) show_instance_action = copy.deepcopy(servers270.show_instance_action)
create_backup = copy.deepcopy(servers270.create_backup)

View File

@ -80,3 +80,4 @@ attach_volume = copy.deepcopy(servers271.attach_volume)
show_volume_attachment = copy.deepcopy(servers271.show_volume_attachment) show_volume_attachment = copy.deepcopy(servers271.show_volume_attachment)
list_volume_attachments = copy.deepcopy(servers271.list_volume_attachments) list_volume_attachments = copy.deepcopy(servers271.list_volume_attachments)
show_instance_action = copy.deepcopy(servers271.show_instance_action) show_instance_action = copy.deepcopy(servers271.show_instance_action)
create_backup = copy.deepcopy(servers271.create_backup)

View File

@ -66,3 +66,4 @@ check_tag_existence = copy.deepcopy(servers273.check_tag_existence)
update_tag = copy.deepcopy(servers273.update_tag) update_tag = copy.deepcopy(servers273.update_tag)
delete_tag = copy.deepcopy(servers273.delete_tag) delete_tag = copy.deepcopy(servers273.delete_tag)
show_instance_action = copy.deepcopy(servers273.show_instance_action) show_instance_action = copy.deepcopy(servers273.show_instance_action)
create_backup = copy.deepcopy(servers273.create_backup)

View File

@ -39,3 +39,4 @@ attach_volume = copy.deepcopy(servers.attach_volume)
show_volume_attachment = copy.deepcopy(servers.show_volume_attachment) show_volume_attachment = copy.deepcopy(servers.show_volume_attachment)
list_volume_attachments = copy.deepcopy(servers.list_volume_attachments) list_volume_attachments = copy.deepcopy(servers.list_volume_attachments)
show_instance_action = copy.deepcopy(servers.show_instance_action) show_instance_action = copy.deepcopy(servers.show_instance_action)
create_backup = copy.deepcopy(servers.create_backup)

View File

@ -58,3 +58,4 @@ attach_volume = copy.deepcopy(servers.attach_volume)
show_volume_attachment = copy.deepcopy(servers.show_volume_attachment) show_volume_attachment = copy.deepcopy(servers.show_volume_attachment)
list_volume_attachments = copy.deepcopy(servers.list_volume_attachments) list_volume_attachments = copy.deepcopy(servers.list_volume_attachments)
show_instance_action = copy.deepcopy(servers.show_instance_action) show_instance_action = copy.deepcopy(servers.show_instance_action)
create_backup = copy.deepcopy(servers.create_backup)

View File

@ -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_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_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_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_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_48 import servers as schemav248
from tempest.lib.api_schema.response.compute.v2_51 import servers as schemav251 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.9', 'max': '2.15', 'schema': schemav29},
{'min': '2.16', 'max': '2.18', 'schema': schemav216}, {'min': '2.16', 'max': '2.18', 'schema': schemav216},
{'min': '2.19', 'max': '2.25', 'schema': schemav219}, {'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.47', 'max': '2.47', 'schema': schemav247},
{'min': '2.48', 'max': '2.50', 'schema': schemav248}, {'min': '2.48', 'max': '2.50', 'schema': schemav248},
{'min': '2.51', 'max': '2.53', 'schema': schemav251}, {'min': '2.51', 'max': '2.53', 'schema': schemav251},
@ -235,7 +237,9 @@ class ServersClient(base_compute_client.BaseComputeClient):
API reference: API reference:
https://docs.openstack.org/api-ref/compute/#create-server-back-up-createbackup-action 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): def change_password(self, server_id, **kwargs):
"""Change the root password for the server. """Change the root password for the server.