Commit e5c92cfb authored by Klaus Aehlig's avatar Klaus Aehlig
Browse files

Add a force option to the ClusterSetParams Opcode



If set, the op code will, in particular, try to set the master IP
on the new netdev, even if shutting down the master IP on the old
netdev failed.
Signed-off-by: default avatarKlaus Aehlig <aehlig@google.com>
Reviewed-by: default avatarMichele Tartara <mtartara@google.com>
parent ac0af025
......@@ -1021,7 +1021,13 @@ class LUClusterSetParams(LogicalUnit):
self.cluster.master_netdev)
result = self.rpc.call_node_deactivate_master_ip(master_params.name,
master_params, ems)
result.Raise("Could not disable the master ip")
if not self.op.force:
result.Raise("Could not disable the master ip")
else:
if result.fail_msg:
msg = ("Could not disable the master ip (continuing anyway): %s" %
result.fail_msg)
feedback_fn(msg)
feedback_fn("Changing master_netdev from %s to %s" %
(master_params.netdev, self.op.master_netdev))
self.cluster.master_netdev = self.op.master_netdev
......
......@@ -918,6 +918,7 @@ class OpClusterSetParams(OpCode):
"""
OP_PARAMS = [
_PForce,
_PHvState,
_PDiskState,
("vg_name", None, ht.TMaybe(ht.TString), "Volume group name"),
......
......@@ -149,7 +149,8 @@ $(genOpCode "OpCode"
[ pName
])
, ("OpClusterSetParams",
[ pHvState
[ pForce
, pHvState
, pDiskState
, pVgName
, pEnabledHypervisors
......
......@@ -152,7 +152,7 @@ instance Arbitrary OpCodes.OpCode where
"OP_CLUSTER_RENAME" ->
OpCodes.OpClusterRename <$> genNameNE
"OP_CLUSTER_SET_PARAMS" ->
OpCodes.OpClusterSetParams <$> emptyMUD <*> emptyMUD <*>
OpCodes.OpClusterSetParams <$> arbitrary <*> emptyMUD <*> emptyMUD <*>
arbitrary <*> genMaybe (listOf1 arbitrary >>= mkNonEmpty) <*>
genMaybe genEmptyContainer <*> emptyMUD <*>
genMaybe genEmptyContainer <*> genMaybe genEmptyContainer <*>
......
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