Commit f0edfcf6 removed the parsing of multi-evacuate result, but the
code went from:
if mode in (multi-evac, relocate):
…
if mode == relocate:
…
to:
if mode == relocate:
…
if mode == relocate
…
This patch simply removes the nested if.
---
lib/cmdlib.py | 23 ++++++++++-------------
1 files changed, 10 insertions(+), 13 deletions(-)
diff --git a/lib/cmdlib.py b/lib/cmdlib.py
index 70efe77..277a2aa 100644
--- a/lib/cmdlib.py
+++ b/lib/cmdlib.py
@@ -13179,26 +13179,23 @@ class IAllocator(object):
errors.ECODE_INVAL)
if self.mode == constants.IALLOCATOR_MODE_RELOC:
+ assert self.relocate_from is not None
+ assert self.required_nodes == 1
+
node2group = dict((name, ndata["group"])
for (name, ndata) in self.in_data["nodes"].items())
fn = compat.partial(self._NodesToGroups, node2group,
self.in_data["nodegroups"])
- if self.mode == constants.IALLOCATOR_MODE_RELOC:
- assert self.relocate_from is not None
- assert self.required_nodes == 1
-
- request_groups = fn(self.relocate_from)
- result_groups = fn(rdict["result"])
+ request_groups = fn(self.relocate_from)
+ result_groups = fn(rdict["result"])
- if self.success and result_groups != request_groups:
- raise errors.OpExecError("Groups of nodes returned by iallocator
(%s)"
- " differ from original groups (%s)" %
- (utils.CommaJoin(result_groups),
- utils.CommaJoin(request_groups)))
- else:
- raise errors.ProgrammerError("Unhandled mode '%s'" % self.mode)
+ if self.success and result_groups != request_groups:
+ raise errors.OpExecError("Groups of nodes returned by iallocator (%s)"
+ " differ from original groups (%s)" %
+ (utils.CommaJoin(result_groups),
+ utils.CommaJoin(request_groups)))
elif self.mode == constants.IALLOCATOR_MODE_NODE_EVAC:
assert self.evac_mode in constants.IALLOCATOR_NEVAC_MODES
--
1.7.3.1