Commit 46d2d8a2 authored by Iustin Pop's avatar Iustin Pop
Browse files

Re-add the 'live' parameter to migration opcodes



This patch reintroduces the live parameter, for backwards compatibility
at the Luxi level. This way, clients can work transparently with both
2.1 and 2.2, even though sub-optimally.
Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarMichael Hanselmann <hansmi@google.com>
parent 46d0a3d0
......@@ -236,6 +236,9 @@ _PNodeName = ("node_name", _NoDefault, _TNonEmptyString)
_PMigrationMode = ("mode", None, _TOr(_TNone,
_TElemOf(constants.HT_MIGRATION_MODES)))
#: the obsolete 'live' mode (boolean)
_PMigrationLive = ("live", None, _TMaybeBool)
# End types
class LogicalUnit(object):
......@@ -5512,6 +5515,7 @@ class LUMigrateInstance(LogicalUnit):
_OP_PARAMS = [
_PInstanceName,
_PMigrationMode,
_PMigrationLive,
("cleanup", False, _TBool),
]
......@@ -5743,6 +5747,7 @@ class LUMigrateNode(LogicalUnit):
_OP_PARAMS = [
_PNodeName,
_PMigrationMode,
_PMigrationLive,
]
REQ_BGL = False
......@@ -5847,7 +5852,19 @@ class TLMigrateInstance(Tasklet):
self.instance = instance
if self.lu.op.mode is None:
if self.lu.op.live is not None and self.lu.op.mode is not None:
raise errors.OpPrereqError("Only one of the 'live' and 'mode'"
" parameters are accepted",
errors.ECODE_INVAL)
if self.lu.op.live is not None:
if self.lu.op.live:
self.lu.op.mode = constants.HT_MIGRATION_LIVE
else:
self.lu.op.mode = constants.HT_MIGRATION_NONLIVE
# reset the 'live' parameter to None so that repeated
# invocations of CheckPrereq do not raise an exception
self.lu.op.live = None
elif self.lu.op.mode is None:
# read the default value from the hypervisor
i_hv = self.cfg.GetClusterInfo().FillHV(instance, skip_globals=False)
self.lu.op.mode = i_hv[constants.HV_MIGRATION_MODE]
......
......@@ -442,6 +442,7 @@ class OpMigrateNode(OpCode):
__slots__ = [
"node_name",
"mode",
"live",
]
......@@ -565,7 +566,7 @@ class OpMigrateInstance(OpCode):
"""
OP_ID = "OP_INSTANCE_MIGRATE"
OP_DSC_FIELD = "instance_name"
__slots__ = ["instance_name", "mode", "cleanup"]
__slots__ = ["instance_name", "mode", "cleanup", "live"]
class OpMoveInstance(OpCode):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment