Add support changes-before for microversion 2.66
This adds the changes-before filter to the servers, os-instance-actions and os-migrations list for filtering resources which were last updated before or equal to the given time. The changes-before filter, like the changes-since filter, will return deleted server resources. Depends-On: https://review.openstack.org/599276/ Part of bp support-to-query-nova-resources-filter-by-changes-before Change-Id: I7c6ea00303374d605bda8ef1b62c5de1b4567696
This commit is contained in:
parent
9d8eda8b82
commit
4464a88737
@ -1923,6 +1923,7 @@ nova instance-action-list
|
|||||||
|
|
||||||
usage: nova instance-action-list [--marker <marker>] [--limit <limit>]
|
usage: nova instance-action-list [--marker <marker>] [--limit <limit>]
|
||||||
[--changes-since <changes_since>]
|
[--changes-since <changes_since>]
|
||||||
|
[--changes-before <changes_before>]
|
||||||
<server>
|
<server>
|
||||||
|
|
||||||
List actions on a server.
|
List actions on a server.
|
||||||
@ -1947,10 +1948,15 @@ List actions on a server.
|
|||||||
in the server. (Supported by API versions '2.58' - '2.latest')
|
in the server. (Supported by API versions '2.58' - '2.latest')
|
||||||
|
|
||||||
``--changes-since <changes_since>``
|
``--changes-since <changes_since>``
|
||||||
List only instance actions changed after a certain point of time.
|
List only instance actions changed later or equal to a certain
|
||||||
The provided time should be an ISO 8061 formatted time.
|
point of time. The provided time should be an ISO 8061 formatted time.
|
||||||
e.g. 2016-03-04T06:27:59Z. (Supported by API versions '2.58' - '2.latest')
|
e.g. 2016-03-04T06:27:59Z. (Supported by API versions '2.58' - '2.latest')
|
||||||
|
|
||||||
|
``--changes-before <changes_before>``
|
||||||
|
List only instance actions changed earlier or equal to a certain
|
||||||
|
point of time. The provided time should be an ISO 8061 formatted time.
|
||||||
|
e.g. 2016-03-04T06:27:59Z. (Supported by API versions '2.66' - '2.latest')
|
||||||
|
|
||||||
.. _nova_interface-attach:
|
.. _nova_interface-attach:
|
||||||
|
|
||||||
nova interface-attach
|
nova interface-attach
|
||||||
@ -2154,6 +2160,7 @@ nova list
|
|||||||
[--user [<user>]] [--deleted] [--fields <fields>] [--minimal]
|
[--user [<user>]] [--deleted] [--fields <fields>] [--minimal]
|
||||||
[--sort <key>[:<direction>]] [--marker <marker>]
|
[--sort <key>[:<direction>]] [--marker <marker>]
|
||||||
[--limit <limit>] [--changes-since <changes_since>]
|
[--limit <limit>] [--changes-since <changes_since>]
|
||||||
|
[--changes-before <changes_before>]
|
||||||
[--tags <tags>] [--tags-any <tags-any>]
|
[--tags <tags>] [--tags-any <tags-any>]
|
||||||
[--not-tags <not-tags>] [--not-tags-any <not-tags-any>]
|
[--not-tags <not-tags>] [--not-tags-any <not-tags-any>]
|
||||||
|
|
||||||
@ -2233,11 +2240,18 @@ List servers.
|
|||||||
used instead.
|
used instead.
|
||||||
|
|
||||||
``--changes-since <changes_since>``
|
``--changes-since <changes_since>``
|
||||||
List only servers changed after a certain
|
List only servers changed later or equal to a
|
||||||
point of time.The provided time should be an
|
certain point of time. The provided time should
|
||||||
ISO 8061 formatted time.ex
|
be an ISO 8061 formatted time. e.g.
|
||||||
2016-03-04T06:27:59Z .
|
2016-03-04T06:27:59Z .
|
||||||
|
|
||||||
|
``--changes-before <changes_before>``
|
||||||
|
List only servers changed earlier or equal to a
|
||||||
|
certain point of time. The provided time should
|
||||||
|
be an ISO 8061 formatted time. e.g.
|
||||||
|
2016-03-05T06:27:59Z . (Supported by API versions
|
||||||
|
'2.66' - '2.latest')
|
||||||
|
|
||||||
``--tags <tags>``
|
``--tags <tags>``
|
||||||
The given tags must all be present for a
|
The given tags must all be present for a
|
||||||
server to be included in the list result.
|
server to be included in the list result.
|
||||||
@ -2443,6 +2457,7 @@ nova migration-list
|
|||||||
usage: nova migration-list [--instance-uuid <instance_uuid>] [--host <host>]
|
usage: nova migration-list [--instance-uuid <instance_uuid>] [--host <host>]
|
||||||
[--status <status>] [--marker <marker>]
|
[--status <status>] [--marker <marker>]
|
||||||
[--limit <limit>] [--changes-since <changes_since>]
|
[--limit <limit>] [--changes-since <changes_since>]
|
||||||
|
[--changes-before <changes_before>]
|
||||||
|
|
||||||
Print a list of migrations.
|
Print a list of migrations.
|
||||||
|
|
||||||
@ -2469,10 +2484,15 @@ Print a list of migrations.
|
|||||||
(Supported by API versions '2.59' - '2.latest')
|
(Supported by API versions '2.59' - '2.latest')
|
||||||
|
|
||||||
``--changes-since <changes_since>``
|
``--changes-since <changes_since>``
|
||||||
List only migrations changed after a certain point of time.
|
List only migrations changed later or equal to a certain
|
||||||
The provided time should be an ISO 8061 formatted time.
|
point of time. The provided time should be an ISO 8061 formatted time.
|
||||||
e.g. 2016-03-04T06:27:59Z . (Supported by API versions '2.59' - '2.latest')
|
e.g. 2016-03-04T06:27:59Z . (Supported by API versions '2.59' - '2.latest')
|
||||||
|
|
||||||
|
``--changes-before <changes_before>``
|
||||||
|
List only migrations changed earlier or equal to a certain
|
||||||
|
point of time. The provided time should be an ISO 8061 formatted time.
|
||||||
|
e.g. 2016-03-04T06:27:59Z . (Supported by API versions '2.66' - '2.latest')
|
||||||
|
|
||||||
.. _nova_pause:
|
.. _nova_pause:
|
||||||
|
|
||||||
nova pause
|
nova pause
|
||||||
|
@ -25,4 +25,4 @@ API_MIN_VERSION = api_versions.APIVersion("2.1")
|
|||||||
# when client supported the max version, and bumped sequentially, otherwise
|
# when client supported the max version, and bumped sequentially, otherwise
|
||||||
# the client may break due to server side new version may include some
|
# the client may break due to server side new version may include some
|
||||||
# backward incompatible change.
|
# backward incompatible change.
|
||||||
API_MAX_VERSION = api_versions.APIVersion("2.65")
|
API_MAX_VERSION = api_versions.APIVersion("2.66")
|
||||||
|
@ -151,3 +151,39 @@ class TestInstanceActionCLIV262(TestInstanceActionCLIV258,
|
|||||||
output = self.nova("instance-action %s %s" % (server_id, request_id))
|
output = self.nova("instance-action %s %s" % (server_id, request_id))
|
||||||
self.assertIn("'host'", output)
|
self.assertIn("'host'", output)
|
||||||
self.assertIn("'hostId'", output)
|
self.assertIn("'hostId'", output)
|
||||||
|
|
||||||
|
|
||||||
|
class TestInstanceActionCLIV266(TestInstanceActionCLIV258,
|
||||||
|
base.TenantTestBase):
|
||||||
|
"""Instance action functional tests for v2.66 nova-api microversion."""
|
||||||
|
|
||||||
|
COMPUTE_API_VERSION = "2.66"
|
||||||
|
expect_event_hostId_field = True
|
||||||
|
|
||||||
|
def test_list_instance_action_with_changes_before(self):
|
||||||
|
# Ignore microseconds to make this a deterministic test.
|
||||||
|
server = self._create_server()
|
||||||
|
end_create = timeutils.utcnow().replace(microsecond=0).isoformat()
|
||||||
|
time.sleep(2)
|
||||||
|
server.stop()
|
||||||
|
end_stop = timeutils.utcnow().replace(microsecond=0).isoformat()
|
||||||
|
|
||||||
|
stop_output = self.nova(
|
||||||
|
"instance-action-list %s --changes-before %s" %
|
||||||
|
(server.id, end_stop))
|
||||||
|
action = self._get_list_of_values_from_single_column_table(
|
||||||
|
stop_output, "Action")
|
||||||
|
# The actions are sorted by created_at in descending order.
|
||||||
|
self.assertEqual(action, ['create', 'stop'])
|
||||||
|
|
||||||
|
create_output = self.nova(
|
||||||
|
"instance-action-list %s --changes-before %s" %
|
||||||
|
(server.id, end_create))
|
||||||
|
action = self._get_list_of_values_from_single_column_table(
|
||||||
|
create_output, "Action")
|
||||||
|
# Provide detailed debug information if this fails.
|
||||||
|
self.assertEqual(action, ['create'],
|
||||||
|
'Expected to find the create action with '
|
||||||
|
'--changes-before=%s but got: %s\n\n'
|
||||||
|
'First instance-action-list output: %s' %
|
||||||
|
(end_create, create_output, stop_output))
|
||||||
|
@ -61,3 +61,23 @@ class InstanceActionExtensionV258Tests(InstanceActionExtensionTests):
|
|||||||
'marker=%s' % (server_uuid, '2016-02-29T06%3A23%3A22', marker))
|
'marker=%s' % (server_uuid, '2016-02-29T06%3A23%3A22', marker))
|
||||||
for ia in ias:
|
for ia in ias:
|
||||||
self.assertIsInstance(ia, instance_action.InstanceAction)
|
self.assertIsInstance(ia, instance_action.InstanceAction)
|
||||||
|
|
||||||
|
|
||||||
|
class InstanceActionExtensionV266Tests(InstanceActionExtensionV258Tests):
|
||||||
|
def setUp(self):
|
||||||
|
super(InstanceActionExtensionV266Tests, self).setUp()
|
||||||
|
self.cs.api_version = api_versions.APIVersion("2.66")
|
||||||
|
|
||||||
|
def test_list_instance_actions_with_changes_before(self):
|
||||||
|
server_uuid = '1234'
|
||||||
|
|
||||||
|
ias = self.cs.instance_action.list(
|
||||||
|
server_uuid, marker=None, limit=None, changes_since=None,
|
||||||
|
changes_before='2016-02-29T06:23:22')
|
||||||
|
self.assert_request_id(ias, fakes.FAKE_REQUEST_ID_LIST)
|
||||||
|
self.cs.assert_called(
|
||||||
|
'GET',
|
||||||
|
'/servers/%s/os-instance-actions?changes-before=%s' %
|
||||||
|
(server_uuid, '2016-02-29T06%3A23%3A22'))
|
||||||
|
for ia in ias:
|
||||||
|
self.assertIsInstance(ia, instance_action.InstanceAction)
|
||||||
|
@ -95,3 +95,20 @@ class MigrationsV259Test(MigrationsV223Test):
|
|||||||
% ('2012-02-29T06%3A23%3A22', marker))
|
% ('2012-02-29T06%3A23%3A22', marker))
|
||||||
for m in ms:
|
for m in ms:
|
||||||
self.assertIsInstance(m, migrations.Migration)
|
self.assertIsInstance(m, migrations.Migration)
|
||||||
|
|
||||||
|
|
||||||
|
class MigrationsV266Test(MigrationsV259Test):
|
||||||
|
def setUp(self):
|
||||||
|
super(MigrationsV266Test, self).setUp()
|
||||||
|
self.cs.api_version = api_versions.APIVersion("2.66")
|
||||||
|
|
||||||
|
def test_list_migrations_with_changes_before(self):
|
||||||
|
params = {'changes_before': '2012-02-29T06:23:22'}
|
||||||
|
ms = self.cs.migrations.list(**params)
|
||||||
|
self.assert_request_id(ms, fakes.FAKE_REQUEST_ID_LIST)
|
||||||
|
self.cs.assert_called('GET',
|
||||||
|
'/os-migrations?'
|
||||||
|
'changes-before=%s' %
|
||||||
|
'2012-02-29T06%3A23%3A22')
|
||||||
|
for m in ms:
|
||||||
|
self.assertIsInstance(m, migrations.Migration)
|
||||||
|
@ -1597,6 +1597,23 @@ class ShellTest(utils.TestCase):
|
|||||||
self.assertRaises(exceptions.CommandError,
|
self.assertRaises(exceptions.CommandError,
|
||||||
self.run_command, 'list --changes-since 0123456789')
|
self.run_command, 'list --changes-since 0123456789')
|
||||||
|
|
||||||
|
def test_list_with_changes_before(self):
|
||||||
|
self.run_command('list --changes-before 2016-02-29T06:23:22',
|
||||||
|
api_version='2.66')
|
||||||
|
self.assert_called(
|
||||||
|
'GET', '/servers/detail?changes-before=2016-02-29T06%3A23%3A22')
|
||||||
|
|
||||||
|
def test_list_with_changes_before_invalid_value(self):
|
||||||
|
ex = self.assertRaises(exceptions.CommandError, self.run_command,
|
||||||
|
'list --changes-before 0123456789',
|
||||||
|
api_version='2.66')
|
||||||
|
self.assertIn('Invalid changes-before value', six.text_type(ex))
|
||||||
|
|
||||||
|
def test_list_with_changes_before_pre_v266_not_allowed(self):
|
||||||
|
self.assertRaises(SystemExit, self.run_command,
|
||||||
|
'list --changes-before 2016-02-29T06:23:22',
|
||||||
|
api_version='2.65')
|
||||||
|
|
||||||
def test_list_fields_redundant(self):
|
def test_list_fields_redundant(self):
|
||||||
output, _err = self.run_command('list --fields id,status,status')
|
output, _err = self.run_command('list --fields id,status,status')
|
||||||
header = output.splitlines()[1]
|
header = output.splitlines()[1]
|
||||||
@ -3487,6 +3504,28 @@ class ShellTest(utils.TestCase):
|
|||||||
api_version='2.58')
|
api_version='2.58')
|
||||||
self.assertIn('Invalid changes-since value', six.text_type(ex))
|
self.assertIn('Invalid changes-since value', six.text_type(ex))
|
||||||
|
|
||||||
|
def test_instance_action_list_changes_before_pre_v266_not_allowed(self):
|
||||||
|
cmd = 'instance-action-list sample-server --changes-before ' \
|
||||||
|
'2016-02-29T06:23:22'
|
||||||
|
self.assertRaises(SystemExit, self.run_command,
|
||||||
|
cmd, api_version='2.65')
|
||||||
|
|
||||||
|
def test_instance_action_list_with_changes_before_v266(self):
|
||||||
|
self.run_command('instance-action-list sample-server '
|
||||||
|
'--changes-before 2016-02-29T06:23:22',
|
||||||
|
api_version='2.66')
|
||||||
|
self.assert_called(
|
||||||
|
'GET',
|
||||||
|
'/servers/1234/os-instance-actions?'
|
||||||
|
'changes-before=2016-02-29T06%3A23%3A22')
|
||||||
|
|
||||||
|
def test_instance_action_list_with_changes_before_invalid_value_v266(self):
|
||||||
|
ex = self.assertRaises(
|
||||||
|
exceptions.CommandError, self.run_command,
|
||||||
|
'instance-action-list sample-server --changes-before 0123456789',
|
||||||
|
api_version='2.66')
|
||||||
|
self.assertIn('Invalid changes-before value', six.text_type(ex))
|
||||||
|
|
||||||
def test_instance_usage_audit_log(self):
|
def test_instance_usage_audit_log(self):
|
||||||
self.run_command('instance-usage-audit-log')
|
self.run_command('instance-usage-audit-log')
|
||||||
self.assert_called('GET', '/os-instance_usage_audit_log')
|
self.assert_called('GET', '/os-instance_usage_audit_log')
|
||||||
@ -3564,6 +3603,23 @@ class ShellTest(utils.TestCase):
|
|||||||
api_version='2.59')
|
api_version='2.59')
|
||||||
self.assertIn('Invalid changes-since value', six.text_type(ex))
|
self.assertIn('Invalid changes-since value', six.text_type(ex))
|
||||||
|
|
||||||
|
def test_migration_list_with_changes_before_v266(self):
|
||||||
|
self.run_command('migration-list --changes-before 2016-02-29T06:23:22',
|
||||||
|
api_version='2.66')
|
||||||
|
self.assert_called(
|
||||||
|
'GET', '/os-migrations?changes-before=2016-02-29T06%3A23%3A22')
|
||||||
|
|
||||||
|
def test_migration_list_with_changes_before_invalid_value_v266(self):
|
||||||
|
ex = self.assertRaises(exceptions.CommandError, self.run_command,
|
||||||
|
'migration-list --changes-before 0123456789',
|
||||||
|
api_version='2.66')
|
||||||
|
self.assertIn('Invalid changes-before value', six.text_type(ex))
|
||||||
|
|
||||||
|
def test_migration_list_with_changes_before_pre_v266_not_allowed(self):
|
||||||
|
cmd = 'migration-list --changes-before 2016-02-29T06:23:22'
|
||||||
|
self.assertRaises(SystemExit, self.run_command, cmd,
|
||||||
|
api_version='2.65')
|
||||||
|
|
||||||
@mock.patch('novaclient.v2.shell._find_server')
|
@mock.patch('novaclient.v2.shell._find_server')
|
||||||
@mock.patch('os.system')
|
@mock.patch('os.system')
|
||||||
def test_ssh(self, mock_system, mock_find_server):
|
def test_ssh(self, mock_system, mock_find_server):
|
||||||
|
@ -43,7 +43,7 @@ class InstanceActionManager(base.ManagerWithFind):
|
|||||||
return self._list('/servers/%s/os-instance-actions' %
|
return self._list('/servers/%s/os-instance-actions' %
|
||||||
base.getid(server), 'instanceActions')
|
base.getid(server), 'instanceActions')
|
||||||
|
|
||||||
@api_versions.wraps("2.58")
|
@api_versions.wraps("2.58", "2.65")
|
||||||
def list(self, server, marker=None, limit=None, changes_since=None):
|
def list(self, server, marker=None, limit=None, changes_since=None):
|
||||||
"""
|
"""
|
||||||
Get a list of actions performed on a server.
|
Get a list of actions performed on a server.
|
||||||
@ -53,10 +53,10 @@ class InstanceActionManager(base.ManagerWithFind):
|
|||||||
list than that represented by this action request id
|
list than that represented by this action request id
|
||||||
(optional).
|
(optional).
|
||||||
:param limit: Maximum number of actions to return. (optional).
|
:param limit: Maximum number of actions to return. (optional).
|
||||||
:param changes_since: List only instance actions changed after a
|
:param changes_since: List only instance actions changed later or
|
||||||
certain point of time. The provided time should
|
equal to a certain point of time. The provided
|
||||||
be an ISO 8061 formatted time. ex
|
time should be an ISO 8061 formatted time.
|
||||||
2016-03-04T06:27:59Z . (optional).
|
e.g. 2016-03-04T06:27:59Z . (optional).
|
||||||
"""
|
"""
|
||||||
opts = {}
|
opts = {}
|
||||||
if marker:
|
if marker:
|
||||||
@ -67,3 +67,35 @@ class InstanceActionManager(base.ManagerWithFind):
|
|||||||
opts['changes-since'] = changes_since
|
opts['changes-since'] = changes_since
|
||||||
return self._list('/servers/%s/os-instance-actions' %
|
return self._list('/servers/%s/os-instance-actions' %
|
||||||
base.getid(server), 'instanceActions', filters=opts)
|
base.getid(server), 'instanceActions', filters=opts)
|
||||||
|
|
||||||
|
@api_versions.wraps("2.66")
|
||||||
|
def list(self, server, marker=None, limit=None, changes_since=None,
|
||||||
|
changes_before=None):
|
||||||
|
"""
|
||||||
|
Get a list of actions performed on a server.
|
||||||
|
|
||||||
|
:param server: The :class:`Server` (or its ID)
|
||||||
|
:param marker: Begin returning actions that appear later in the action
|
||||||
|
list than that represented by this action request id
|
||||||
|
(optional).
|
||||||
|
:param limit: Maximum number of actions to return. (optional).
|
||||||
|
:param changes_since: List only instance actions changed later or
|
||||||
|
equal to a certain point of time. The provided
|
||||||
|
time should be an ISO 8061 formatted time.
|
||||||
|
e.g. 2016-03-04T06:27:59Z . (optional).
|
||||||
|
:param changes_before: List only instance actions changed earlier or
|
||||||
|
equal to a certain point of time. The provided
|
||||||
|
time should be an ISO 8061 formatted time.
|
||||||
|
e.g. 2016-03-05T06:27:59Z . (optional).
|
||||||
|
"""
|
||||||
|
opts = {}
|
||||||
|
if marker:
|
||||||
|
opts['marker'] = marker
|
||||||
|
if limit:
|
||||||
|
opts['limit'] = limit
|
||||||
|
if changes_since:
|
||||||
|
opts['changes-since'] = changes_since
|
||||||
|
if changes_before:
|
||||||
|
opts['changes-before'] = changes_before
|
||||||
|
return self._list('/servers/%s/os-instance-actions' %
|
||||||
|
base.getid(server), 'instanceActions', filters=opts)
|
||||||
|
@ -27,7 +27,8 @@ class MigrationManager(base.ManagerWithFind):
|
|||||||
resource_class = Migration
|
resource_class = Migration
|
||||||
|
|
||||||
def _list_base(self, host=None, status=None, instance_uuid=None,
|
def _list_base(self, host=None, status=None, instance_uuid=None,
|
||||||
marker=None, limit=None, changes_since=None):
|
marker=None, limit=None, changes_since=None,
|
||||||
|
changes_before=None):
|
||||||
opts = {}
|
opts = {}
|
||||||
if host:
|
if host:
|
||||||
opts['host'] = host
|
opts['host'] = host
|
||||||
@ -41,6 +42,8 @@ class MigrationManager(base.ManagerWithFind):
|
|||||||
opts['limit'] = limit
|
opts['limit'] = limit
|
||||||
if changes_since:
|
if changes_since:
|
||||||
opts['changes-since'] = changes_since
|
opts['changes-since'] = changes_since
|
||||||
|
if changes_before:
|
||||||
|
opts['changes-before'] = changes_before
|
||||||
|
|
||||||
return self._list("/os-migrations", "migrations", filters=opts)
|
return self._list("/os-migrations", "migrations", filters=opts)
|
||||||
|
|
||||||
@ -55,7 +58,7 @@ class MigrationManager(base.ManagerWithFind):
|
|||||||
return self._list_base(host=host, status=status,
|
return self._list_base(host=host, status=status,
|
||||||
instance_uuid=instance_uuid)
|
instance_uuid=instance_uuid)
|
||||||
|
|
||||||
@api_versions.wraps("2.59")
|
@api_versions.wraps("2.59", "2.65")
|
||||||
def list(self, host=None, status=None, instance_uuid=None,
|
def list(self, host=None, status=None, instance_uuid=None,
|
||||||
marker=None, limit=None, changes_since=None):
|
marker=None, limit=None, changes_since=None):
|
||||||
"""
|
"""
|
||||||
@ -67,11 +70,37 @@ class MigrationManager(base.ManagerWithFind):
|
|||||||
migrations list than that represented by this migration UUID
|
migrations list than that represented by this migration UUID
|
||||||
(optional).
|
(optional).
|
||||||
:param limit: maximum number of migrations to return (optional).
|
:param limit: maximum number of migrations to return (optional).
|
||||||
:param changes_since: only return migrations updated after. The
|
:param changes_since: only return migrations changed later or equal
|
||||||
provided time should be an ISO 8061 formatted time. ex
|
to a certain point of time. The provided time should be an ISO 8061
|
||||||
2016-03-04T06:27:59Z . (optional).
|
formatted time. e.g. 2016-03-04T06:27:59Z . (optional).
|
||||||
"""
|
"""
|
||||||
return self._list_base(host=host, status=status,
|
return self._list_base(host=host, status=status,
|
||||||
instance_uuid=instance_uuid,
|
instance_uuid=instance_uuid,
|
||||||
marker=marker, limit=limit,
|
marker=marker, limit=limit,
|
||||||
changes_since=changes_since)
|
changes_since=changes_since)
|
||||||
|
|
||||||
|
@api_versions.wraps("2.66")
|
||||||
|
def list(self, host=None, status=None, instance_uuid=None,
|
||||||
|
marker=None, limit=None, changes_since=None,
|
||||||
|
changes_before=None):
|
||||||
|
"""
|
||||||
|
Get a list of migrations.
|
||||||
|
:param host: filter migrations by host name (optional).
|
||||||
|
:param status: filter migrations by status (optional).
|
||||||
|
:param instance_uuid: filter migrations by instance uuid (optional).
|
||||||
|
:param marker: Begin returning migrations that appear later in the
|
||||||
|
migrations list than that represented by this migration UUID
|
||||||
|
(optional).
|
||||||
|
:param limit: maximum number of migrations to return (optional).
|
||||||
|
:param changes_since: Only return migrations changed later or equal
|
||||||
|
to a certain point of time. The provided time should be an ISO 8061
|
||||||
|
formatted time. e.g. 2016-03-04T06:27:59Z . (optional).
|
||||||
|
:param changes_before: Only return migrations changed earlier or
|
||||||
|
equal to a certain point of time. The provided time should be an ISO
|
||||||
|
8061 formatted time. e.g. 2016-03-05T06:27:59Z . (optional).
|
||||||
|
"""
|
||||||
|
return self._list_base(host=host, status=status,
|
||||||
|
instance_uuid=instance_uuid,
|
||||||
|
marker=marker, limit=limit,
|
||||||
|
changes_since=changes_since,
|
||||||
|
changes_before=changes_before)
|
||||||
|
@ -1475,9 +1475,18 @@ def _print_flavor(flavor):
|
|||||||
dest='changes_since',
|
dest='changes_since',
|
||||||
metavar='<changes_since>',
|
metavar='<changes_since>',
|
||||||
default=None,
|
default=None,
|
||||||
help=_("List only servers changed after a certain point of time. "
|
help=_("List only servers changed later or equal to a certain point of "
|
||||||
"The provided time should be an ISO 8061 formatted time. "
|
"time. The provided time should be an ISO 8061 formatted time. "
|
||||||
"ex 2016-03-04T06:27:59Z ."))
|
"e.g. 2016-03-04T06:27:59Z ."))
|
||||||
|
@utils.arg(
|
||||||
|
'--changes-before',
|
||||||
|
dest='changes_before',
|
||||||
|
metavar='<changes_before>',
|
||||||
|
default=None,
|
||||||
|
help=_("List only servers changed earlier or equal to a certain point of "
|
||||||
|
"time. The provided time should be an ISO 8061 formatted time. "
|
||||||
|
"e.g. 2016-03-04T06:27:59Z ."),
|
||||||
|
start_version="2.66")
|
||||||
@utils.arg(
|
@utils.arg(
|
||||||
'--tags',
|
'--tags',
|
||||||
dest='tags',
|
dest='tags',
|
||||||
@ -1582,6 +1591,18 @@ def do_list(cs, args):
|
|||||||
raise exceptions.CommandError(_('Invalid changes-since value: %s')
|
raise exceptions.CommandError(_('Invalid changes-since value: %s')
|
||||||
% search_opts['changes-since'])
|
% search_opts['changes-since'])
|
||||||
|
|
||||||
|
# In microversion 2.66 we added ``changes-before`` option
|
||||||
|
# in server details.
|
||||||
|
have_added_changes_before = (
|
||||||
|
cs.api_version >= api_versions.APIVersion('2.66'))
|
||||||
|
if have_added_changes_before and args.changes_before:
|
||||||
|
search_opts['changes-before'] = args.changes_before
|
||||||
|
try:
|
||||||
|
timeutils.parse_isotime(search_opts['changes-before'])
|
||||||
|
except ValueError:
|
||||||
|
raise exceptions.CommandError(_('Invalid changes-before value: %s')
|
||||||
|
% search_opts['changes-before'])
|
||||||
|
|
||||||
servers = cs.servers.list(detailed=detailed,
|
servers = cs.servers.list(detailed=detailed,
|
||||||
search_opts=search_opts,
|
search_opts=search_opts,
|
||||||
sort_keys=sort_keys,
|
sort_keys=sort_keys,
|
||||||
@ -1629,7 +1650,7 @@ def do_list(cs, args):
|
|||||||
# Tenant ID as well
|
# Tenant ID as well
|
||||||
if search_opts['all_tenants']:
|
if search_opts['all_tenants']:
|
||||||
columns.insert(2, 'Tenant ID')
|
columns.insert(2, 'Tenant ID')
|
||||||
if search_opts['changes-since']:
|
if search_opts['changes-since'] or search_opts.get('changes-before'):
|
||||||
columns.append('Updated')
|
columns.append('Updated')
|
||||||
formatters['Networks'] = utils.format_servers_list_networks
|
formatters['Networks'] = utils.format_servers_list_networks
|
||||||
sortby_index = 1
|
sortby_index = 1
|
||||||
@ -5023,7 +5044,7 @@ def do_instance_action_list(cs, args):
|
|||||||
sortby_index=3)
|
sortby_index=3)
|
||||||
|
|
||||||
|
|
||||||
@api_versions.wraps("2.58")
|
@api_versions.wraps("2.58", "2.65")
|
||||||
@utils.arg(
|
@utils.arg(
|
||||||
'server',
|
'server',
|
||||||
metavar='<server>',
|
metavar='<server>',
|
||||||
@ -5051,9 +5072,9 @@ def do_instance_action_list(cs, args):
|
|||||||
dest='changes_since',
|
dest='changes_since',
|
||||||
metavar='<changes_since>',
|
metavar='<changes_since>',
|
||||||
default=None,
|
default=None,
|
||||||
help=_('List only instance actions changed after a certain point of '
|
help=_('List only instance actions changed later or equal to a certain '
|
||||||
'time. The provided time should be an ISO 8061 formatted time. '
|
'point of time. The provided time should be an ISO 8061 formatted '
|
||||||
'e.g. 2016-03-04T06:27:59Z.'))
|
'time. e.g. 2016-03-04T06:27:59Z.'))
|
||||||
def do_instance_action_list(cs, args):
|
def do_instance_action_list(cs, args):
|
||||||
"""List actions on a server."""
|
"""List actions on a server."""
|
||||||
server = _find_server(cs, args.server, raise_if_notfound=False)
|
server = _find_server(cs, args.server, raise_if_notfound=False)
|
||||||
@ -5073,6 +5094,75 @@ def do_instance_action_list(cs, args):
|
|||||||
sortby_index=3)
|
sortby_index=3)
|
||||||
|
|
||||||
|
|
||||||
|
@api_versions.wraps("2.66")
|
||||||
|
@utils.arg(
|
||||||
|
'server',
|
||||||
|
metavar='<server>',
|
||||||
|
help=_('Name or UUID of the server to list actions for. Only UUID can be '
|
||||||
|
'used to list actions on a deleted server.'))
|
||||||
|
@utils.arg(
|
||||||
|
'--marker',
|
||||||
|
dest='marker',
|
||||||
|
metavar='<marker>',
|
||||||
|
default=None,
|
||||||
|
help=_('The last instance action of the previous page; displays list of '
|
||||||
|
'actions after "marker".'))
|
||||||
|
@utils.arg(
|
||||||
|
'--limit',
|
||||||
|
dest='limit',
|
||||||
|
metavar='<limit>',
|
||||||
|
type=int,
|
||||||
|
default=None,
|
||||||
|
help=_('Maximum number of instance actions to display. Note that there '
|
||||||
|
'is a configurable max limit on the server, and the limit that is '
|
||||||
|
'used will be the minimum of what is requested here and what '
|
||||||
|
'is configured in the server.'))
|
||||||
|
@utils.arg(
|
||||||
|
'--changes-since',
|
||||||
|
dest='changes_since',
|
||||||
|
metavar='<changes_since>',
|
||||||
|
default=None,
|
||||||
|
help=_('List only instance actions changed later or equal to a certain '
|
||||||
|
'point of time. The provided time should be an ISO 8061 formatted '
|
||||||
|
'time. e.g. 2016-03-04T06:27:59Z.'))
|
||||||
|
@utils.arg(
|
||||||
|
'--changes-before',
|
||||||
|
dest='changes_before',
|
||||||
|
metavar='<changes_before>',
|
||||||
|
default=None,
|
||||||
|
help=_('List only instance actions changed earlier or equal to a certain '
|
||||||
|
'point of time. The provided time should be an ISO 8061 formatted '
|
||||||
|
'time. e.g. 2016-03-04T06:27:59Z.'),
|
||||||
|
start_version="2.66")
|
||||||
|
def do_instance_action_list(cs, args):
|
||||||
|
"""List actions on a server."""
|
||||||
|
server = _find_server(cs, args.server, raise_if_notfound=False)
|
||||||
|
if args.changes_since:
|
||||||
|
try:
|
||||||
|
timeutils.parse_isotime(args.changes_since)
|
||||||
|
except ValueError:
|
||||||
|
raise exceptions.CommandError(_('Invalid changes-since value: %s')
|
||||||
|
% args.changes_since)
|
||||||
|
|
||||||
|
# In microversion 2.66 we added ``changes-before`` option
|
||||||
|
# in instance actions.
|
||||||
|
if args.changes_before:
|
||||||
|
try:
|
||||||
|
timeutils.parse_isotime(args.changes_before)
|
||||||
|
except ValueError:
|
||||||
|
raise exceptions.CommandError(_('Invalid changes-before value: %s')
|
||||||
|
% args.changes_before)
|
||||||
|
|
||||||
|
actions = cs.instance_action.list(server, marker=args.marker,
|
||||||
|
limit=args.limit,
|
||||||
|
changes_since=args.changes_since,
|
||||||
|
changes_before=args.changes_before)
|
||||||
|
utils.print_list(actions,
|
||||||
|
['Action', 'Request_ID', 'Message', 'Start_Time',
|
||||||
|
'Updated_At'],
|
||||||
|
sortby_index=3)
|
||||||
|
|
||||||
|
|
||||||
def do_list_extensions(cs, _args):
|
def do_list_extensions(cs, _args):
|
||||||
"""
|
"""
|
||||||
List all the os-api extensions that are available.
|
List all the os-api extensions that are available.
|
||||||
@ -5165,7 +5255,7 @@ def do_migration_list(cs, args):
|
|||||||
_print_migrations(cs, migrations)
|
_print_migrations(cs, migrations)
|
||||||
|
|
||||||
|
|
||||||
@api_versions.wraps("2.59")
|
@api_versions.wraps("2.59", "2.65")
|
||||||
@utils.arg(
|
@utils.arg(
|
||||||
'--instance-uuid',
|
'--instance-uuid',
|
||||||
dest='instance_uuid',
|
dest='instance_uuid',
|
||||||
@ -5204,8 +5294,8 @@ def do_migration_list(cs, args):
|
|||||||
dest='changes_since',
|
dest='changes_since',
|
||||||
metavar='<changes_since>',
|
metavar='<changes_since>',
|
||||||
default=None,
|
default=None,
|
||||||
help=_('List only migrations changed after a certain point of time. '
|
help=_('List only migrations changed later or equal to a certain point '
|
||||||
'The provided time should be an ISO 8061 formatted time. '
|
'of time. The provided time should be an ISO 8061 formatted time. '
|
||||||
'e.g. 2016-03-04T06:27:59Z .'))
|
'e.g. 2016-03-04T06:27:59Z .'))
|
||||||
def do_migration_list(cs, args):
|
def do_migration_list(cs, args):
|
||||||
"""Print a list of migrations."""
|
"""Print a list of migrations."""
|
||||||
@ -5224,6 +5314,81 @@ def do_migration_list(cs, args):
|
|||||||
_print_migrations(cs, migrations)
|
_print_migrations(cs, migrations)
|
||||||
|
|
||||||
|
|
||||||
|
@api_versions.wraps("2.66")
|
||||||
|
@utils.arg(
|
||||||
|
'--instance-uuid',
|
||||||
|
dest='instance_uuid',
|
||||||
|
metavar='<instance_uuid>',
|
||||||
|
help=_('Fetch migrations for the given instance.'))
|
||||||
|
@utils.arg(
|
||||||
|
'--host',
|
||||||
|
dest='host',
|
||||||
|
metavar='<host>',
|
||||||
|
help=_('Fetch migrations for the given host.'))
|
||||||
|
@utils.arg(
|
||||||
|
'--status',
|
||||||
|
dest='status',
|
||||||
|
metavar='<status>',
|
||||||
|
help=_('Fetch migrations for the given status.'))
|
||||||
|
@utils.arg(
|
||||||
|
'--marker',
|
||||||
|
dest='marker',
|
||||||
|
metavar='<marker>',
|
||||||
|
default=None,
|
||||||
|
help=_('The last migration of the previous page; displays list of '
|
||||||
|
'migrations after "marker". Note that the marker is the '
|
||||||
|
'migration UUID.'))
|
||||||
|
@utils.arg(
|
||||||
|
'--limit',
|
||||||
|
dest='limit',
|
||||||
|
metavar='<limit>',
|
||||||
|
type=int,
|
||||||
|
default=None,
|
||||||
|
help=_('Maximum number of migrations to display. Note that there is a '
|
||||||
|
'configurable max limit on the server, and the limit that is used '
|
||||||
|
'will be the minimum of what is requested here and what '
|
||||||
|
'is configured in the server.'))
|
||||||
|
@utils.arg(
|
||||||
|
'--changes-since',
|
||||||
|
dest='changes_since',
|
||||||
|
metavar='<changes_since>',
|
||||||
|
default=None,
|
||||||
|
help=_('List only migrations changed later or equal to a certain point '
|
||||||
|
'of time. The provided time should be an ISO 8061 formatted time. '
|
||||||
|
'e.g. 2016-03-04T06:27:59Z .'))
|
||||||
|
@utils.arg(
|
||||||
|
'--changes-before',
|
||||||
|
dest='changes_before',
|
||||||
|
metavar='<changes_before>',
|
||||||
|
default=None,
|
||||||
|
help=_('List only migrations changed earlier or equal to a certain point '
|
||||||
|
'of time. The provided time should be an ISO 8061 formatted time. '
|
||||||
|
'e.g. 2016-03-04T06:27:59Z .'),
|
||||||
|
start_version="2.66")
|
||||||
|
def do_migration_list(cs, args):
|
||||||
|
"""Print a list of migrations."""
|
||||||
|
if args.changes_since:
|
||||||
|
try:
|
||||||
|
timeutils.parse_isotime(args.changes_since)
|
||||||
|
except ValueError:
|
||||||
|
raise exceptions.CommandError(_('Invalid changes-since value: %s')
|
||||||
|
% args.changes_since)
|
||||||
|
|
||||||
|
if args.changes_before:
|
||||||
|
try:
|
||||||
|
timeutils.parse_isotime(args.changes_before)
|
||||||
|
except ValueError:
|
||||||
|
raise exceptions.CommandError(_('Invalid changes-before value: %s')
|
||||||
|
% args.changes_before)
|
||||||
|
|
||||||
|
migrations = cs.migrations.list(args.host, args.status,
|
||||||
|
instance_uuid=args.instance_uuid,
|
||||||
|
marker=args.marker, limit=args.limit,
|
||||||
|
changes_since=args.changes_since,
|
||||||
|
changes_before=args.changes_before)
|
||||||
|
_print_migrations(cs, migrations)
|
||||||
|
|
||||||
|
|
||||||
@utils.arg(
|
@utils.arg(
|
||||||
'--before',
|
'--before',
|
||||||
dest='before',
|
dest='before',
|
||||||
|
14
releasenotes/notes/microversion-v2_66-cda5d6dc31b56b46.yaml
Normal file
14
releasenotes/notes/microversion-v2_66-cda5d6dc31b56b46.yaml
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
---
|
||||||
|
features:
|
||||||
|
- |
|
||||||
|
Added support for `microversion 2.66`_ which adds ``changes-before``
|
||||||
|
parameter to the servers, os-instance-actions or os-migrations APIs.
|
||||||
|
|
||||||
|
* This parameter (``changes-before``) does not change any read-deleted
|
||||||
|
behavior in the os-instance-actions or os-migrations APIs.
|
||||||
|
* Like the ``changes-since`` filter, the ``changes-before`` filter will
|
||||||
|
also return deleted servers.
|
||||||
|
* The ``--changes-before`` options is added to the ``nova list``,
|
||||||
|
``nova instance-action-list`` and ``nova migration-list`` CLIs.
|
||||||
|
|
||||||
|
.. _microversion 2.66: https://docs.openstack.org/nova/latest/reference/api-microversion-history.html#id59
|
Loading…
Reference in New Issue
Block a user