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

node evac: don't call IAllocator if no instances



Currently we generate an empty list only for the '-n node' invocation,
but for iallocator we still call the iallocator (which needs an RPC
call, etc.). By moving the computation of instances outside of the if
block, we can return early from the LU.
Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarMichael Hanselmann <hansmi@google.com>
parent 9a914f7a
......@@ -8848,10 +8848,13 @@ class LUNodeEvacStrategy(NoHooksLU):
locks[locking.LEVEL_NODE] = self.op.nodes + [self.op.remote_node]
def Exec(self, feedback_fn):
instances = []
for node in self.op.nodes:
instances.extend(_GetNodeSecondaryInstances(self.cfg, node))
if not instances:
return []
if self.op.remote_node is not None:
instances = []
for node in self.op.nodes:
instances.extend(_GetNodeSecondaryInstances(self.cfg, node))
result = []
for i in instances:
if i.primary_node == self.op.remote_node:
......
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