Revision 1d870e0d lib/cmdlib/common.py
b/lib/cmdlib/common.py | ||
---|---|---|
82 | 82 |
errors.ECODE_STATE) |
83 | 83 |
|
84 | 84 |
return wanted_instances |
85 |
|
|
86 |
|
|
87 |
def _GetWantedNodes(lu, nodes): |
|
88 |
"""Returns list of checked and expanded node names. |
|
89 |
|
|
90 |
@type lu: L{LogicalUnit} |
|
91 |
@param lu: the logical unit on whose behalf we execute |
|
92 |
@type nodes: list |
|
93 |
@param nodes: list of node names or None for all nodes |
|
94 |
@rtype: list |
|
95 |
@return: the list of nodes, sorted |
|
96 |
@raise errors.ProgrammerError: if the nodes parameter is wrong type |
|
97 |
|
|
98 |
""" |
|
99 |
if nodes: |
|
100 |
return [_ExpandNodeName(lu.cfg, name) for name in nodes] |
|
101 |
|
|
102 |
return utils.NiceSort(lu.cfg.GetNodeList()) |
|
103 |
|
|
104 |
|
|
105 |
def _GetWantedInstances(lu, instances): |
|
106 |
"""Returns list of checked and expanded instance names. |
|
107 |
|
|
108 |
@type lu: L{LogicalUnit} |
|
109 |
@param lu: the logical unit on whose behalf we execute |
|
110 |
@type instances: list |
|
111 |
@param instances: list of instance names or None for all instances |
|
112 |
@rtype: list |
|
113 |
@return: the list of instances, sorted |
|
114 |
@raise errors.OpPrereqError: if the instances parameter is wrong type |
|
115 |
@raise errors.OpPrereqError: if any of the passed instances is not found |
|
116 |
|
|
117 |
""" |
|
118 |
if instances: |
|
119 |
wanted = [_ExpandInstanceName(lu.cfg, name) for name in instances] |
|
120 |
else: |
|
121 |
wanted = utils.NiceSort(lu.cfg.GetInstanceList()) |
|
122 |
return wanted |
Also available in: Unified diff