Commit 9a198532 authored by Iustin Pop's avatar Iustin Pop
Browse files

Prevent errors when xenvg is broken cluster verify

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.

Reviewed-by: ultrotter
parent 949bdabe
......@@ -1073,9 +1073,17 @@ class LUVerifyCluster(LogicalUnit):
# 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
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
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