Merge "Add support for compute API v2.70 - os-volume_attachments"

This commit is contained in:
Zuul 2019-05-28 13:59:39 +00:00 committed by Gerrit Code Review
commit 21ce12ed9f
16 changed files with 126 additions and 1 deletions

View File

@ -406,6 +406,10 @@ Microversion tests implemented in Tempest
.. _2.63: https://docs.openstack.org/nova/latest/reference/api-microversion-history.html#id57
* `2.70`_
.. _2.70: https://docs.openstack.org/nova/latest/reference/api-microversion-history.html#id63
* Volume
* `3.3`_

View File

@ -168,3 +168,6 @@ rebuild_server_with_admin_pass = copy.deepcopy(
servers.rebuild_server_with_admin_pass)
show_server_diagnostics = copy.deepcopy(servers.show_server_diagnostics)
get_remote_consoles = copy.deepcopy(servers.get_remote_consoles)
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)

View File

@ -58,3 +58,6 @@ rebuild_server_with_admin_pass['response_body']['properties']['server'][
list_servers = copy.deepcopy(serversv216.list_servers)
show_server_diagnostics = copy.deepcopy(serversv216.show_server_diagnostics)
get_remote_consoles = copy.deepcopy(serversv216.get_remote_consoles)
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)

View File

@ -101,3 +101,6 @@ delete_tag = {'status_code': [204]}
list_servers = copy.deepcopy(servers219.list_servers)
show_server_diagnostics = copy.deepcopy(servers219.show_server_diagnostics)
get_remote_consoles = copy.deepcopy(servers219.get_remote_consoles)
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)

View File

@ -173,3 +173,6 @@ rebuild_server = copy.deepcopy(servers.rebuild_server)
rebuild_server_with_admin_pass = copy.deepcopy(
servers.rebuild_server_with_admin_pass)
show_server_diagnostics = copy.deepcopy(servers.show_server_diagnostics)
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)

View File

@ -66,3 +66,6 @@ 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

@ -129,3 +129,6 @@ update_server = copy.deepcopy(servers247.update_server)
rebuild_server = copy.deepcopy(servers247.rebuild_server)
rebuild_server_with_admin_pass = copy.deepcopy(
servers247.rebuild_server_with_admin_pass)
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)

View File

@ -55,3 +55,6 @@ delete_all_tags = copy.deepcopy(servers248.delete_all_tags)
check_tag_existence = copy.deepcopy(servers248.check_tag_existence)
update_tag = copy.deepcopy(servers248.update_tag)
delete_tag = copy.deepcopy(servers248.delete_tag)
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)

View File

@ -59,3 +59,6 @@ delete_all_tags = copy.deepcopy(servers254.delete_all_tags)
check_tag_existence = copy.deepcopy(servers254.check_tag_existence)
update_tag = copy.deepcopy(servers254.update_tag)
delete_tag = copy.deepcopy(servers254.delete_tag)
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)

View File

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

View File

@ -73,3 +73,6 @@ delete_all_tags = copy.deepcopy(servers257.delete_all_tags)
check_tag_existence = copy.deepcopy(servers257.check_tag_existence)
update_tag = copy.deepcopy(servers257.update_tag)
delete_tag = copy.deepcopy(servers257.delete_tag)
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)

View File

