Commit cc9e1230 authored by Guido Trotter's avatar Guido Trotter
Browse files

LUVerifyCluster: Handle the "no volume group" case

If we're only file based and out volume group is set to "None" there's
no point in asking nodes for their volume groups, logical volumes, and
drbd devices, and checking those.

Reviewed-by: iustinp
parent 4352bf6d
...@@ -647,7 +647,7 @@ class LUVerifyCluster(LogicalUnit): ...@@ -647,7 +647,7 @@ class LUVerifyCluster(LogicalUnit):
def _VerifyNode(self, nodeinfo, file_list, local_cksum, def _VerifyNode(self, nodeinfo, file_list, local_cksum,
node_result, feedback_fn, master_files, node_result, feedback_fn, master_files,
drbd_map): drbd_map, vg_name):
"""Run multiple tests against a node. """Run multiple tests against a node.
Test list: Test list:
...@@ -667,6 +667,7 @@ class LUVerifyCluster(LogicalUnit): ...@@ -667,6 +667,7 @@ class LUVerifyCluster(LogicalUnit):
@param drbd_map: the useddrbd minors for this node, in @param drbd_map: the useddrbd minors for this node, in
form of minor: (instance, must_exist) which correspond to instances form of minor: (instance, must_exist) which correspond to instances
and their running status and their running status
@param vg_name: Ganeti Volume Group (result of self.cfg.GetVGName())
""" """
node = nodeinfo.name node = nodeinfo.name
...@@ -700,18 +701,18 @@ class LUVerifyCluster(LogicalUnit): ...@@ -700,18 +701,18 @@ class LUVerifyCluster(LogicalUnit):
(constants.RELEASE_VERSION, node, remote_version[1])) (constants.RELEASE_VERSION, node, remote_version[1]))
# checks vg existence and size > 20G # checks vg existence and size > 20G
if vg_name is not None:
vglist = node_result.get(constants.NV_VGLIST, None) vglist = node_result.get(constants.NV_VGLIST, None)
if not vglist: if not vglist:
feedback_fn(" - ERROR: unable to check volume groups on node %s." % feedback_fn(" - ERROR: unable to check volume groups on node %s." %
(node,)) (node,))
bad = True
else:
vgstatus = utils.CheckVolumeGroupSize(vglist, self.cfg.GetVGName(),
constants.MIN_VG_SIZE)
if vgstatus:
feedback_fn(" - ERROR: %s on node %s" % (vgstatus, node))
bad = True bad = True
else:
vgstatus = utils.CheckVolumeGroupSize(vglist, vg_name,
constants.MIN_VG_SIZE)
if vgstatus:
feedback_fn(" - ERROR: %s on node %s" % (vgstatus, node))
bad = True
# checks config file checksum # checks config file checksum
...@@ -773,20 +774,21 @@ class LUVerifyCluster(LogicalUnit): ...@@ -773,20 +774,21 @@ class LUVerifyCluster(LogicalUnit):
(hv_name, hv_result)) (hv_name, hv_result))
# check used drbd list # check used drbd list
used_minors = node_result.get(constants.NV_DRBDLIST, []) if vg_name is not None:
if not isinstance(used_minors, (tuple, list)): used_minors = node_result.get(constants.NV_DRBDLIST, [])
feedback_fn(" - ERROR: cannot parse drbd status file: %s" % if not isinstance(used_minors, (tuple, list)):
str(used_minors)) feedback_fn(" - ERROR: cannot parse drbd status file: %s" %
else: str(used_minors))
for minor, (iname, must_exist) in drbd_map.items(): else:
if minor not in used_minors and must_exist: for minor, (iname, must_exist) in drbd_map.items():
feedback_fn(" - ERROR: drbd minor %d of instance %s is not active" % if minor not in used_minors and must_exist:
(minor, iname)) feedback_fn(" - ERROR: drbd minor %d of instance %s is not active" %
bad = True (minor, iname))
for minor in used_minors: bad = True
if minor not in drbd_map: for minor in used_minors:
feedback_fn(" - ERROR: unallocated drbd minor %d is in use" % minor) if minor not in drbd_map:
bad = True feedback_fn(" - ERROR: unallocated drbd minor %d is in use" % minor)
bad = True
return bad return bad
...@@ -962,13 +964,14 @@ class LUVerifyCluster(LogicalUnit): ...@@ -962,13 +964,14 @@ class LUVerifyCluster(LogicalUnit):
constants.NV_NODENETTEST: [(node.name, node.primary_ip, constants.NV_NODENETTEST: [(node.name, node.primary_ip,
node.secondary_ip) for node in nodeinfo node.secondary_ip) for node in nodeinfo
if not node.offline], if not node.offline],
constants.NV_LVLIST: vg_name,
constants.NV_INSTANCELIST: hypervisors, constants.NV_INSTANCELIST: hypervisors,
constants.NV_VGLIST: None,
constants.NV_VERSION: None, constants.NV_VERSION: None,
constants.NV_HVINFO: self.cfg.GetHypervisorType(), constants.NV_HVINFO: self.cfg.GetHypervisorType(),
constants.NV_DRBDLIST: None,
} }
if vg_name is not None:
node_verify_param[constants.NV_VGLIST] = None
node_verify_param[constants.NV_LVLIST] = vg_name
node_verify_param[constants.NV_DRBDLIST] = None
all_nvinfo = self.rpc.call_node_verify(nodelist, node_verify_param, all_nvinfo = self.rpc.call_node_verify(nodelist, node_verify_param,
self.cfg.GetClusterName()) self.cfg.GetClusterName())
...@@ -1007,11 +1010,13 @@ class LUVerifyCluster(LogicalUnit): ...@@ -1007,11 +1010,13 @@ class LUVerifyCluster(LogicalUnit):
node_drbd[minor] = (instance.name, instance.admin_up) node_drbd[minor] = (instance.name, instance.admin_up)
result = self._VerifyNode(node_i, file_names, local_checksums, result = self._VerifyNode(node_i, file_names, local_checksums,
nresult, feedback_fn, master_files, nresult, feedback_fn, master_files,
node_drbd) node_drbd, vg_name)
bad = bad or result bad = bad or result
lvdata = nresult.get(constants.NV_LVLIST, "Missing LV data") lvdata = nresult.get(constants.NV_LVLIST, "Missing LV data")
if isinstance(lvdata, basestring): if vg_name is None:
node_volume[node] = {}
elif isinstance(lvdata, basestring):
feedback_fn(" - ERROR: LVM problem on node %s: %s" % feedback_fn(" - ERROR: LVM problem on node %s: %s" %
(node, utils.SafeEncode(lvdata))) (node, utils.SafeEncode(lvdata)))
bad = True bad = True
...@@ -1043,7 +1048,6 @@ class LUVerifyCluster(LogicalUnit): ...@@ -1043,7 +1048,6 @@ class LUVerifyCluster(LogicalUnit):
try: try:
node_info[node] = { node_info[node] = {
"mfree": int(nodeinfo['memory_free']), "mfree": int(nodeinfo['memory_free']),
"dfree": int(nresult[constants.NV_VGLIST][vg_name]),
"pinst": [], "pinst": [],
"sinst": [], "sinst": [],
# dictionary holding all instances this node is secondary for, # dictionary holding all instances this node is secondary for,
...@@ -1054,6 +1058,9 @@ class LUVerifyCluster(LogicalUnit): ...@@ -1054,6 +1058,9 @@ class LUVerifyCluster(LogicalUnit):
# secondary. # secondary.
"sinst-by-pnode": {}, "sinst-by-pnode": {},
} }
# FIXME: devise a free space model for file based instances as well
if vg_name is not None:
node_info[node]["dfree"] = int(nresult[constants.NV_VGLIST][vg_name])
except ValueError: except ValueError:
feedback_fn(" - ERROR: invalid value returned from node %s" % (node,)) feedback_fn(" - ERROR: invalid value returned from node %s" % (node,))
bad = True bad = True
......
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