Commit 7b2cd2b4 authored by Luca Bigliardi's avatar Luca Bigliardi
Browse files

Check and set drbd helper in set params LU


Signed-off-by: default avatarLuca Bigliardi <shammash@google.com>
Reviewed-by: default avatarIustin Pop <iustin@google.com>
parent a721e23a
......@@ -2561,6 +2561,7 @@ class LUSetClusterParams(LogicalUnit):
("remove_uids", None, _NoType),
("maintain_node_health", None, _TMaybeBool),
("nicparams", None, _TOr(_TDict, _TNone)),
("drbd_helper", None, _TOr(_TString, _TNone)),
]
REQ_BGL = False
......@@ -2608,6 +2609,12 @@ class LUSetClusterParams(LogicalUnit):
raise errors.OpPrereqError("Cannot disable lvm storage while lvm-based"
" instances exist", errors.ECODE_INVAL)
if self.op.drbd_helper is not None and not self.op.drbd_helper:
if self.cfg.HasAnyDiskOfType(constants.LD_DRBD8):
raise errors.OpPrereqError("Cannot disable drbd helper while"
" drbd-based instances exist",
errors.ECODE_INVAL)
node_list = self.acquired_locks[locking.LEVEL_NODE]
# if vg_name not None, checks given volume group on all nodes
......@@ -2627,6 +2634,24 @@ class LUSetClusterParams(LogicalUnit):
raise errors.OpPrereqError("Error on node '%s': %s" %
(node, vgstatus), errors.ECODE_ENVIRON)
if self.op.drbd_helper:
# checks given drbd helper on all nodes
helpers = self.rpc.call_drbd_helper(node_list)
for node in node_list:
ninfo = self.cfg.GetNodeInfo(node)
if ninfo.offline:
self.LogInfo("Not checking drbd helper on offline node %s", node)
continue
msg = helpers[node].fail_msg
if msg:
raise errors.OpPrereqError("Error checking drbd helper on node"
" '%s': %s" % (node, msg),
errors.ECODE_ENVIRON)
node_helper = helpers[node].payload
if node_helper != self.op.drbd_helper:
raise errors.OpPrereqError("Error on node '%s': drbd helper is %s" %
(node, node_helper), errors.ECODE_ENVIRON)
self.cluster = cluster = self.cfg.GetClusterInfo()
# validate params changes
if self.op.beparams:
......@@ -2756,6 +2781,15 @@ class LUSetClusterParams(LogicalUnit):
else:
feedback_fn("Cluster LVM configuration already in desired"
" state, not changing")
if self.op.drbd_helper is not None:
new_helper = self.op.drbd_helper
if not new_helper:
new_helper = None
if new_helper != self.cfg.GetDRBDHelper():
self.cfg.SetDRBDHelper(new_helper)
else:
feedback_fn("Cluster DRBD helper already in desired state,"
" not changing")
if self.op.hvparams:
self.cluster.hvparams = self.new_hvparams
if self.op.os_hvp:
......
......@@ -299,6 +299,7 @@ class OpSetClusterParams(OpCode):
OP_ID = "OP_CLUSTER_SET_PARAMS"
__slots__ = [
"vg_name",
"drbd_helper",
"enabled_hypervisors",
"hvparams",
"os_hvp",
......
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