Skip to content

Commit 70480fa

Browse files
committed
compute: Remove deprecated 'server migrate --live' option
It's been long enough. Time to remove this. Change-Id: I37ef09eca0db9286544a4b0bb33f845311baa9b2 Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
1 parent 6f3969a commit 70480fa

3 files changed

Lines changed: 67 additions & 219 deletions

File tree

openstackclient/compute/v2/server.py

Lines changed: 19 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -2473,27 +2473,7 @@ def get_parser(self, prog_name):
24732473
'validated by the scheduler'
24742474
),
24752475
)
2476-
# The --live and --host options are mutually exclusive ways of asking
2477-
# for a target host during a live migration.
2478-
host_group = parser.add_mutually_exclusive_group()
2479-
# TODO(mriedem): Remove --live in the next major version bump after
2480-
# the Train release.
2481-
host_group.add_argument(
2482-
'--live',
2483-
metavar='<hostname>',
2484-
help=_(
2485-
'**Deprecated** This option is problematic in that it '
2486-
'requires a host and prior to compute API version 2.30, '
2487-
'specifying a host during live migration will bypass '
2488-
'validation by the scheduler which could result in '
2489-
'failures to actually migrate the server to the specified '
2490-
'host or over-subscribe the host. Use the '
2491-
'``--live-migration`` option instead. If both this option '
2492-
'and ``--live-migration`` are used, ``--live-migration`` '
2493-
'takes priority.'
2494-
),
2495-
)
2496-
host_group.add_argument(
2476+
parser.add_argument(
24972477
'--host',
24982478
metavar='<hostname>',
24992479
help=_(
@@ -2551,15 +2531,6 @@ def get_parser(self, prog_name):
25512531
)
25522532
return parser
25532533

2554-
def _log_warning_for_live(self, parsed_args):
2555-
if parsed_args.live:
2556-
# NOTE(mriedem): The --live option requires a host and if
2557-
# --os-compute-api-version is less than 2.30 it will forcefully
2558-
# bypass the scheduler which is dangerous.
2559-
self.log.warning(_(
2560-
'The --live option has been deprecated. Please use the '
2561-
'--live-migration option instead.'))
2562-
25632534
def take_action(self, parsed_args):
25642535

25652536
def _show_progress(progress):
@@ -2573,11 +2544,8 @@ def _show_progress(progress):
25732544
compute_client.servers,
25742545
parsed_args.server,
25752546
)
2576-
# Check for live migration.
2577-
if parsed_args.live or parsed_args.live_migration:
2578-
# Always log a warning if --live is used.
2579-
self._log_warning_for_live(parsed_args)
25802547

2548+
if parsed_args.live_migration:
25812549
kwargs = {}
25822550

25832551
block_migration = parsed_args.block_migration
@@ -2592,28 +2560,23 @@ def _show_progress(progress):
25922560

25932561
kwargs['block_migration'] = block_migration
25942562

2595-
# Prefer --live-migration over --live if both are specified.
2596-
if parsed_args.live_migration:
2597-
# Technically we could pass a non-None host with
2598-
# --os-compute-api-version < 2.30 but that is the same thing
2599-
# as the --live option bypassing the scheduler which we don't
2600-
# want to support, so if the user is using --live-migration
2601-
# and --host, we want to enforce that they are using version
2602-
# 2.30 or greater.
2603-
if (
2604-
parsed_args.host and
2605-
compute_client.api_version <
2606-
api_versions.APIVersion('2.30')
2607-
):
2608-
raise exceptions.CommandError(
2609-
'--os-compute-api-version 2.30 or greater is required '
2610-
'when using --host'
2611-
)
2563+
# Technically we could pass a non-None host with
2564+
# --os-compute-api-version < 2.30 but that is the same thing
2565+
# as the --live option bypassing the scheduler which we don't
2566+
# want to support, so if the user is using --live-migration
2567+
# and --host, we want to enforce that they are using version
2568+
# 2.30 or greater.
2569+
if (
2570+
parsed_args.host and
2571+
compute_client.api_version < api_versions.APIVersion('2.30')
2572+
):
2573+
raise exceptions.CommandError(
2574+
'--os-compute-api-version 2.30 or greater is required '
2575+
'when using --host'
2576+
)
26122577

2613-
# The host parameter is required in the API even if None.
2614-
kwargs['host'] = parsed_args.host
2615-
else:
2616-
kwargs['host'] = parsed_args.live
2578+
# The host parameter is required in the API even if None.
2579+
kwargs['host'] = parsed_args.host
26172580

26182581
if compute_client.api_version < api_versions.APIVersion('2.25'):
26192582
kwargs['disk_over_commit'] = parsed_args.disk_overcommit
@@ -2628,7 +2591,7 @@ def _show_progress(progress):
26282591
self.log.warning(msg)
26292592

26302593
server.live_migrate(**kwargs)
2631-
else:
2594+
else: # cold migration
26322595
if parsed_args.block_migration or parsed_args.disk_overcommit:
26332596
raise exceptions.CommandError(
26342597
"--live-migration must be specified if "

0 commit comments

Comments
 (0)