Revision 5ae7cd11 lib/storage.py
b/lib/storage.py | ||
---|---|---|
332 | 332 |
yield fields |
333 | 333 |
|
334 | 334 |
|
335 |
def _LvmPvGetAllocatable(attr): |
|
336 |
"""Determines whether LVM PV is allocatable. |
|
337 |
|
|
338 |
@rtype: bool |
|
339 |
|
|
340 |
""" |
|
341 |
if attr: |
|
342 |
return (attr[0] == "a") |
|
343 |
else: |
|
344 |
logging.warning("Invalid PV attribute: %r", attr) |
|
345 |
return False |
|
346 |
|
|
347 |
|
|
335 | 348 |
class LvmPvStorage(_LvmBase): # pylint: disable-msg=W0223 |
336 | 349 |
"""LVM Physical Volume storage unit. |
337 | 350 |
|
338 | 351 |
""" |
339 |
@staticmethod |
|
340 |
def _GetAllocatable(attr): |
|
341 |
if attr: |
|
342 |
return (attr[0] == "a") |
|
343 |
else: |
|
344 |
logging.warning("Invalid PV attribute: %r", attr) |
|
345 |
return False |
|
346 |
|
|
347 | 352 |
LIST_COMMAND = "pvs" |
348 | 353 |
|
349 | 354 |
# Make sure to update constants.VALID_STORAGE_FIELDS when changing field |
... | ... | |
353 | 358 |
(constants.SF_SIZE, ["pv_size"], _ParseSize), |
354 | 359 |
(constants.SF_USED, ["pv_used"], _ParseSize), |
355 | 360 |
(constants.SF_FREE, ["pv_free"], _ParseSize), |
356 |
(constants.SF_ALLOCATABLE, ["pv_attr"], _GetAllocatable), |
|
361 |
(constants.SF_ALLOCATABLE, ["pv_attr"], _LvmPvGetAllocatable),
|
|
357 | 362 |
] |
358 | 363 |
|
359 | 364 |
def _SetAllocatable(self, name, allocatable): |
Also available in: Unified diff