From 7063ffb3cacadbaf2e47c4e6d7b2cf8d694c83a7 Mon Sep 17 00:00:00 2001 From: Rikimaru Honjo Date: Thu, 23 Feb 2017 16:59:26 +0900 Subject: 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 --- openstackclient/compute/v2/server.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'openstackclient/compute/v2') 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: -- cgit v1.2.1