Commit e480923b authored by Iustin Pop's avatar Iustin Pop
Browse files

Convert vg_list rpc to new style result



This doesn't have known failure modes but converting will help later.

We also now call directly utils.ListVolumeGroups() instead of the
backend.ListVolumeGroups() so that we don't have to undo the (status,
value) result type.
Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarGuido Trotter <ultrotter@google.com>
parent 29d376ec
......@@ -451,7 +451,7 @@ def VerifyNode(what, cluster_name):
what[constants.NV_INSTANCELIST])
if constants.NV_VGLIST in what:
result[constants.NV_VGLIST] = ListVolumeGroups()
result[constants.NV_VGLIST] = utils.ListVolumeGroups()
if constants.NV_VERSION in what:
result[constants.NV_VERSION] = (constants.PROTOCOL_VERSION,
......@@ -519,7 +519,7 @@ def ListVolumeGroups():
size of the volume
"""
return utils.ListVolumeGroups()
return True, utils.ListVolumeGroups()
def NodeVolumes():
......
......@@ -1510,11 +1510,13 @@ class LUSetClusterParams(LogicalUnit):
if self.op.vg_name:
vglist = self.rpc.call_vg_list(node_list)
for node in node_list:
if vglist[node].failed:
msg = vglist[node].RemoteFailMsg()
if msg:
# ignoring down node
self.LogWarning("Node %s unreachable/error, ignoring" % node)
self.LogWarning("Error while gathering data on node %s"
" (ignoring node): %s", node, msg)
continue
vgstatus = utils.CheckVolumeGroupSize(vglist[node].data,
vgstatus = utils.CheckVolumeGroupSize(vglist[node].payload,
self.op.vg_name,
constants.MIN_VG_SIZE)
if vgstatus:
......@@ -5226,7 +5228,10 @@ class LUReplaceDisks(LogicalUnit):
raise errors.OpExecError("Can't list volume groups on the nodes")
for node in oth_node, tgt_node:
res = results[node]
if res.failed or not res.data or my_vg not in res.data:
msg = res.RemoteFailMsg()
if msg:
raise errors.OpExecError("Error checking node %s: %s" % (node, msg))
if my_vg not in res.payload:
raise errors.OpExecError("Volume group '%s' not found on %s" %
(my_vg, node))
for idx, dev in enumerate(instance.disks):
......@@ -5422,7 +5427,10 @@ class LUReplaceDisks(LogicalUnit):
results = self.rpc.call_vg_list([pri_node, new_node])
for node in pri_node, new_node:
res = results[node]
if res.failed or not res.data or my_vg not in res.data:
msg = res.RemoteFailMsg()
if msg:
raise errors.OpExecError("Error checking node %s: %s" % (node, msg))
if my_vg not in res.payload:
raise errors.OpExecError("Volume group '%s' not found on %s" %
(my_vg, node))
for idx, dev in enumerate(instance.disks):
......
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