Commit 04df3c7c authored by Michael Hanselmann's avatar Michael Hanselmann
Browse files

cmdlib: Sort nodes for OOB commands



Also reorder the methods to match all other LUs.
Signed-off-by: default avatarMichael Hanselmann <hansmi@google.com>
Reviewed-by: default avatarIustin Pop <iustin@google.com>
parent 7ee045a0
......@@ -3426,6 +3426,20 @@ class LUOobCommand(NoHooksLU):
REG_BGL = False
_SKIP_MASTER = (constants.OOB_POWER_OFF, constants.OOB_POWER_CYCLE)
def ExpandNames(self):
"""Gather locks we need.
"""
if self.op.node_names:
self.op.node_names = _GetWantedNodes(self, self.op.node_names)
lock_names = self.op.node_names
else:
lock_names = locking.ALL_SET
self.needed_locks = {
locking.LEVEL_NODE: lock_names,
}
def CheckPrereq(self):
"""Check prerequisites.
......@@ -3482,20 +3496,6 @@ class LUOobCommand(NoHooksLU):
" not marked offline") % node_name,
errors.ECODE_STATE)
def ExpandNames(self):
"""Gather locks we need.
"""
if self.op.node_names:
self.op.node_names = _GetWantedNodes(self, self.op.node_names)
lock_names = self.op.node_names
else:
lock_names = locking.ALL_SET
self.needed_locks = {
locking.LEVEL_NODE: lock_names,
}
def Exec(self, feedback_fn):
"""Execute OOB and return result if we expect any.
......@@ -3503,7 +3503,8 @@ class LUOobCommand(NoHooksLU):
master_node = self.master_node
ret = []
for idx, node in enumerate(self.nodes):
for idx, node in enumerate(utils.NiceSort(self.nodes,
key=lambda node: node.name)):
node_entry = [(constants.RS_NORMAL, node.name)]
ret.append(node_entry)
......
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