Revision 3312b702
b/lib/cmdlib.py | ||
---|---|---|
171 | 171 |
nodes: List of nodes (strings) or None for all |
172 | 172 |
|
173 | 173 |
""" |
174 |
if nodes is not None and not isinstance(nodes, list):
|
|
174 |
if not isinstance(nodes, list): |
|
175 | 175 |
raise errors.OpPrereqError("Invalid argument type 'nodes'") |
176 | 176 |
|
177 | 177 |
if nodes: |
178 |
wanted_nodes = []
|
|
178 |
wanted = [] |
|
179 | 179 |
|
180 | 180 |
for name in nodes: |
181 | 181 |
node = lu.cfg.GetNodeInfo(lu.cfg.ExpandNodeName(name)) |
182 | 182 |
if node is None: |
183 | 183 |
raise errors.OpPrereqError("No such node name '%s'" % name) |
184 |
wanted_nodes.append(node)
|
|
184 |
wanted.append(node)
|
|
185 | 185 |
|
186 |
return wanted_nodes |
|
187 | 186 |
else: |
188 |
return [lu.cfg.GetNodeInfo(name) for name in lu.cfg.GetNodeList()] |
|
187 |
wanted = [lu.cfg.GetNodeInfo(name) for name in lu.cfg.GetNodeList()] |
|
188 |
return wanted |
|
189 |
|
|
190 |
|
|
191 |
def _GetWantedInstances(lu, instances): |
|
192 |
"""Returns list of checked and expanded instances. |
|
193 |
|
|
194 |
Args: |
|
195 |
instances: List of instances (strings) or None for all |
|
196 |
|
|
197 |
""" |
|
198 |
if not isinstance(instances, list): |
|
199 |
raise errors.OpPrereqError("Invalid argument type 'instances'") |
|
200 |
|
|
201 |
if instances: |
|
202 |
wanted = [] |
|
203 |
|
|
204 |
for name in instances: |
|
205 |
instance = lu.cfg.GetInstanceInfo(lu.cfg.ExpandInstanceName(name)) |
|
206 |
if instance is None: |
|
207 |
raise errors.OpPrereqError("No such instance name '%s'" % name) |
|
208 |
wanted.append(instance) |
|
209 |
|
|
210 |
else: |
|
211 |
wanted = [lu.cfg.GetInstanceInfo(name) |
|
212 |
for name in lu.cfg.GetInstanceList()] |
|
213 |
return wanted |
|
189 | 214 |
|
190 | 215 |
|
191 | 216 |
def _CheckOutputFields(static, dynamic, selected): |
Also available in: Unified diff