594 |
594 |
" received '%s'" % (num_params, len(params)))
|
595 |
595 |
|
596 |
596 |
|
|
597 |
def _CheckLvmStorageParams(params):
|
|
598 |
"""Performs sanity check for the 'exclusive storage' flag.
|
|
599 |
|
|
600 |
@see: C{_CheckStorageParams}
|
|
601 |
|
|
602 |
"""
|
|
603 |
_CheckStorageParams(params, 1)
|
|
604 |
excl_stor = params[0]
|
|
605 |
if not isinstance(params[0], bool):
|
|
606 |
raise errors.ProgrammerError("Exclusive storage parameter is not"
|
|
607 |
" boolean: '%s'." % excl_stor)
|
|
608 |
return excl_stor
|
|
609 |
|
|
610 |
|
597 |
611 |
def _GetLvmVgSpaceInfo(name, params):
|
598 |
612 |
"""Wrapper around C{_GetVgInfo} which checks the storage parameters.
|
599 |
613 |
|
... | ... | |
604 |
618 |
containing only one for exclusive storage
|
605 |
619 |
|
606 |
620 |
"""
|
607 |
|
_CheckStorageParams(params, 1)
|
608 |
|
excl_stor = params[0]
|
609 |
|
if not isinstance(params[0], bool):
|
610 |
|
raise errors.ProgrammerError("Exclusive storage parameter is not"
|
611 |
|
" boolean: '%s'." % excl_stor)
|
|
621 |
excl_stor = _CheckLvmStorageParams(params)
|
612 |
622 |
return _GetVgInfo(name, excl_stor)
|
613 |
623 |
|
614 |
624 |
|
... | ... | |
633 |
643 |
}
|
634 |
644 |
|
635 |
645 |
|
|
646 |
def _GetLvmPvSpaceInfo(name, params):
|
|
647 |
"""Wrapper around C{_GetVgSpindlesInfo} with sanity checks.
|
|
648 |
|
|
649 |
@see C{_GetLvmVgSpaceInfo}
|
|
650 |
|
|
651 |
"""
|
|
652 |
excl_stor = _CheckLvmStorageParams(params)
|
|
653 |
return _GetVgSpindlesInfo(name, excl_stor)
|
|
654 |
|
|
655 |
|
636 |
656 |
def _GetVgSpindlesInfo(name, excl_stor):
|
637 |
657 |
"""Retrieves information about spindles in an LVM volume group.
|
638 |
658 |
|
... | ... | |
752 |
772 |
constants.ST_DISKLESS: None,
|
753 |
773 |
constants.ST_EXT: None,
|
754 |
774 |
constants.ST_FILE: _GetFileStorageSpaceInfo,
|
755 |
|
constants.ST_LVM_PV: _GetVgSpindlesInfo,
|
|
775 |
constants.ST_LVM_PV: _GetLvmPvSpaceInfo,
|
756 |
776 |
constants.ST_LVM_VG: _GetLvmVgSpaceInfo,
|
757 |
777 |
constants.ST_RADOS: None,
|
758 |
778 |
}
|