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

Remove RpcResult.failed attribute



It's redundant with RpcResult.fail_msg. This change survived QA, burnin and
unittests.
Signed-off-by: default avatarMichael Hanselmann <hansmi@google.com>
Reviewed-by: default avatarIustin Pop <iustin@google.com>
parent efbb4fd2
......@@ -1601,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 or result.fail_msg:
if result.RemoteFailMsg():
self.LogWarning("Failure in blockdev_getsizes call to node"
" %s, ignoring", node)
continue
......@@ -4037,7 +4037,7 @@ class LUQueryInstances(NoHooksLU):
if result.offline:
# offline nodes will be in both lists
off_nodes.append(name)
if result.failed or result.fail_msg:
if result.RemoteFailMsg():
bad_nodes.append(name)
else:
if result.payload:
......
......@@ -83,9 +83,6 @@ class RpcResult(object):
failed, and therefore we use this class to encapsulate the result.
@ivar data: the data payload, for successful results, or None
@type failed: boolean
@ivar failed: whether the operation failed at transport level (not
application level on the remote node)
@ivar call: the name of the RPC call
@ivar node: the name of the node to which we made the call
@ivar offline: whether the operation failed because the node was
......@@ -97,12 +94,10 @@ class RpcResult(object):
"""
def __init__(self, data=None, failed=False, offline=False,
call=None, node=None):
self.failed = failed
self.offline = offline
self.call = call
self.node = node
if offline:
self.failed = True
self.fail_msg = "Node is marked offline"
self.data = self.payload = None
elif failed:
......@@ -111,15 +106,12 @@ 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
......@@ -813,7 +805,7 @@ class RpcRunner(object):
"""
result = self._SingleNodeCall(node, "blockdev_getmirrorstatus",
[dsk.ToDict() for dsk in disks])
if not (result.failed or result.fail_msg):
if not result.fail_msg:
result.payload = [objects.BlockDevStatus.FromDict(i)
for i in result.payload]
return result
......@@ -825,7 +817,7 @@ class RpcRunner(object):
"""
result = self._SingleNodeCall(node, "blockdev_find", [disk.ToDict()])
if not result.failed and result.payload is not None:
if not result.fail_msg and result.payload is not None:
result.payload = objects.BlockDevStatus.FromDict(result.payload)
return result
......@@ -926,7 +918,7 @@ class RpcRunner(object):
"""
result = self._SingleNodeCall(node, "os_get", [name])
if not result.failed and isinstance(result.data, dict):
if not result.fail_msg and isinstance(result.data, dict):
result.data = objects.OS.FromDict(result.data)
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