From cfa172c4fd75cae1c6cbed31def48f28eafbb89b Mon Sep 17 00:00:00 2001 From: Lee Yarwood Date: Tue, 17 Aug 2021 12:06:25 +0100 Subject: Microversion 2.89 - os-volume_attachments Depends-On: https://review.opendev.org/c/openstack/nova/+/804275 Change-Id: If6275dbd3795047c111ac507a12b034e60029df8 --- novaclient/__init__.py | 2 +- novaclient/tests/unit/v2/test_shell.py | 19 +++++++++++++++++++ novaclient/v2/shell.py | 4 ++++ 3 files changed, 24 insertions(+), 1 deletion(-) (limited to 'novaclient') 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. -- cgit v1.2.1