Microversion 2.89 - os-volume_attachments

Depends-On: https://review.opendev.org/c/openstack/nova/+/804275
Change-Id: If6275dbd3795047c111ac507a12b034e60029df8
This commit is contained in:
Lee Yarwood 2021-08-17 12:06:25 +01:00
parent bff8d41370
commit cfa172c4fd
4 changed files with 35 additions and 1 deletions

View File

@ -25,4 +25,4 @@ API_MIN_VERSION = api_versions.APIVersion("2.1")
# when client supported the max version, and bumped sequentially, otherwise
# the client may break due to server side new version may include some
# backward incompatible change.
API_MAX_VERSION = api_versions.APIVersion("2.88")
API_MAX_VERSION = api_versions.APIVersion("2.89")

View File

@ -3994,6 +3994,24 @@ class ShellTest(utils.TestCase):
self.assert_called('GET', '/servers/1234/os-volume_attachments')
self.assertIn('DELETE ON TERMINATION', out)
def test_volume_attachments_pre_v2_89(self):
out = self.run_command(
'volume-attachments 1234', api_version='2.88')[0]
self.assert_called('GET', '/servers/1234/os-volume_attachments')
# We can't assert just ID here as it's part of various other fields
self.assertIn('| ID', out)
self.assertNotIn('ATTACHMENT ID', out)
self.assertNotIn('BDM UUID', out)
def test_volume_attachments_v2_89(self):
out = self.run_command(
'volume-attachments 1234', api_version='2.89')[0]
self.assert_called('GET', '/servers/1234/os-volume_attachments')
# We can't assert just ID here as it's part of various other fields
self.assertNotIn('| ID', out)
self.assertIn('ATTACHMENT ID', out)
self.assertIn('BDM UUID', out)
def test_volume_attach_with_delete_on_termination_pre_v2_79(self):
self.assertRaises(
SystemExit, self.run_command,
@ -4577,6 +4595,7 @@ class ShellTest(utils.TestCase):
84, # There are no version-wrapped shell method changes for this.
86, # doesn't require any changes in novaclient.
87, # doesn't require any changes in novaclient.
89, # There are no version-wrapped shell method changes for this.
])
versions_supported = set(range(0,
novaclient.API_MAX_VERSION.ver_minor + 1))

View File

@ -2800,6 +2800,10 @@ def do_volume_attachments(cs, args):
_translate_volume_attachments_keys(volumes)
# Microversion >= 2.70 returns the tag value.
fields = ['ID', 'DEVICE', 'SERVER ID', 'VOLUME ID']
if cs.api_version >= api_versions.APIVersion('2.89'):
fields.remove('ID')
fields.append('ATTACHMENT ID')
fields.append('BDM UUID')
if cs.api_version >= api_versions.APIVersion('2.70'):
fields.append('TAG')
# Microversion >= 2.79 returns the delete_on_termination value.

View File

@ -0,0 +1,11 @@
---
features:
- |
Added support for `microversion 2.89`_. This microversion removes the
``id`` field while adding the ``attachment_id`` and ``bdm_uuid`` fields to
the responses of ``GET /servers/{server_id}/os-volume_attachments`` and
``GET /servers/{server_id}/os-volume_attachments/{volume_id}`` with these
changes reflected in novaclient under the ``nova volume-attachments``
command.
.. _microversion 2.89: https://docs.openstack.org/nova/latest/reference/api-microversion-history.html#microversion-2-89