Commit 92cf62e3 authored by René Nussbaumer's avatar René Nussbaumer
Browse files

gnt-instance: Adding instance policy to move


Signed-off-by: default avatarRené Nussbaumer <rn@google.com>
Reviewed-by: default avatarMichael Hanselmann <hansmi@google.com>
parent 3ed23330
......@@ -877,7 +877,8 @@ def MoveInstance(opts, args):
op = opcodes.OpInstanceMove(instance_name=instance_name,
target_node=opts.node,
shutdown_timeout=opts.shutdown_timeout,
ignore_consistency=opts.ignore_consistency)
ignore_consistency=opts.ignore_consistency,
ignore_ipolicy=opts.ignore_ipolicy)
SubmitOrSend(op, opts, cl=cl)
return 0
......@@ -1454,7 +1455,7 @@ commands = {
"move": (
MoveInstance, ARGS_ONE_INSTANCE,
[FORCE_OPT, SUBMIT_OPT, SINGLE_NODE_OPT, SHUTDOWN_TIMEOUT_OPT,
DRY_RUN_OPT, PRIORITY_OPT, IGNORE_CONSIST_OPT],
DRY_RUN_OPT, PRIORITY_OPT, IGNORE_CONSIST_OPT, IGNORE_IPOLICY_OPT],
"[-f] <instance>", "Move instance to an arbitrary node"
" (only for instances of type file and lv)"),
"info": (
......
......@@ -7449,6 +7449,9 @@ class LUInstanceMove(LogicalUnit):
_CheckNodeOnline(self, target_node)
_CheckNodeNotDrained(self, target_node)
_CheckNodeVmCapable(self, target_node)
ipolicy = _CalculateGroupIPolicy(self.cfg.GetClusterInfo(), node.group)
_CheckTargetNodeIPolicy(self, ipolicy, instance, node,
ignore=self.op.ignore_ipolicy)
 
if instance.admin_state == constants.ADMINST_UP:
# check memory requirements on the secondary node
......
......@@ -1286,6 +1286,7 @@ class OpInstanceMove(OpCode):
OP_PARAMS = [
_PInstanceName,
_PShutdownTimeout,
_PIgnoreIpolicy,
("target_node", ht.NoDefault, ht.TNonEmptyString, "Target node"),
_PIgnoreConsistency,
]
......
......@@ -1487,7 +1487,7 @@ MOVE
^^^^
**move** [-f] [--ignore-consistency]
[-n *node*] [--shutdown-timeout=*N*] [--submit]
[-n *node*] [--shutdown-timeout=*N*] [--submit] [--ignore-ipolicy]
{*instance*}
Move will move the instance to an arbitrary node in the cluster. This
......@@ -1510,6 +1510,9 @@ The ``--submit`` option is used to send the job to the master daemon
but not wait for its completion. The job ID will be shown so that it
can be examined via **gnt-job info**.
If ``--ignore-ipolicy`` is given any instance policy violations occuring
during this operation are ignored.
Example::
# gnt-instance move -n node3.example.com instance1.example.com
......
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