Revision b01b7a50 lib/backend.py
b/lib/backend.py | ||
---|---|---|
573 | 573 |
raise errors.QuitGanetiException(True, "Shutdown scheduled") |
574 | 574 |
|
575 | 575 |
|
576 |
def _CheckStorageParams(params, num_params): |
|
577 |
"""Performs sanity checks for storage parameters. |
|
578 |
|
|
579 |
@type params: list |
|
580 |
@param params: list of storage parameters |
|
581 |
@type num_params: int |
|
582 |
@param num_params: expected number of parameters |
|
583 |
|
|
584 |
""" |
|
585 |
if params is None: |
|
586 |
raise errors.ProgrammerError("No storage parameters for storage" |
|
587 |
" reporting is provided.") |
|
588 |
if not isinstance(params, list): |
|
589 |
raise errors.ProgrammerError("The storage parameters are not of type" |
|
590 |
" list: '%s'" % params) |
|
591 |
if not len(params) == num_params: |
|
592 |
raise errors.ProgrammerError("Did not receive the expected number of" |
|
593 |
"storage parameters: expected %s," |
|
594 |
" received '%s'" % (num_params, len(params))) |
|
595 |
|
|
596 |
|
|
576 | 597 |
def _GetLvmVgSpaceInfo(name, params): |
577 | 598 |
"""Wrapper around C{_GetVgInfo} which checks the storage parameters. |
578 | 599 |
|
... | ... | |
583 | 604 |
containing only one for exclusive storage |
584 | 605 |
|
585 | 606 |
""" |
586 |
if params is None: |
|
587 |
raise errors.ProgrammerError("No storage parameter for LVM vg storage" |
|
588 |
" reporting is provided.") |
|
589 |
if not isinstance(params, list): |
|
590 |
raise errors.ProgrammerError("The storage parameters are not of type" |
|
591 |
" list: '%s'" % params) |
|
592 |
if not len(params) == 1: |
|
593 |
raise errors.ProgrammerError("Received more than one storage parameter:" |
|
594 |
" '%s'" % params) |
|
607 |
_CheckStorageParams(params, 1) |
|
595 | 608 |
excl_stor = bool(params[0]) |
596 | 609 |
return _GetVgInfo(name, excl_stor) |
597 | 610 |
|
... | ... | |
715 | 728 |
return (bootid, storage_info, hv_info) |
716 | 729 |
|
717 | 730 |
|
718 |
# pylint: disable=W0613 |
|
719 |
def _GetFileStorageSpaceInfo(path, *args): |
|
731 |
def _GetFileStorageSpaceInfo(path, params): |
|
720 | 732 |
"""Wrapper around filestorage.GetSpaceInfo. |
721 | 733 |
|
722 | 734 |
The purpose of this wrapper is to call filestorage.GetFileStorageSpaceInfo |
... | ... | |
727 | 739 |
parameters. |
728 | 740 |
|
729 | 741 |
""" |
742 |
_CheckStorageParams(params, 0) |
|
730 | 743 |
return filestorage.GetFileStorageSpaceInfo(path) |
731 | 744 |
|
732 | 745 |
|
Also available in: Unified diff