When vg_name is not returned at all, we currently abort with an internal
error. This is because we don't catch KeyError.
This patch adds a custom message for this case, and also adds KeyError
to the list of catched exceptions, just for safety.
On the other hand, we could also just remove this piece of code since
it's not used at all the ["dfree"] value.
---
lib/cmdlib.py | 12 ++++++++++--
1 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/lib/cmdlib.py b/lib/cmdlib.py
index 01a8c93..b8fd0be 100644
--- a/lib/cmdlib.py
+++ b/lib/cmdlib.py
@@ -1071,13 +1071,21 @@ class LUVerifyCluster(LogicalUnit):
# secondary.
"sinst-by-pnode": {},
}
# FIXME: devise a free space model for file based instances as well
if vg_name is not None:
+ if (constants.NV_VGLIST not in nresult or
+ vg_name not in nresult[constants.NV_VGLIST]):
+ feedback_fn(" - ERROR: node %s didn't return data for the"
+ " volume group '%s' - it is either missing or broken" %
+ (node, vg_name))
+ bad = True
+ continue
node_info[node]["dfree"] = int(nresult[constants.NV_VGLIST][vg_name])
- except ValueError:
- feedback_fn(" - ERROR: invalid value returned from node %s" % (node,))
+ except (ValueError, KeyError):
+ feedback_fn(" - ERROR: invalid nodeinfo value returned"
+ " from node %s" % (node,))
bad = True
continue
node_vol_should = {}
--
1.6.2.4