diff options
author | Lee Yarwood <lyarwood@redhat.com> | 2021-08-17 12:06:25 +0100 |
---|---|---|
committer | Lee Yarwood <lyarwood@redhat.com> | 2021-08-24 19:10:41 +0100 |
commit | cfa172c4fd75cae1c6cbed31def48f28eafbb89b (patch) | |
tree | 414b816526ef4d10a866da2220defdf2de5e25f9 | |
parent | bff8d4137057c9bc37436b8df29d86a3c2584938 (diff) | |
download | python-novaclient-cfa172c4fd75cae1c6cbed31def48f28eafbb89b.tar.gz |
Microversion 2.89 - os-volume_attachments
Depends-On: https://review.opendev.org/c/openstack/nova/+/804275
Change-Id: If6275dbd3795047c111ac507a12b034e60029df8
-rw-r--r-- | novaclient/__init__.py | 2 | ||||
-rw-r--r-- | novaclient/tests/unit/v2/test_shell.py | 19 | ||||
-rw-r--r-- | novaclient/v2/shell.py | 4 | ||||
-rw-r--r-- | releasenotes/notes/microversion_v2_89-af6223273b2bdfb0.yaml | 11 |
4 files changed, 35 insertions, 1 deletions
diff --git a/novaclient/__init__.py b/novaclient/__init__.py index 50ad89d8..5f3b6953 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 17c8974d..10e8c732 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 eb0315fd..e47fcbc0 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 00000000..39682f59 --- /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 |