Commit fe89794e authored by Michael Hanselmann's avatar Michael Hanselmann
Browse files

RpcResult: Fix cases where “failed” wouldn't be set to True



This broke “gnt-instance replace-disks --auto” when the instance
is down.
Signed-off-by: default avatarMichael Hanselmann <hansmi@google.com>
Reviewed-by: default avatarOlivier Tharan <olive@google.com>
parent ea205dbc
......@@ -1544,7 +1544,6 @@ class LURepairDiskSizes(NoHooksLU):
REQ_BGL = False
def ExpandNames(self):
if not isinstance(self.op.instances, list):
raise errors.OpPrereqError("Invalid argument type 'instances'")
......@@ -1602,7 +1601,7 @@ class LURepairDiskSizes(NoHooksLU):
changed = []
for node, dskl in per_node_disks.items():
result = self.rpc.call_blockdev_getsizes(node, [v[2] for v in dskl])
if result.failed:
if result.failed or result.fail_msg:
self.LogWarning("Failure in blockdev_getsizes call to node"
" %s, ignoring", node)
continue
......
......@@ -111,12 +111,15 @@ class RpcResult(object):
else:
self.data = data
if not isinstance(self.data, (tuple, list)):
self.failed = True
self.fail_msg = ("RPC layer error: invalid result type (%s)" %
type(self.data))
elif len(data) != 2:
self.failed = True
self.fail_msg = ("RPC layer error: invalid result length (%d), "
"expected 2" % len(self.data))
elif not self.data[0]:
self.failed = True
self.fail_msg = self._EnsureErr(self.data[1])
else:
# finally success
......@@ -810,7 +813,7 @@ class RpcRunner(object):
"""
result = self._SingleNodeCall(node, "blockdev_getmirrorstatus",
[dsk.ToDict() for dsk in disks])
if not result.failed:
if not (result.failed or result.fail_msg):
result.payload = [objects.BlockDevStatus.FromDict(i)
for i in result.payload]
return result
......
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