summaryrefslogtreecommitdiff
path: root/openstackclient/compute
diff options
context:
space:
mode:
authorStephen Finucane <sfinucan@redhat.com>2020-11-09 14:53:57 +0000
committerStephen Finucane <sfinucan@redhat.com>2020-11-09 15:05:54 +0000
commit1a5dd4af5bf7fdc1b903b300b917f302ba75a1bc (patch)
treea7e92acc3725d69d72584c502539bf4c0624c376 /openstackclient/compute
parentcb6659d7cd28f9c9c6481c9222ff6d3a5308410a (diff)
downloadpython-openstackclient-1a5dd4af5bf7fdc1b903b300b917f302ba75a1bc.tar.gz
Resolve issues with 'server migration list'
The 'os-migrations' API accepts 'instance_uuid' and 'migration_type' query string parameters, not 'server' and 'type'. For the former, as the name would suggest, the value should be a server UUID, not a name. In addition, this is a list command and therefore should subclass the 'Lister' base class. Change-Id: I736f5575156fc04d7ada7783a1865ab3b438396f Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
Diffstat (limited to 'openstackclient/compute')
-rw-r--r--openstackclient/compute/v2/server.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/openstackclient/compute/v2/server.py b/openstackclient/compute/v2/server.py
index fddafaee..e897ab1a 100644
--- a/openstackclient/compute/v2/server.py
+++ b/openstackclient/compute/v2/server.py
@@ -2041,7 +2041,7 @@ revert to release the new server and restart the old one.""")
raise SystemExit
-class ListMigration(command.Command):
+class ListMigration(command.Lister):
_description = _("""List server migrations""")
def get_parser(self, prog_name):
@@ -2168,16 +2168,21 @@ class ListMigration(command.Command):
search_opts = {
'host': parsed_args.host,
- 'server': parsed_args.server,
'status': parsed_args.status,
}
+ if parsed_args.server:
+ search_opts['instance_uuid'] = utils.find_resource(
+ compute_client.servers,
+ parsed_args.server,
+ ).id
+
if parsed_args.type:
migration_type = parsed_args.type
# we're using an alias because the default value is confusing
if migration_type == 'cold-migration':
migration_type = 'migration'
- search_opts['type'] = migration_type
+ search_opts['migration_type'] = migration_type
if parsed_args.marker:
if compute_client.api_version < api_versions.APIVersion('2.59'):