Commit 3438e1f8 authored by Klaus Aehlig's avatar Klaus Aehlig Committed by Guido Trotter

Add option --new-primary to gnt-instance modify

Extend gnt-instance modify by a new parameter --new-primary
that sets the pnode paramter of the opcode.
Signed-off-by: default avatarKlaus Aehlig <aehlig@google.com>
Reviewed-by: default avatarGuido Trotter <ultrotter@google.com>
parent 75248363
......@@ -122,6 +122,7 @@ __all__ = [
"NEW_CLUSTER_DOMAIN_SECRET_OPT",
"NEW_CONFD_HMAC_KEY_OPT",
"NEW_RAPI_CERT_OPT",
"NEW_PRIMARY_OPT",
"NEW_SECONDARY_OPT",
"NEW_SPICE_CERT_OPT",
"NIC_PARAMS_OPT",
......@@ -1067,6 +1068,11 @@ NEW_SECONDARY_OPT = cli_option("-n", "--new-secondary", dest="dst_node",
metavar="NODE", default=None,
completion_suggest=OPT_COMPL_ONE_NODE)
NEW_PRIMARY_OPT = cli_option("--new-primary", dest="new_primary_node",
help="Specifies the new primary node",
metavar="<node>", default=None,
completion_suggest=OPT_COMPL_ONE_NODE)
ON_PRIMARY_OPT = cli_option("-p", "--on-primary", dest="on_primary",
default=False, action="store_true",
help="Replace the disk(s) on the primary"
......
......@@ -1294,7 +1294,8 @@ def SetInstanceParams(opts, args):
"""
if not (opts.nics or opts.disks or opts.disk_template or
opts.hvparams or opts.beparams or opts.os or opts.osparams or
opts.offline_inst or opts.online_inst or opts.runtime_mem):
opts.offline_inst or opts.online_inst or opts.runtime_mem or
opts.new_primary_node):
ToStderr("Please give at least one of the parameters.")
return 1
......@@ -1336,6 +1337,7 @@ def SetInstanceParams(opts, args):
disks=disks,
disk_template=opts.disk_template,
remote_node=opts.node,
pnode=opts.new_primary_node,
hvparams=opts.hvparams,
beparams=opts.beparams,
runtime_mem=opts.runtime_mem,
......@@ -1536,7 +1538,7 @@ commands = {
DISK_TEMPLATE_OPT, SINGLE_NODE_OPT, OS_OPT, FORCE_VARIANT_OPT,
OSPARAMS_OPT, DRY_RUN_OPT, PRIORITY_OPT, NWSYNC_OPT, OFFLINE_INST_OPT,
ONLINE_INST_OPT, IGNORE_IPOLICY_OPT, RUNTIME_MEM_OPT,
NOCONFLICTSCHECK_OPT],
NOCONFLICTSCHECK_OPT, NEW_PRIMARY_OPT],
"<instance>", "Alters the parameters of an instance"),
"shutdown": (
GenericManyOps("shutdown", _ShutdownInstance), [ArgInstance()],
......
......@@ -1032,6 +1032,7 @@ MODIFY
| \--disk [*N*:]remove \|
| \--disk *N*:mode=*MODE*]
| [{-t|\--disk-template} plain | {-t|\--disk-template} drbd -n *new_secondary*] [\--no-wait-for-sync]
| [\--new-primary=*node*]
| [\--os-type=*OS* [\--force-variant]]
| [{-O|\--os-parameters} *param*=*value*... ]
| [\--offline \| \--online]
......@@ -1090,6 +1091,11 @@ not found, then by default the modification is refused, unless
``--force-variant`` is passed. An invalid OS will also be refused,
unless the ``--force`` option is given.
The option ``--new-primary`` will set the new primary node of an instance
assuming the disks have already been moved manually. Unless the ``--force``
option is given, it is verified that the instance is no longer running
on its current primary node.
The ``--online`` and ``--offline`` options are used to transition an
instance into and out of the ``offline`` state. An instance can be
turned offline only if it was previously down. The ``--online`` option
......
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