Revision 61481c52 lib/bdev.py
b/lib/bdev.py | ||
---|---|---|
699 | 699 |
return data |
700 | 700 |
|
701 | 701 |
@classmethod |
702 |
def _GetExclusiveStorageVgFree(cls, vg_name): |
|
703 |
"""Return the free disk space in the given VG, in exclusive storage mode. |
|
704 |
|
|
705 |
@type vg_name: string |
|
706 |
@param vg_name: VG name |
|
707 |
@rtype: float |
|
708 |
@return: free space in MiB |
|
709 |
""" |
|
710 |
pvs_info = cls.GetPVInfo([vg_name]) |
|
711 |
if not pvs_info: |
|
712 |
return 0.0 |
|
713 |
pv_size = cls._GetStdPvSize(pvs_info) |
|
714 |
num_pvs = len(cls._GetEmptyPvNames(pvs_info)) |
|
715 |
return pv_size * num_pvs |
|
716 |
|
|
717 |
@classmethod |
|
702 | 718 |
def GetVGInfo(cls, vg_names, excl_stor, filter_readonly=True): |
703 | 719 |
"""Get the free space info for specific VGs. |
704 | 720 |
|
... | ... | |
726 | 742 |
# (possibly) skip over vgs which are not in the right volume group(s) |
727 | 743 |
if vg_names and vg_name not in vg_names: |
728 | 744 |
continue |
745 |
# Exclusive storage needs a different concept of free space |
|
746 |
if excl_stor: |
|
747 |
es_free = cls._GetExclusiveStorageVgFree(vg_name) |
|
748 |
assert es_free <= vg_free |
|
749 |
vg_free = es_free |
|
729 | 750 |
data.append((float(vg_free), float(vg_size), vg_name)) |
730 | 751 |
|
731 | 752 |
return data |
Also available in: Unified diff