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(): ...@@ -550,9 +550,8 @@ def NodeVolumes():
"--separator=|", "--separator=|",
"--options=lv_name,lv_size,devices,vg_name"]) "--options=lv_name,lv_size,devices,vg_name"])
if result.failed: if result.failed:
logging.error("Failed to list logical volumes, lvs output: %s", _Fail("Failed to list logical volumes, lvs output: %s",
result.output) result.output)
return []
def parse_dev(dev): def parse_dev(dev):
if '(' in dev: if '(' in dev:
...@@ -568,8 +567,9 @@ def NodeVolumes(): ...@@ -568,8 +567,9 @@ def NodeVolumes():
'vg': line[3].strip(), 'vg': line[3].strip(),
} }
return [map_line(line.split('|')) for line in result.stdout.splitlines() return True, [map_line(line.split('|'))
if line.count('|') >= 3] for line in result.stdout.splitlines()
if line.count('|') >= 3]
def BridgesExist(bridges_list): def BridgesExist(bridges_list):
......
...@@ -2129,10 +2129,15 @@ class LUQueryNodeVolumes(NoHooksLU): ...@@ -2129,10 +2129,15 @@ class LUQueryNodeVolumes(NoHooksLU):
output = [] output = []
for node in nodenames: 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 continue
node_vols = volumes[node].data[:] node_vols = nresult.payload[:]
node_vols.sort(key=lambda vol: vol['dev']) node_vols.sort(key=lambda vol: vol['dev'])
for vol in node_vols: 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