Commit 89e5ab02 authored by Iustin Pop's avatar Iustin Pop
Browse files

Fix node volumes list for stripped volumes



Currently backend.NodeVolumes() drops everything except the first PV,
thus we get a truncated result. The patch is not the nicest, as Python
doesn't have a simple `concat' function, so I had to change the list
comprehension to an explicit loop.
Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarMichael Hanselmann <hansmi@google.com>
parent 6d7b472a
......@@ -650,21 +650,23 @@ def NodeVolumes():
result.output)
def parse_dev(dev):
if '(' in dev:
return dev.split('(')[0]
else:
return dev
return dev.split('(')[0]
def handle_dev(dev):
return [parse_dev(x) for x in dev.split(",")]
def map_line(line):
return {
'name': line[0].strip(),
'size': line[1].strip(),
'dev': parse_dev(line[2].strip()),
'vg': line[3].strip(),
}
return [map_line(line.split('|')) for line in result.stdout.splitlines()
if line.count('|') >= 3]
line = [v.strip() for v in line]
return [{'name': line[0], 'size': line[1],
'dev': dev, 'vg': line[3]} for dev in handle_dev(line[2])]
all_devs = []
for line in result.stdout.splitlines():
if line.count('|') >= 3:
all_devs.extend(map_line(line.split('|')))
else:
logging.warning("Strange line in the output from lvs: '%s'", line)
return all_devs
def BridgesExist(bridges_list):
......
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