@ -0,0 +1,80 @@
# 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_1 import servers as servers2_1
from tempest.lib.api_schema.response.compute.v2_63 import servers as servers263
###########################################################################
#
# 2.70:
#
# Exposes virtual device tags for volume attachments and virtual interfaces
# (ports). A tag parameter is added to the response body for the following
# APIs:
#
# Volumes
#
# - GET /servers/{server_id}/os-volume_attachments (list)
# - GET /servers/{server_id}/os-volume_attachments/{volume_id} (show)
# - POST /servers/{server_id}/os-volume_attachments (attach)
#
# Ports
#
# - GET /servers/{server_id}/os-interface (list)
# - GET /servers/{server_id}/os-interface/{port_id} (show)
# - POST /servers/{server_id}/os-interface (attach)
#
###########################################################################
attach_volume = copy.deepcopy(servers2_1.attach_volume)
attach_volume['response_body']['properties']['volumeAttachment'][
'properties'].update({'tag': {'type': ['string', 'null']}})
attach_volume['response_body']['properties']['volumeAttachment'][
'required'].append('tag')
show_volume_attachment = copy.deepcopy(servers2_1.show_volume_attachment)
show_volume_attachment['response_body']['properties']['volumeAttachment'][
'properties'].update({'tag': {'type': ['string', 'null']}})
show_volume_attachment['response_body']['properties'][
'volumeAttachment']['required'].append('tag')
list_volume_attachments = copy.deepcopy(servers2_1.list_volume_attachments)
list_volume_attachments['response_body']['properties']['volumeAttachments'][
'items']['properties'].update({'tag': {'type': ['string', 'null']}})
list_volume_attachments['response_body']['properties'][
'volumeAttachments']['items']['required'].append('tag')
# TODO(mriedem): Handle the os-interface changes when there is a test that
# needs them from this microversion onward.
# NOTE(lajoskatona): 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.63 ***
list_servers_detail = copy.deepcopy(servers263.list_servers_detail)
rebuild_server = copy.deepcopy(servers263.rebuild_server)
rebuild_server_with_admin_pass = copy.deepcopy(
servers263.rebuild_server_with_admin_pass)
update_server = copy.deepcopy(servers263.update_server)
get_server = copy.deepcopy(servers263.get_server)
list_servers = copy.deepcopy(servers263.list_servers)
show_server_diagnostics = copy.deepcopy(servers263.show_server_diagnostics)
get_remote_consoles = copy.deepcopy(servers263.get_remote_consoles)
list_tags = copy.deepcopy(servers263.list_tags)
update_all_tags = copy.deepcopy(servers263.update_all_tags)
delete_all_tags = copy.deepcopy(servers263.delete_all_tags)
check_tag_existence = copy.deepcopy(servers263.check_tag_existence)
update_tag = copy.deepcopy(servers263.update_tag)
delete_tag = copy.deepcopy(servers263.delete_tag)

View File

@ -35,3 +35,6 @@ rebuild_server = copy.deepcopy(servers.rebuild_server)
rebuild_server_with_admin_pass = copy.deepcopy(
servers.rebuild_server_with_admin_pass)
show_server_diagnostics = copy.deepcopy(servers.show_server_diagnostics)
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)

View File

@ -54,3 +54,6 @@ rebuild_server_with_admin_pass['response_body']['properties']['server'][
list_servers = copy.deepcopy(servers.list_servers)
show_server_diagnostics = copy.deepcopy(servers.show_server_diagnostics)
get_remote_consoles = copy.deepcopy(servers.get_remote_consoles)
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)

View File

@ -33,6 +33,7 @@ from tempest.lib.api_schema.response.compute.v2_54 import servers as schemav254
from tempest.lib.api_schema.response.compute.v2_57 import servers as schemav257
from tempest.lib.api_schema.response.compute.v2_6 import servers as schemav26
from tempest.lib.api_schema.response.compute.v2_63 import servers as schemav263
from tempest.lib.api_schema.response.compute.v2_70 import servers as schemav270
from tempest.lib.api_schema.response.compute.v2_8 import servers as schemav28
from tempest.lib.api_schema.response.compute.v2_9 import servers as schemav29
from tempest.lib.common import rest_client
@ -55,7 +56,8 @@ class ServersClient(base_compute_client.BaseComputeClient):
{'min': '2.48', 'max': '2.53', 'schema': schemav248},
{'min': '2.54', 'max': '2.56', 'schema': schemav254},
{'min': '2.57', 'max': '2.62', 'schema': schemav257},
{'min': '2.63', 'max': None, 'schema': schemav263}]
{'min': '2.63', 'max': '2.69', 'schema': schemav263},
{'min': '2.70', 'max': None, 'schema': schemav270}]
def __init__(self, auth_provider, service, region,
enable_instance_password=True, **kwargs):
@ -426,6 +428,7 @@ class ServersClient(base_compute_client.BaseComputeClient):
resp, body = self.post('servers/%s/os-volume_attachments' % server_id,
post_body)
body = json.loads(body)
schema = self.get_schema(self.schema_versions_info)
self.validate_response(schema.attach_volume, resp, body)
return rest_client.ResponseBody(resp, body)
@ -460,6 +463,7 @@ class ServersClient(base_compute_client.BaseComputeClient):
resp, body = self.get('servers/%s/os-volume_attachments/%s' % (
server_id, volume_id))
body = json.loads(body)
schema = self.get_schema(self.schema_versions_info)
self.validate_response(schema.show_volume_attachment, resp, body)
return rest_client.ResponseBody(resp, body)
@ -473,6 +477,7 @@ class ServersClient(base_compute_client.BaseComputeClient):
resp, body = self.get('servers/%s/os-volume_attachments' % (
server_id))
body = json.loads(body)
schema = self.get_schema(self.schema_versions_info)
self.validate_response(schema.list_volume_attachments, resp, body)
return rest_client.ResponseBody(resp, body)