Commit 38f9d2cf authored by Guido Trotter's avatar Guido Trotter
Browse files

Add gnt-cluster modify --master-netdev



Although this might be a dangerous operation, it's still better to allow
it rather than requiring a hand-edit of the config file, should it be
necessary.
Signed-off-by: default avatarGuido Trotter <ultrotter@google.com>
Reviewed-by: default avatarMichael Hanselmann <hansmi@google.com>
parent 46aae796
......@@ -722,6 +722,7 @@ def SetClusterParams(opts, args):
opts.remove_uids is not None or
opts.default_iallocator is not None or
opts.reserved_lvs is not None or
opts.master_netdev is not None or
opts.prealloc_wipe_disks is not None):
ToStderr("Please give at least one of the parameters.")
return 1
......@@ -796,6 +797,7 @@ def SetClusterParams(opts, args):
remove_uids=remove_uids,
default_iallocator=opts.default_iallocator,
prealloc_wipe_disks=opts.prealloc_wipe_disks,
master_netdev=opts.master_netdev,
reserved_lvs=opts.reserved_lvs)
SubmitOpCode(op, opts=opts)
return 0
......@@ -953,7 +955,7 @@ commands = {
"{pause <timespec>|continue|info}", "Change watcher properties"),
'modify': (
SetClusterParams, ARGS_NONE,
[BACKEND_OPT, CP_SIZE_OPT, ENABLED_HV_OPT, HVLIST_OPT,
[BACKEND_OPT, CP_SIZE_OPT, ENABLED_HV_OPT, HVLIST_OPT, MASTER_NETDEV_OPT,
NIC_PARAMS_OPT, NOLVM_STORAGE_OPT, VG_NAME_OPT, MAINTAIN_NODE_HEALTH_OPT,
UIDPOOL_OPT, ADD_UIDS_OPT, REMOVE_UIDS_OPT, DRBD_HELPER_OPT,
NODRBD_STORAGE_OPT, DEFAULT_IALLOCATOR_OPT, RESERVED_LVS_OPT,
......
......@@ -2703,6 +2703,7 @@ class LUSetClusterParams(LogicalUnit):
("ndparams", None, ht.TOr(ht.TDict, ht.TNone)),
("drbd_helper", None, ht.TOr(ht.TString, ht.TNone)),
("default_iallocator", None, ht.TOr(ht.TString, ht.TNone)),
("master_netdev", None, ht.TOr(ht.TString, ht.TNone)),
("reserved_lvs", None, ht.TOr(ht.TListOf(ht.TNonEmptyString), ht.TNone)),
("hidden_os", None, ht.TOr(ht.TListOf(\
ht.TAnd(ht.TList,
......@@ -3019,8 +3020,27 @@ class LUSetClusterParams(LogicalUnit):
if self.op.blacklisted_os:
helper_os("blacklisted_os", self.op.blacklisted_os, "blacklisted")
if self.op.master_netdev:
master = self.cfg.GetMasterNode()
feedback_fn("Shutting down master ip on the current netdev (%s)" %
self.cluster.master_netdev)
result = self.rpc.call_node_stop_master(master, False)
result.Raise("Could not disable the master ip")
feedback_fn("Changing master_netdev from %s to %s" %
(self.cluster.master_netdev, self.op.master_netdev))
self.cluster.master_netdev = self.op.master_netdev
self.cfg.Update(self.cluster, feedback_fn)
if self.op.master_netdev:
feedback_fn("Starting the master ip on the new master netdev (%s)" %
self.op.master_netdev)
result = self.rpc.call_node_start_master(master, False, False)
if result.fail_msg:
self.LogWarning("Could not re-enable the master ip on"
" the master, please restart manually: %s",
result.fail_msg)
def _UploadHelper(lu, nodes, fname):
"""Helper for uploading a file and showing warnings.
......
......@@ -328,6 +328,7 @@ class OpSetClusterParams(OpCode):
"hidden_os",
"blacklisted_os",
"prealloc_wipe_disks",
"master_netdev",
]
......
......@@ -384,14 +384,15 @@ MODIFY
| [-I *default instance allocator*]
| [--reserved-lvs=*NAMES*]
| [--node-parameters *ndparams*]
| [--master-netdev *interface-name*]
Modify the options for the cluster.
The ``--vg-name``, ``--no-lvm-storarge``, ``--enabled-hypervisors``,
``--hypervisor-parameters``, ``--backend-parameters``,
``--nic-parameters``, ``--maintain-node-health``,
``--prealloc-wipe-disks``, ``--uid-pool``, ``--node-parameters`` options
are described in the **init** command.
``--prealloc-wipe-disks``, ``--uid-pool``, ``--node-parameters``,
``--master-netdev`` options are described in the **init** command.
The ``-C`` option specifies the ``candidate_pool_size`` cluster
parameter. This is the number of nodes that the master will try to
......
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