Revision a1860404 lib/storage/bdev.py
b/lib/storage/bdev.py | ||
---|---|---|
407 | 407 |
return data |
408 | 408 |
|
409 | 409 |
@classmethod |
410 |
def _GetRawFreePvInfo(cls, vg_name): |
|
411 |
"""Return info (size/free) about PVs. |
|
412 |
|
|
413 |
@type vg_name: string |
|
414 |
@param vg_name: VG name |
|
415 |
@rtype: tuple |
|
416 |
@return: (standard_pv_size_in_MiB, number_of_free_pvs, total_number_of_pvs) |
|
417 |
|
|
418 |
""" |
|
419 |
pvs_info = cls.GetPVInfo([vg_name]) |
|
420 |
if not pvs_info: |
|
421 |
pv_size = 0.0 |
|
422 |
free_pvs = 0 |
|
423 |
num_pvs = 0 |
|
424 |
else: |
|
425 |
pv_size = cls._GetStdPvSize(pvs_info) |
|
426 |
free_pvs = len(cls._GetEmptyPvNames(pvs_info)) |
|
427 |
num_pvs = len(pvs_info) |
|
428 |
return (pv_size, free_pvs, num_pvs) |
|
429 |
|
|
430 |
@classmethod |
|
410 | 431 |
def _GetExclusiveStorageVgFree(cls, vg_name): |
411 | 432 |
"""Return the free disk space in the given VG, in exclusive storage mode. |
412 | 433 |
|
... | ... | |
415 | 436 |
@rtype: float |
416 | 437 |
@return: free space in MiB |
417 | 438 |
""" |
418 |
pvs_info = cls.GetPVInfo([vg_name]) |
|
419 |
if not pvs_info: |
|
420 |
return 0.0 |
|
421 |
pv_size = cls._GetStdPvSize(pvs_info) |
|
422 |
num_pvs = len(cls._GetEmptyPvNames(pvs_info)) |
|
423 |
return pv_size * num_pvs |
|
439 |
(pv_size, free_pvs, _) = cls._GetRawFreePvInfo(vg_name) |
|
440 |
return pv_size * free_pvs |
|
441 |
|
|
442 |
@classmethod |
|
443 |
def GetVgSpindlesInfo(cls, vg_name): |
|
444 |
"""Get the free space info for specific VGs. |
|
445 |
|
|
446 |
@param vg_name: volume group name |
|
447 |
@rtype: tuple |
|
448 |
@return: (free_spindles, total_spindles) |
|
449 |
|
|
450 |
""" |
|
451 |
(_, free_pvs, num_pvs) = cls._GetRawFreePvInfo(vg_name) |
|
452 |
return (free_pvs, num_pvs) |
|
424 | 453 |
|
425 | 454 |
@classmethod |
426 | 455 |
def GetVGInfo(cls, vg_names, excl_stor, filter_readonly=True): |
Also available in: Unified diff