Commit ea47808a authored by Guido Trotter's avatar Guido Trotter
Browse files

Prevent mistakes using _GetWantedNodes

All the users of _GetWantedNodes have been converted to be concurrent
LUs, and thus cannot call this function with an empty list of nodes
anymore. This patch makes this restriction a part of the function
itself. This prevents mistakes in new concurrent LUs, and creates more
work for new non-concurrent LUs, which we shouldn't add anyway.

Reviewed-by: iustinp
parent 21a15682
......@@ -322,17 +322,17 @@ def _GetWantedNodes(lu, nodes):
if not isinstance(nodes, list):
raise errors.OpPrereqError("Invalid argument type 'nodes'")
if nodes:
wanted = []
if not nodes:
raise errors.ProgrammerError("_GetWantedNodes should only be called with a"
" non-empty list of nodes whose name is to be expanded.")
wanted = []
for name in nodes:
node = lu.cfg.ExpandNodeName(name)
if node is None:
raise errors.OpPrereqError("No such node name '%s'" % name)
wanted.append(node)
else:
wanted = lu.cfg.GetNodeList()
return utils.NiceSort(wanted)
......
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