Commit 10bfe6cb authored by Iustin Pop's avatar Iustin Pop
Browse files

Convert node_volumes rpc to new style result


Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarGuido Trotter <ultrotter@google.com>
parent 0623d351
......@@ -550,9 +550,8 @@ def NodeVolumes():
"--separator=|",
"--options=lv_name,lv_size,devices,vg_name"])
if result.failed:
logging.error("Failed to list logical volumes, lvs output: %s",
_Fail("Failed to list logical volumes, lvs output: %s",
result.output)
return []
def parse_dev(dev):
if '(' in dev:
......@@ -568,7 +567,8 @@ def NodeVolumes():
'vg': line[3].strip(),
}
return [map_line(line.split('|')) for line in result.stdout.splitlines()
return True, [map_line(line.split('|'))
for line in result.stdout.splitlines()
if line.count('|') >= 3]
......
......@@ -2129,10 +2129,15 @@ class LUQueryNodeVolumes(NoHooksLU):
output = []
for node in nodenames:
if node not in volumes or volumes[node].failed or not volumes[node].data:
nresult = volumes[node]
if nresult.offline:
continue
msg = nresult.RemoteFailMsg()
if msg:
self.LogWarning("Can't compute volume data on node %s: %s", node, msg)
continue
node_vols = volumes[node].data[:]
node_vols = nresult.payload[:]
node_vols.sort(key=lambda vol: vol['dev'])
for vol in node_vols:
......
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