diff --git a/daemons/ganeti-noded b/daemons/ganeti-noded index 96a642bd3a26e95eda8f17f3707c42d8229b7768..0678d114d169bcab42547d06185f8d7b6f43ce82 100755 --- a/daemons/ganeti-noded +++ b/daemons/ganeti-noded @@ -339,7 +339,7 @@ class NodeHttpServer(http.server.HttpServer): """ vgname = params[0] - return backend.GetVolumeList(vgname) + return True, backend.GetVolumeList(vgname) @staticmethod def perspective_vg_list(params): diff --git a/lib/backend.py b/lib/backend.py index b06e1f62b07cb8560a8d782dac0f3a38db7d059f..1d6572908f4f875f7b44700533f3d4839c2682cf 100644 --- a/lib/backend.py +++ b/lib/backend.py @@ -494,9 +494,7 @@ def GetVolumeList(vg_name): "--separator=%s" % sep, "-olv_name,lv_size,lv_attr", vg_name]) if result.failed: - logging.error("Failed to list logical volumes, lvs output: %s", - result.output) - return result.output + _Fail("Failed to list logical volumes, lvs output: %s", result.output) valid_line_re = re.compile("^ *([^|]+)\|([0-9.]+)\|([^|]{6})\|?$") for line in result.stdout.splitlines(): diff --git a/lib/cmdlib.py b/lib/cmdlib.py index 28e4abfad5ef7b473975243cc73a66657045c163..c4a13b9ae0ece0d26703fa6b2f1a9a44983a967a 100644 --- a/lib/cmdlib.py +++ b/lib/cmdlib.py @@ -1289,8 +1289,13 @@ class LUVerifyDisks(NoHooksLU): def Exec(self, feedback_fn): """Verify integrity of cluster disks. + @rtype: tuple of three items + @return: a tuple of (dict of node-to-node_error, list of instances + which need activate-disks, dict of instance: (node, volume) for + missing volumes + """ - result = res_nodes, res_nlvm, res_instances, res_missing = [], {}, [], {} + result = res_nodes, res_instances, res_missing = {}, [], {} vg_name = self.cfg.GetVGName() nodes = utils.NiceSort(self.cfg.GetNodeList()) @@ -1317,24 +1322,17 @@ class LUVerifyDisks(NoHooksLU): to_act = set() for node in nodes: # node_volume - lvs = node_lvs[node] - if lvs.failed: - if not lvs.offline: - self.LogWarning("Connection to node %s failed: %s" % - (node, lvs.data)) - continue - lvs = lvs.data - if isinstance(lvs, basestring): - logging.warning("Error enumerating LVs on node %s: %s", node, lvs) - res_nlvm[node] = lvs + node_res = node_lvs[node] + if node_res.offline: continue - elif not isinstance(lvs, dict): - logging.warning("Connection to node %s failed or invalid data" - " returned", node) - res_nodes.append(node) + msg = node_res.RemoteFailMsg() + if msg: + logging.warning("Error enumerating LVs on node %s: %s", node, msg) + res_nodes[node] = msg continue - for lv_name, (_, lv_inactive, lv_online) in lvs.iteritems(): + lvs = node_res.payload + for lv_name, (_, lv_inactive, lv_online) in lvs.items(): inst = nv_dict.pop((node, lv_name), None) if (not lv_online and inst is not None and inst.name not in res_instances): diff --git a/scripts/gnt-cluster b/scripts/gnt-cluster index 15e0ce9e148bf5f474a9b859e3ddc3f27bbc32a6..505ffa2187a01b55ecee379dd8a0ae5a44eae718 100755 --- a/scripts/gnt-cluster +++ b/scripts/gnt-cluster @@ -361,20 +361,16 @@ def VerifyDisks(opts, args): """ op = opcodes.OpVerifyDisks() result = SubmitOpCode(op) - if not isinstance(result, (list, tuple)) or len(result) != 4: + if not isinstance(result, (list, tuple)) or len(result) != 3: raise errors.ProgrammerError("Unknown result type for OpVerifyDisks") - nodes, nlvm, instances, missing = result + bad_nodes, instances, missing = result - if nodes: - ToStdout("Nodes unreachable or with bad data:") - for name in nodes: - ToStdout("\t%s", name) retcode = constants.EXIT_SUCCESS - if nlvm: - for node, text in nlvm.iteritems(): - ToStdout("Error on node %s: LVM error: %s", + if bad_nodes: + for node, text in bad_nodes.items(): + ToStdout("Error gathering data on node %s: %s", node, utils.SafeEncode(text[-400:])) retcode |= 1 ToStdout("You need to fix these nodes first before fixing instances") @@ -394,7 +390,7 @@ def VerifyDisks(opts, args): if missing: for iname, ival in missing.iteritems(): - all_missing = utils.all(ival, lambda x: x[0] in nlvm) + all_missing = utils.all(ival, lambda x: x[0] in bad_nodes) if all_missing: ToStdout("Instance %s cannot be verified as it lives on" " broken nodes", iname) @@ -402,7 +398,7 @@ def VerifyDisks(opts, args): ToStdout("Instance %s has missing logical volumes:", iname) ival.sort() for node, vol in ival: - if node in nlvm: + if node in bad_nodes: ToStdout("\tbroken node %s /dev/xenvg/%s", node, vol) else: ToStdout("\t%s /dev/xenvg/%s", node, vol)