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
This commit is contained in:
Yikun Jiang 2018-04-27 12:15:09 +08:00
parent f4d927c358
commit 5483be7fe7
4 changed files with 41 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.61")
API_MAX_VERSION = api_versions.APIVersion("2.62")

View File

@ -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)

View File

@ -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))

View File

@ -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.