diff --git a/lib/backend.py b/lib/backend.py index f54c04191cb91e7d49a58dc23b6b1d58b6096aba..a3ec5666a008f54f72d92dd616d87daedae4f07d 100644 --- a/lib/backend.py +++ b/lib/backend.py @@ -210,19 +210,31 @@ def GetVolumeList(vg_name): """Compute list of logical volumes and their size. Returns: - dictionary of all partions (key) with their size: - test1: 20.06MiB + dictionary of all partions (key) with their size (in MiB), inactive + and online status: + {'test1': ('20.06', True, True)} """ - result = utils.RunCmd(["lvs", "--noheadings", "--units=m", - "-oname,size", vg_name]) + lvs = {} + sep = '|' + result = utils.RunCmd(["lvs", "--noheadings", "--units=m", "--nosuffix", + "--separator=%s" % sep, + "-olv_name,lv_size,lv_attr", vg_name]) if result.failed: logger.Error("Failed to list logical volumes, lvs output: %s" % result.output) - return {} - - lvlist = [line.split() for line in result.stdout.splitlines()] - return dict(lvlist) + return lvs + + for line in result.stdout.splitlines(): + line = line.strip().rstrip(sep) + name, size, attr = line.split(sep) + if len(attr) != 6: + attr = '------' + inactive = attr[4] == '-' + online = attr[5] == 'o' + lvs[name] = (size, inactive, online) + + return lvs def ListVolumeGroups(): diff --git a/lib/constants.py b/lib/constants.py index ecc6182f8c2cb8669bfa85fd068b449617140602..fc5b8859667d8c33d6aecbbdce18f3239d07f1b6 100644 --- a/lib/constants.py +++ b/lib/constants.py @@ -25,7 +25,7 @@ from ganeti import _autoconf # various versions CONFIG_VERSION = 3 -PROTOCOL_VERSION = 7 +PROTOCOL_VERSION = 8 RELEASE_VERSION = _autoconf.PACKAGE_VERSION OS_API_VERSION = 5 EXPORT_VERSION = 0