From 1a5dd4af5bf7fdc1b903b300b917f302ba75a1bc Mon Sep 17 00:00:00 2001 From: Stephen Finucane Date: Mon, 9 Nov 2020 14:53:57 +0000 Subject: 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 --- openstackclient/compute/v2/server.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'openstackclient/compute/v2') 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'): -- cgit v1.2.1