Commit 2c95a8d4 authored by Iustin Pop's avatar Iustin Pop
Browse files

Add LUVerifyDisks

This patch adds a new LUVerifyDisks that implements the OpVerifyDisks.
The algorithm is that by determining not-used logical volumes for
instances that are supposed to be running, we presume from there that
the DRBD devices are not online and therefore one should
‘activate-disks’ for those instances.

Reviewed-by: imsnah
parent 150e978f
......@@ -875,6 +875,68 @@ class LUVerifyCluster(NoHooksLU):
return int(bad)
class LUVerifyDisks(NoHooksLU):
"""Verifies the cluster disks status.
_OP_REQP = []
def CheckPrereq(self):
"""Check prerequisites.
This has no prerequisites.
def Exec(self, feedback_fn):
"""Verify integrity of cluster disks.
result = res_nodes, res_instances = [], []
vg_name = self.cfg.GetVGName()
nodes = utils.NiceSort(self.cfg.GetNodeList())
instances = [self.cfg.GetInstanceInfo(name)
for name in self.cfg.GetInstanceList()]
nv_dict = {}
for inst in instances:
inst_lvs = {}
if (inst.status != "up" or
inst.disk_template not in constants.DTS_NET_MIRROR):
# transform { iname: {node: [vol,],},} to {(node, vol): iname}
for node, vol_list in inst_lvs.iteritems():
for vol in vol_list:
nv_dict[(node, vol)] = inst
if not nv_dict:
return result
node_lvs = rpc.call_volume_list(nodes, vg_name)
to_act = set()
for node in nodes:
# node_volume
lvs = node_lvs[node]
if not isinstance(lvs, dict):
logger.Info("connection to node %s failed or invalid data returned" %
for lv_name, (_, lv_inactive, lv_online) in lvs.iteritems():
if not lv_online:
inst = nv_dict.get((node, lv_name), None)
if inst is not None and not in res_instances:
return result
class LURenameCluster(LogicalUnit):
"""Rename the cluster.
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