From 783a6c0bbac431db60193d7ab6925337bd65ef9b Mon Sep 17 00:00:00 2001 From: Iustin Pop <iustin@google.com> Date: Mon, 19 Jul 2010 16:57:59 +0200 Subject: [PATCH] Rename migration type to migration mode MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is in preparation for the rename of the opcode 'live' parameter to 'mode'. Signed-off-by: Iustin Pop <iustin@google.com> Reviewed-by: RenΓ© Nussbaumer <rn@google.com> --- lib/cli.py | 10 +++++----- lib/cmdlib.py | 6 +++--- lib/constants.py | 14 +++++++------- lib/hypervisor/hv_base.py | 6 +++--- lib/hypervisor/hv_kvm.py | 4 ++-- lib/hypervisor/hv_xen.py | 6 +++--- man/gnt-instance.sgml | 6 +++--- man/gnt-node.sgml | 4 ++-- scripts/gnt-instance | 10 +++++----- scripts/gnt-node | 10 +++++----- 10 files changed, 38 insertions(+), 38 deletions(-) diff --git a/lib/cli.py b/lib/cli.py index 8c17e4ba9..c2dd3cad3 100644 --- a/lib/cli.py +++ b/lib/cli.py @@ -1,7 +1,7 @@ # # -# Copyright (C) 2006, 2007 Google Inc. +# Copyright (C) 2006, 2007, 2008, 2009, 2010 Google Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -87,7 +87,7 @@ __all__ = [ "MAINTAIN_NODE_HEALTH_OPT", "MASTER_NETDEV_OPT", "MC_OPT", - "MIGRATION_TYPE_OPT", + "MIGRATION_MODE_OPT", "NET_OPT", "NEW_CLUSTER_CERT_OPT", "NEW_CLUSTER_DOMAIN_SECRET_OPT", @@ -699,10 +699,10 @@ NONLIVE_OPT = cli_option("--non-live", dest="live", " freeze the instance, save the state, transfer and" " only then resume running on the secondary node)") -MIGRATION_TYPE_OPT = cli_option("--migration-type", dest="migration_type", +MIGRATION_MODE_OPT = cli_option("--migration-mode", dest="migration_mode", default=None, - choices=list(constants.HT_MIGRATION_TYPES), - help="Override default migration type (choose" + choices=list(constants.HT_MIGRATION_MODES), + help="Override default migration mode (choose" " either live or non-live") NODE_PLACEMENT_OPT = cli_option("-n", "--node", dest="node", diff --git a/lib/cmdlib.py b/lib/cmdlib.py index c3a732154..b953e5011 100644 --- a/lib/cmdlib.py +++ b/lib/cmdlib.py @@ -1,7 +1,7 @@ # # -# Copyright (C) 2006, 2007, 2008 Google Inc. +# Copyright (C) 2006, 2007, 2008, 2009, 2010 Google Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -234,7 +234,7 @@ _PNodeName = ("node_name", _NoDefault, _TNonEmptyString) #: the migration type (live/non-live) _PMigrationLive = ("live", None, _TOr(_TNone, - _TElemOf(constants.HT_MIGRATION_TYPES))) + _TElemOf(constants.HT_MIGRATION_MODES))) # End types @@ -5822,7 +5822,7 @@ class TLMigrateInstance(Tasklet): if self.lu.op.live is None: # read the default value from the hypervisor i_hv = self.cfg.GetClusterInfo().FillHV(instance, skip_globals=False) - self.lu.op.live = i_hv[constants.HV_MIGRATION_TYPE] + self.lu.op.live = i_hv[constants.HV_MIGRATION_MODE] self.live = self.lu.op.live == constants.HT_MIGRATION_LIVE diff --git a/lib/constants.py b/lib/constants.py index 95e1708c0..3b4c38b4c 100644 --- a/lib/constants.py +++ b/lib/constants.py @@ -546,7 +546,7 @@ HV_INIT_SCRIPT = "init_script" HV_MIGRATION_PORT = "migration_port" HV_MIGRATION_BANDWIDTH = "migration_bandwidth" HV_MIGRATION_DOWNTIME = "migration_downtime" -HV_MIGRATION_TYPE = "migration_type" +HV_MIGRATION_MODE = "migration_mode" HV_USE_LOCALTIME = "use_localtime" HV_DISK_CACHE = "disk_cache" HV_SECURITY_MODEL = "security_model" @@ -582,7 +582,7 @@ HVS_PARAMETER_TYPES = { HV_MIGRATION_PORT: VTYPE_INT, HV_MIGRATION_BANDWIDTH: VTYPE_INT, HV_MIGRATION_DOWNTIME: VTYPE_INT, - HV_MIGRATION_TYPE: VTYPE_STRING, + HV_MIGRATION_MODE: VTYPE_STRING, HV_USE_LOCALTIME: VTYPE_BOOL, HV_DISK_CACHE: VTYPE_STRING, HV_SECURITY_MODEL: VTYPE_STRING, @@ -733,7 +733,7 @@ HT_KVM_FLAG_VALUES = frozenset([HT_KVM_ENABLED, HT_KVM_DISABLED]) # Migration type HT_MIGRATION_LIVE = "live" HT_MIGRATION_NONLIVE = "non-live" -HT_MIGRATION_TYPES = frozenset([HT_MIGRATION_LIVE, HT_MIGRATION_NONLIVE]) +HT_MIGRATION_MODES = frozenset([HT_MIGRATION_LIVE, HT_MIGRATION_NONLIVE]) # Cluster Verify steps VERIFY_NPLUSONE_MEM = 'nplusone_mem' @@ -877,7 +877,7 @@ HVC_DEFAULTS = { HV_ROOT_PATH: '/dev/sda1', HV_KERNEL_ARGS: 'ro', HV_MIGRATION_PORT: 8002, - HV_MIGRATION_TYPE: HT_MIGRATION_LIVE, + HV_MIGRATION_MODE: HT_MIGRATION_LIVE, }, HT_XEN_HVM: { HV_BOOT_ORDER: "cd", @@ -891,7 +891,7 @@ HVC_DEFAULTS = { HV_KERNEL_PATH: "/usr/lib/xen/boot/hvmloader", HV_DEVICE_MODEL: "/usr/lib/xen/bin/qemu-dm", HV_MIGRATION_PORT: 8002, - HV_MIGRATION_TYPE: HT_MIGRATION_NONLIVE, + HV_MIGRATION_MODE: HT_MIGRATION_NONLIVE, HV_USE_LOCALTIME: False, }, HT_KVM: { @@ -914,7 +914,7 @@ HVC_DEFAULTS = { HV_MIGRATION_PORT: 8102, HV_MIGRATION_BANDWIDTH: 32, # MiB/s HV_MIGRATION_DOWNTIME: 30, # ms - HV_MIGRATION_TYPE: HT_MIGRATION_LIVE, + HV_MIGRATION_MODE: HT_MIGRATION_LIVE, HV_USE_LOCALTIME: False, HV_DISK_CACHE: HT_CACHE_DEFAULT, HV_SECURITY_MODEL: HT_SM_NONE, @@ -936,7 +936,7 @@ HVC_DEFAULTS = { HVC_GLOBALS = frozenset([ HV_MIGRATION_PORT, HV_MIGRATION_BANDWIDTH, - HV_MIGRATION_TYPE, + HV_MIGRATION_MODE, ]) BEC_DEFAULTS = { diff --git a/lib/hypervisor/hv_base.py b/lib/hypervisor/hv_base.py index ce8754d77..80675eedd 100644 --- a/lib/hypervisor/hv_base.py +++ b/lib/hypervisor/hv_base.py @@ -1,7 +1,7 @@ # # -# Copyright (C) 2006, 2007, 2008 Google Inc. +# Copyright (C) 2006, 2007, 2008, 2009, 2010 Google Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -89,8 +89,8 @@ NO_CHECK = (False, None, None, None, None) REQUIRED_CHECK = (True, None, None, None, None) # migration type -MIGRATION_TYPE_CHECK = (True, lambda x: x in constants.HT_MIGRATION_TYPES, - "invalid migration type", None, None) +MIGRATION_MODE_CHECK = (True, lambda x: x in constants.HT_MIGRATION_MODES, + "invalid migration mode", None, None) def ParamInSet(required, my_set): diff --git a/lib/hypervisor/hv_kvm.py b/lib/hypervisor/hv_kvm.py index 7ddd46b3a..3487d9dff 100644 --- a/lib/hypervisor/hv_kvm.py +++ b/lib/hypervisor/hv_kvm.py @@ -1,7 +1,7 @@ # # -# Copyright (C) 2008 Google Inc. +# Copyright (C) 2008, 2009, 2010 Google Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -194,7 +194,7 @@ class KVMHypervisor(hv_base.BaseHypervisor): constants.HV_MIGRATION_PORT: hv_base.NET_PORT_CHECK, constants.HV_MIGRATION_BANDWIDTH: hv_base.NO_CHECK, constants.HV_MIGRATION_DOWNTIME: hv_base.NO_CHECK, - constants.HV_MIGRATION_TYPE: hv_base.MIGRATION_TYPE_CHECK, + constants.HV_MIGRATION_MODE: hv_base.MIGRATION_MODE_CHECK, constants.HV_USE_LOCALTIME: hv_base.NO_CHECK, constants.HV_DISK_CACHE: hv_base.ParamInSet(True, constants.HT_VALID_CACHE_TYPES), diff --git a/lib/hypervisor/hv_xen.py b/lib/hypervisor/hv_xen.py index a02035867..64c231d7a 100644 --- a/lib/hypervisor/hv_xen.py +++ b/lib/hypervisor/hv_xen.py @@ -1,7 +1,7 @@ # # -# Copyright (C) 2006, 2007, 2008 Google Inc. +# Copyright (C) 2006, 2007, 2008, 2009, 2010 Google Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -458,7 +458,7 @@ class XenPvmHypervisor(XenHypervisor): constants.HV_ROOT_PATH: hv_base.REQUIRED_CHECK, constants.HV_KERNEL_ARGS: hv_base.NO_CHECK, constants.HV_MIGRATION_PORT: hv_base.NET_PORT_CHECK, - constants.HV_MIGRATION_TYPE: hv_base.MIGRATION_TYPE_CHECK, + constants.HV_MIGRATION_MODE: hv_base.MIGRATION_MODE_CHECK, } @classmethod @@ -557,7 +557,7 @@ class XenHvmHypervisor(XenHypervisor): constants.HV_DEVICE_MODEL: hv_base.REQ_FILE_CHECK, constants.HV_VNC_PASSWORD_FILE: hv_base.REQ_FILE_CHECK, constants.HV_MIGRATION_PORT: hv_base.NET_PORT_CHECK, - constants.HV_MIGRATION_TYPE: hv_base.MIGRATION_TYPE_CHECK, + constants.HV_MIGRATION_MODE: hv_base.MIGRATION_MODE_CHECK, constants.HV_USE_LOCALTIME: hv_base.NO_CHECK, } diff --git a/man/gnt-instance.sgml b/man/gnt-instance.sgml index c19eb95f0..dd88052bd 100644 --- a/man/gnt-instance.sgml +++ b/man/gnt-instance.sgml @@ -2407,7 +2407,7 @@ node1.example.com:disk/1:/dev/drbd1 <command>migrate</command> <arg>-f</arg> <arg>--non-live</arg> - <arg>--migration-type=live|non-live</arg> + <arg>--migration-mode=live|non-live</arg> <arg choice="req"><replaceable>instance</replaceable></arg> </cmdsynopsis> @@ -2425,7 +2425,7 @@ node1.example.com:disk/1:/dev/drbd1 <para> The <option>--non-live</option> - and <option>--migration-type=non-live</option> options will + and <option>--migration-mode=non-live</option> options will switch (for the hypervisors that support it) between a "fully live" (i.e. the interruption is as minimal as possible) migration and one in which the instance is frozen, @@ -2434,7 +2434,7 @@ node1.example.com:disk/1:/dev/drbd1 for two different methods. In any case, it is not an error to pass this parameter (it will just be ignored if the hypervisor doesn't support it). The - option <option>--migration-type=live</option> option will + option <option>--migration-mode=live</option> option will request a fully-live migration. The default, when neither option is passed, depends on the hypervisor parameters (and can be viewed with the <command>gnt-cluster info</command> diff --git a/man/gnt-node.sgml b/man/gnt-node.sgml index ea20e32da..ae4720b33 100644 --- a/man/gnt-node.sgml +++ b/man/gnt-node.sgml @@ -571,7 +571,7 @@ <command>migrate</command> <arg>-f</arg> <arg>--non-live</arg> - <arg>--migration-type=live|non-live</arg> + <arg>--migration-mode=live|non-live</arg> <arg choice="req"><replaceable>node</replaceable></arg> </cmdsynopsis> @@ -584,7 +584,7 @@ <para> As for the <command>gnt-instance migrate</command> command, the options <option>--no-live</option> - and <option>--migration-type</option> can be given to + and <option>--migration-mode</option> can be given to influence the migration type. </para> diff --git a/scripts/gnt-instance b/scripts/gnt-instance index 0502cdea3..cbe060cf5 100755 --- a/scripts/gnt-instance +++ b/scripts/gnt-instance @@ -1,7 +1,7 @@ #!/usr/bin/python # -# Copyright (C) 2006, 2007 Google Inc. +# Copyright (C) 2006, 2007, 2008, 2009, 2010 Google Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -898,14 +898,14 @@ def MigrateInstance(opts, args): return 1 # this should be removed once --non-live is deprecated - if not opts.live and opts.migration_type is not None: + if not opts.live and opts.migration_mode is not None: raise errors.OpPrereqError("Only one of the --non-live and " - "--migration-type options can be passed", + "--migration-mode options can be passed", errors.ECODE_INVAL) if not opts.live: # --non-live passed live = constants.HT_MIGRATION_NONLIVE else: - live = opts.migration_type + live = opts.migration_mode op = opcodes.OpMigrateInstance(instance_name=instance_name, live=live, cleanup=opts.cleanup) @@ -1419,7 +1419,7 @@ commands = { " using the remote mirror (only for instances of type drbd)"), 'migrate': ( MigrateInstance, ARGS_ONE_INSTANCE, - [FORCE_OPT, NONLIVE_OPT, MIGRATION_TYPE_OPT, CLEANUP_OPT], + [FORCE_OPT, NONLIVE_OPT, MIGRATION_MODE_OPT, CLEANUP_OPT], "[-f] <instance>", "Migrate instance to its secondary node" " (only for instances of type drbd)"), 'move': ( diff --git a/scripts/gnt-node b/scripts/gnt-node index 363b676dd..49bfc955f 100755 --- a/scripts/gnt-node +++ b/scripts/gnt-node @@ -1,7 +1,7 @@ #!/usr/bin/python # -# Copyright (C) 2006, 2007, 2008 Google Inc. +# Copyright (C) 2006, 2007, 2008, 2009, 2010 Google Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -361,14 +361,14 @@ def MigrateNode(opts, args): return 2 # this should be removed once --non-live is deprecated - if not opts.live and opts.migration_type is not None: + if not opts.live and opts.migration_mode is not None: raise errors.OpPrereqError("Only one of the --non-live and " - "--migration-type options can be passed", + "--migration-mode options can be passed", errors.ECODE_INVAL) if not opts.live: # --non-live passed live = constants.HT_MIGRATION_NONLIVE else: - live = opts.migration_type + live = opts.migration_mode op = opcodes.OpMigrateNode(node_name=args[0], live=live) SubmitOpCode(op, cl=cl, opts=opts) @@ -661,7 +661,7 @@ commands = { "Stops the primary instances on a node and start them on their" " secondary node (only for instances with drbd disk template)"), 'migrate': ( - MigrateNode, ARGS_ONE_NODE, [FORCE_OPT, NONLIVE_OPT, MIGRATION_TYPE_OPT], + MigrateNode, ARGS_ONE_NODE, [FORCE_OPT, NONLIVE_OPT, MIGRATION_MODE_OPT], "[-f] <node>", "Migrate all the primary instance on a node away from it" " (only for instances of type drbd)"), -- GitLab