summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYikun Jiang <yikunkero@gmail.com>2018-04-27 12:15:09 +0800
committerYikun Jiang <yikunkero@gmail.com>2018-04-27 15:37:39 +0800
commit5483be7fe74a90e3a38428cfb436864ffeee4c54 (patch)
tree404fc9fb0dca81e972ac8301479603845cc41be4
parentf4d927c358e22e899396004590f381278fde10ba (diff)
downloadpython-novaclient-5483be7fe74a90e3a38428cfb436864ffeee4c54.tar.gz
Microversion 2.62 - Add host/hostId to instance action event
Adds support for microversion 2.62 which adds ``host`` (hostname) and ``hostId`` (an obfuscated hashed host id string) fields to the instance action ``GET /servers/{server_id}/os-instance-actions/{req_id}`` API. The event column is already included in the result of "nova instance-action <server> <request-id>" command, therefore does not have any CLI or python API binding impacts in the client. Related nova API change: I2f8b4a12a088b9ed96b428eafde2e0c478fb1db5 Part of blueprint: add-host-to-instance-action-events Change-Id: Iee7e1a3a22249c98873aa96694fd4885916cd097
-rw-r--r--novaclient/__init__.py2
-rw-r--r--novaclient/tests/functional/v2/test_instance_action.py28
-rw-r--r--novaclient/tests/unit/v2/test_shell.py1
-rw-r--r--releasenotes/notes/microversion-v2_62-479a23f0d4307500.yaml11
4 files changed, 41 insertions, 1 deletions
diff --git a/novaclient/__init__.py b/novaclient/__init__.py
index 6795d882..1530b37a 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.61")
+API_MAX_VERSION = api_versions.APIVersion("2.62")
diff --git a/novaclient/tests/functional/v2/test_instance_action.py b/novaclient/tests/functional/v2/test_instance_action.py
index a318b6e7..93e8486e 100644
--- a/novaclient/tests/functional/v2/test_instance_action.py
+++ b/novaclient/tests/functional/v2/test_instance_action.py
@@ -113,3 +113,31 @@ class TestInstanceActionCLIV258(TestInstanceActionCLI):
'--changes-since=%s but got: %s\n\n'
'First instance-action-list output: %s' %
(before_stop, stop_output, create_output))
+
+
+class TestInstanceActionCLIV262(TestInstanceActionCLIV258,
+ base.TenantTestBase):
+ """Instance action functional tests for v2.62 nova-api microversion."""
+
+ COMPUTE_API_VERSION = "2.62"
+
+ def test_show_actions_with_host(self):
+ name = self.name_generate()
+ # Create server with non-admin user
+ server = self.another_nova('boot --flavor %s --image %s --poll %s' %
+ (self.flavor.name, self.image.name, name))
+ server_id = self._get_value_from_the_table(server, 'id')
+ output = self.nova("instance-action-list %s" % server_id)
+ request_id = self._get_column_value_from_single_row_table(
+ output, "Request_ID")
+
+ # Only the 'hostId' are exposed to non-admin
+ output = self.another_nova(
+ "instance-action %s %s" % (server_id, request_id))
+ self.assertNotIn("'host'", output)
+ self.assertIn("'hostId'", output)
+
+ # The 'host' and 'hostId' are exposed to admin
+ output = self.nova("instance-action %s %s" % (server_id, request_id))
+ self.assertIn("'host'", output)
+ self.assertIn("'hostId'", output)
diff --git a/novaclient/tests/unit/v2/test_shell.py b/novaclient/tests/unit/v2/test_shell.py
index 99706341..66300c89 100644
--- a/novaclient/tests/unit/v2/test_shell.py
+++ b/novaclient/tests/unit/v2/test_shell.py
@@ -3634,6 +3634,7 @@ class ShellTest(utils.TestCase):
57, # There are no version-wrapped shell method changes for this.
60, # There are no client-side changes for volume multiattach.
61, # There are no version-wrapped shell method changes for this.
+ 62, # 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/releasenotes/notes/microversion-v2_62-479a23f0d4307500.yaml b/releasenotes/notes/microversion-v2_62-479a23f0d4307500.yaml
new file mode 100644
index 00000000..ed2948b2
--- /dev/null
+++ b/releasenotes/notes/microversion-v2_62-479a23f0d4307500.yaml
@@ -0,0 +1,11 @@
+---
+features:
+ - |
+ Adds support for microversion 2.62 which adds ``host`` (hostname)
+ and ``hostId`` (an obfuscated hashed host id string) fields to the
+ instance action ``GET /servers/{server_id}/os-instance-actions/{req_id}``
+ API.
+
+ The event columns are already included in the result of
+ "nova instance-action <server> <request-id>" command, therefore does not
+ have any CLI or python API binding impacts in the client.