Revision 4a72cc75
b/lib/cmdlib.py | ||
---|---|---|
3308 | 3308 |
return result |
3309 | 3309 |
|
3310 | 3310 |
|
3311 |
class LUQueryNodeData(NoHooksLU): |
|
3312 |
"""Logical unit for querying node data. |
|
3313 |
|
|
3314 |
""" |
|
3315 |
_OP_REQP = ["nodes"] |
|
3316 |
|
|
3317 |
def CheckPrereq(self): |
|
3318 |
"""Check prerequisites. |
|
3319 |
|
|
3320 |
This only checks the optional node list against the existing names. |
|
3321 |
|
|
3322 |
""" |
|
3323 |
self.wanted_nodes = _GetWantedNodes(self, self.op.nodes) |
|
3324 |
|
|
3325 |
def Exec(self, feedback_fn): |
|
3326 |
"""Compute and return the list of nodes. |
|
3327 |
|
|
3328 |
""" |
|
3329 |
ilist = [self.cfg.GetInstanceInfo(iname) for iname |
|
3330 |
in self.cfg.GetInstanceList()] |
|
3331 |
result = [] |
|
3332 |
for node in [self.cfg.GetNodeInfo(name) for name in self.wanted_nodes]: |
|
3333 |
result.append((node.name, node.primary_ip, node.secondary_ip, |
|
3334 |
[inst.name for inst in ilist |
|
3335 |
if inst.primary_node == node.name], |
|
3336 |
[inst.name for inst in ilist |
|
3337 |
if node.name in inst.secondary_nodes], |
|
3338 |
)) |
|
3339 |
return result |
|
3340 |
|
|
3341 |
|
|
3342 | 3311 |
class LUSetInstanceParms(LogicalUnit): |
3343 | 3312 |
"""Modifies an instances's parameters. |
3344 | 3313 |
|
b/lib/mcpu.py | ||
---|---|---|
52 | 52 |
# node lu |
53 | 53 |
opcodes.OpAddNode: cmdlib.LUAddNode, |
54 | 54 |
opcodes.OpQueryNodes: cmdlib.LUQueryNodes, |
55 |
opcodes.OpQueryNodeData: cmdlib.LUQueryNodeData, |
|
56 | 55 |
opcodes.OpQueryNodeVolumes: cmdlib.LUQueryNodeVolumes, |
57 | 56 |
opcodes.OpRemoveNode: cmdlib.LURemoveNode, |
58 | 57 |
# instance lu |
b/lib/opcodes.py | ||
---|---|---|
116 | 116 |
__slots__ = ["output_fields", "nodes"] |
117 | 117 |
|
118 | 118 |
|
119 |
class OpQueryNodeData(OpCode): |
|
120 |
"""Compute the node info.""" |
|
121 |
OP_ID = "OP_NODE_INFO" |
|
122 |
__slots__ = ["nodes"] |
|
123 |
|
|
124 |
|
|
125 | 119 |
class OpQueryNodeVolumes(OpCode): |
126 | 120 |
"""Get list of volumes on node.""" |
127 | 121 |
OP_ID = "OP_NODE_QUERYVOLS" |
b/scripts/gnt-node | ||
---|---|---|
91 | 91 |
"""Show node information. |
92 | 92 |
|
93 | 93 |
""" |
94 |
op = opcodes.OpQueryNodeData(nodes=args) |
|
94 |
op = opcodes.OpQueryNodes(output_fields=["name", "pip", "sip", |
|
95 |
"pinst_list", "sinst_list"], |
|
96 |
nodes=args) |
|
95 | 97 |
result = SubmitOpCode(op) |
96 | 98 |
|
97 | 99 |
for name, primary_ip, secondary_ip, pinst, sinst in result: |
Also available in: Unified diff