Commit fbf5a861 authored by Iustin Pop's avatar Iustin Pop
Browse files

Add gnt-instance move

This uses the new LUMoveInstance. It supports only single-instance moves.
Signed-off-by: default avatarIustin Pop <>
Reviewed-by: default avatarMichael Hanselmann <>
parent 313bcead
......@@ -2072,6 +2072,44 @@ y/[n]/?: y
<arg>-n <replaceable>node</replaceable></arg>
<arg choice="req"><replaceable>instance</replaceable></arg>
Move will move the instance to an arbitrary node in the
cluster. This works only for instances having a plain or
file disk template.
Note that since this operation is done via data copy, it
will take a long time for big disks (similar to
replace-disks for a drbd instance).
The <option>--submit</option> 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
<command>gnt-job info</command>.
# gnt-instance move -n
......@@ -952,6 +952,33 @@ def MigrateInstance(opts, args):
return 0
def MoveInstance(opts, args):
"""Move an instance.
@param opts: the command line options selected by the user
@type args: list
@param args: should contain only one element, the instance name
@rtype: int
@return: the desired exit code
cl = GetClient()
instance_name = args[0]
force = opts.force
if not force:
usertext = ("Instance %s will be moved."
" This requires a shutdown of the instance. Continue?" %
if not AskUser(usertext):
return 1
op = opcodes.OpMoveInstance(instance_name=instance_name,
SubmitOrSend(op, opts, cl=cl)
return 0
def ConnectToInstanceConsole(opts, args):
"""Connect to the console of an instance.
......@@ -1435,6 +1462,15 @@ commands = {
"[-f] <instance>",
"Migrate instance to its secondary node"
" (only for instances of type drbd)"),
'move': (MoveInstance, ARGS_ONE,
make_option("-n", "--new-node", dest="target_node",
help="Destinattion node", metavar="NODE",
"[-f] <instance>",
"Move instance to an arbitrary node"
" (only for instances of type file and lv)"),
'info': (ShowInstanceConfig, ARGS_ANY,
make_option("-s", "--static", dest="static",
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