summaryrefslogtreecommitdiff
path: root/openstackclient/compute/v2
diff options
context:
space:
mode:
authorZuul <zuul@review.opendev.org>2020-11-03 12:58:49 +0000
committerGerrit Code Review <review@openstack.org>2020-11-03 12:58:49 +0000
commit71cdb113fe1113eb164ec4581b001a7baf4e7355 (patch)
tree912ea836fce09169853fb0be7e3c0db7c2986523 /openstackclient/compute/v2
parenta40d22f1edc14fb643c57a55e1f6567a75bfaf5d (diff)
parentbf35f04682fa2bdd00a7cff7b9a963b4ffb80eff (diff)
downloadpython-openstackclient-71cdb113fe1113eb164ec4581b001a7baf4e7355.tar.gz
Merge "Add 'openstack server migration list --type' option"
Diffstat (limited to 'openstackclient/compute/v2')
-rw-r--r--openstackclient/compute/v2/server.py19
1 files changed, 15 insertions, 4 deletions
diff --git a/openstackclient/compute/v2/server.py b/openstackclient/compute/v2/server.py
index 294b4683..fddafaee 100644
--- a/openstackclient/compute/v2/server.py
+++ b/openstackclient/compute/v2/server.py
@@ -2066,6 +2066,14 @@ class ListMigration(command.Command):
help=_('Filter migrations by status')
)
parser.add_argument(
+ '--type',
+ metavar='<type>',
+ choices=[
+ 'evacuation', 'live-migration', 'cold-migration', 'resize',
+ ],
+ help=_('Filter migrations by type'),
+ )
+ parser.add_argument(
'--marker',
metavar='<marker>',
help=_(
@@ -2140,10 +2148,6 @@ class ListMigration(command.Command):
if compute_client.api_version >= api_versions.APIVersion("2.59"):
columns.insert(0, "UUID")
- # TODO(brinzhang): It also suppports filter migrations by type
- # since 2.1. https://review.opendev.org/#/c/675117 supported
- # filtering the migrations by 'migration_type' and 'source_compute'
- # in novaclient, that will be added in OSC by follow-up.
if compute_client.api_version >= api_versions.APIVersion("2.23"):
columns.insert(0, "Id")
columns.insert(len(columns) - 2, "Type")
@@ -2168,6 +2172,13 @@ class ListMigration(command.Command):
'status': parsed_args.status,
}
+ 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
+
if parsed_args.marker:
if compute_client.api_version < api_versions.APIVersion('2.59'):
msg = _(