summaryrefslogtreecommitdiff
path: root/openstackclient/compute
diff options
context:
space:
mode:
authorRikimaru Honjo <honjo.rikimaru@po.ntts.co.jp>2017-02-23 16:59:26 +0900
committerRikimaru Honjo <honjo.rikimaru@po.ntts.co.jp>2017-03-01 17:37:39 +0900
commit7063ffb3cacadbaf2e47c4e6d7b2cf8d694c83a7 (patch)
tree43dbd9d64023ef59fea42c8851dad5f2ff0aed22 /openstackclient/compute
parentc8435f2d5a31731e3f25f9ed14fa54f8cb372eee (diff)
downloadpython-openstackclient-7063ffb3cacadbaf2e47c4e6d7b2cf8d694c83a7.tar.gz
Add a validation about options for server migrate command
The behavior of server migrate command are different depending on whether user specify --live option or not. server migrate command will call live migration API if user specify --live option. Ohterwise server migrate command will call migration(cold migration) API. Now then, "--block-migraiton" option and "--disk-overcommit" option only affect live-migration. But, openstackclient doesn't warn user if user specify these options without "--live". But, user can't recognize that specifying options are ignored. This patch adds a validation that checks whether or not user specify these options without "--live". Change-Id: Ifa278abb23ecdba4b13f3742998359ac74eb7ad4 Closes-bug: #1662755
Diffstat (limited to 'openstackclient/compute')
-rw-r--r--openstackclient/compute/v2/server.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/openstackclient/compute/v2/server.py b/openstackclient/compute/v2/server.py
index d33c631a..1f91e6d9 100644
--- a/openstackclient/compute/v2/server.py
+++ b/openstackclient/compute/v2/server.py
@@ -1104,6 +1104,10 @@ class MigrateServer(command.Command):
disk_over_commit=parsed_args.disk_overcommit,
)
else:
+ if parsed_args.block_migration or parsed_args.disk_overcommit:
+ raise exceptions.CommandError("--live must be specified if "
+ "--block-migration or "
+ "--disk-overcommit is specified")
server.migrate()
if parsed_args.wait: