From fe89794e5fe6b4d45ed968307fd1c7bf0fdd7fc4 Mon Sep 17 00:00:00 2001 From: Michael Hanselmann <hansmi@google.com> Date: Wed, 9 Sep 2009 17:51:35 +0200 Subject: [PATCH] =?UTF-8?q?RpcResult:=20Fix=20cases=20where=20=E2=80=9Cfai?= =?UTF-8?q?led=E2=80=9D=20wouldn't=20be=20set=20to=20True?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This broke βgnt-instance replace-disks --autoβ when the instance is down. Signed-off-by: Michael Hanselmann <hansmi@google.com> Reviewed-by: Olivier Tharan <olive@google.com> --- lib/cmdlib.py | 3 +-- lib/rpc.py | 5 ++++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/cmdlib.py b/lib/cmdlib.py index ad4c487de..ddbc48da5 100644 --- a/lib/cmdlib.py +++ b/lib/cmdlib.py @@ -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 diff --git a/lib/rpc.py b/lib/rpc.py index 98f0f6ed6..abcec8115 100644 --- a/lib/rpc.py +++ b/lib/rpc.py @@ -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 -- GitLab