Revision 35705d8f lib/cmdlib.py
b/lib/cmdlib.py | ||
---|---|---|
1366 | 1366 |
|
1367 | 1367 |
""" |
1368 | 1368 |
_OP_REQP = ["output_fields", "names"] |
1369 |
REQ_BGL = False |
|
1369 | 1370 |
|
1370 |
def CheckPrereq(self): |
|
1371 |
"""Check prerequisites. |
|
1372 |
|
|
1373 |
This checks that the fields required are valid output fields. |
|
1374 |
|
|
1375 |
""" |
|
1371 |
def ExpandNames(self): |
|
1376 | 1372 |
self.dynamic_fields = frozenset([ |
1377 | 1373 |
"dtotal", "dfree", |
1378 | 1374 |
"mtotal", "mnode", "mfree", |
... | ... | |
1386 | 1382 |
dynamic=self.dynamic_fields, |
1387 | 1383 |
selected=self.op.output_fields) |
1388 | 1384 |
|
1389 |
self.wanted = _GetWantedNodes(self, self.op.names) |
|
1385 |
self.needed_locks = {} |
|
1386 |
self.share_locks[locking.LEVEL_NODE] = 1 |
|
1387 |
# TODO: we could lock nodes only if the user asked for dynamic fields. For |
|
1388 |
# that we need atomic ways to get info for a group of nodes from the |
|
1389 |
# config, though. |
|
1390 |
if not self.op.names: |
|
1391 |
self.needed_locks[locking.LEVEL_NODE] = None |
|
1392 |
else: |
|
1393 |
self.needed_locks[locking.LEVEL_NODE] = \ |
|
1394 |
_GetWantedNodes(self, self.op.names) |
|
1395 |
|
|
1396 |
def CheckPrereq(self): |
|
1397 |
"""Check prerequisites. |
|
1398 |
|
|
1399 |
""" |
|
1400 |
# This of course is valid only if we locked the nodes |
|
1401 |
self.wanted = self.needed_locks[locking.LEVEL_NODE] |
|
1390 | 1402 |
|
1391 | 1403 |
def Exec(self, feedback_fn): |
1392 | 1404 |
"""Computes the list of nodes and their attributes. |
Also available in: Unified diff