diff --git a/lib/backend.py b/lib/backend.py index 8b6291a0ad23d4b5d040b10bb5da530c85a79702..007852dd0ef4385f3cdc0440399eceb66236759e 100644 --- a/lib/backend.py +++ b/lib/backend.py @@ -491,20 +491,32 @@ def _GetVGInfo(vg_name): vg_free is the free size of the volume group in MiB pv_count are the number of physical disks in that vg + If an error occurs during gathering of data, we return the same dict + with keys all set to None. + """ + retdic = dict.fromkeys(["vg_size", "vg_free", "pv_count"]) + retval = utils.RunCmd(["vgs", "-ovg_size,vg_free,pv_count", "--noheadings", "--nosuffix", "--units=m", "--separator=:", vg_name]) if retval.failed: errmsg = "volume group %s not present" % vg_name logger.Error(errmsg) - raise errors.LVMError(errmsg) + return retdic valarr = retval.stdout.strip().split(':') - retdic = { - "vg_size": int(round(float(valarr[0]), 0)), - "vg_free": int(round(float(valarr[1]), 0)), - "pv_count": int(valarr[2]), - } + if len(valarr) == 3: + try: + retdic = { + "vg_size": int(round(float(valarr[0]), 0)), + "vg_free": int(round(float(valarr[1]), 0)), + "pv_count": int(valarr[2]), + } + except ValueError, err: + logger.Error("Fail to parse vgs output: %s" % str(err)) + else: + logger.Error("vgs output has the wrong number of fields (expected" + " three): %s" % str(valarr)) return retdic diff --git a/lib/constants.py b/lib/constants.py index 3b764e261160a5ebbf8cb4e88183c072ce1fa8e4..de40522b261d1cfcaf3948615bf54d065c018f1e 100644 --- a/lib/constants.py +++ b/lib/constants.py @@ -25,7 +25,7 @@ from ganeti import _autoconf # various versions CONFIG_VERSION = 3 -PROTOCOL_VERSION = 10 +PROTOCOL_VERSION = 11 RELEASE_VERSION = _autoconf.PACKAGE_VERSION OS_API_VERSION = 5 EXPORT_VERSION = 0