diff --git a/novaclient/__init__.py b/novaclient/__init__.py index 50ad89d84..5f3b69530 100644 --- a/novaclient/__init__.py +++ b/novaclient/__init__.py @@ -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") diff --git a/novaclient/tests/unit/v2/test_shell.py b/novaclient/tests/unit/v2/test_shell.py index 17c8974d3..10e8c732e 100644 --- a/novaclient/tests/unit/v2/test_shell.py +++ b/novaclient/tests/unit/v2/test_shell.py @@ -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)) diff --git a/novaclient/v2/shell.py b/novaclient/v2/shell.py index eb0315fd0..e47fcbc01 100644 --- a/novaclient/v2/shell.py +++ b/novaclient/v2/shell.py @@ -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. diff --git a/releasenotes/notes/microversion_v2_89-af6223273b2bdfb0.yaml b/releasenotes/notes/microversion_v2_89-af6223273b2bdfb0.yaml new file mode 100644 index 000000000..39682f59b --- /dev/null +++ b/releasenotes/notes/microversion_v2_89-af6223273b2bdfb0.yaml @@ -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