Revision 13669ecd
b/lib/backend.py | ||
---|---|---|
56 | 56 |
from ganeti import constants |
57 | 57 |
from ganeti.storage import bdev |
58 | 58 |
from ganeti.storage import drbd |
59 |
from ganeti.storage import filestorage |
|
59 | 60 |
from ganeti import objects |
60 | 61 |
from ganeti import ssconf |
61 | 62 |
from ganeti import serializer |
... | ... | |
693 | 694 |
return (bootid, storage_info, hv_info) |
694 | 695 |
|
695 | 696 |
|
697 |
# pylint: disable=W0613 |
|
698 |
def _GetFileStorageSpaceInfo(path, *args): |
|
699 |
"""Wrapper around filestorage.GetSpaceInfo. |
|
700 |
|
|
701 |
The purpose of this wrapper is to call filestorage.GetFileStorageSpaceInfo |
|
702 |
and ignore the *args parameter to not leak it into the filestorage |
|
703 |
module's code. |
|
704 |
|
|
705 |
@see: C{filestorage.GetFileStorageSpaceInfo} for description of the |
|
706 |
parameters. |
|
707 |
|
|
708 |
""" |
|
709 |
return filestorage.GetFileStorageSpaceInfo(path) |
|
710 |
|
|
711 |
|
|
696 | 712 |
# FIXME: implement storage reporting for all missing storage types. |
697 | 713 |
_STORAGE_TYPE_INFO_FN = { |
698 | 714 |
constants.ST_BLOCK: None, |
699 | 715 |
constants.ST_DISKLESS: None, |
700 | 716 |
constants.ST_EXT: None, |
701 |
constants.ST_FILE: None,
|
|
717 |
constants.ST_FILE: _GetFileStorageSpaceInfo,
|
|
702 | 718 |
constants.ST_LVM_PV: _GetVgSpindlesInfo, |
703 | 719 |
constants.ST_LVM_VG: _GetVgInfo, |
704 | 720 |
constants.ST_RADOS: None, |
b/lib/storage/filestorage.py | ||
---|---|---|
25 | 25 |
|
26 | 26 |
import os |
27 | 27 |
|
28 |
from ganeti import constants |
|
28 | 29 |
from ganeti import errors |
29 | 30 |
|
30 | 31 |
|
... | ... | |
42 | 43 |
result = os.statvfs(path) |
43 | 44 |
free = (result.f_frsize * result.f_bavail) / (1024 * 1024) |
44 | 45 |
size = (result.f_frsize * result.f_blocks) / (1024 * 1024) |
45 |
return {"vg_size": size, "vg_free": free} |
|
46 |
return {"type": constants.ST_FILE, |
|
47 |
"name": path, |
|
48 |
"vg_size": size, |
|
49 |
"vg_free": free} |
|
46 | 50 |
except OSError, e: |
47 | 51 |
raise errors.CommandError("Failed to retrieve file system information about" |
48 | 52 |
" path: %s - %s" % (path, e.strerror)) |
Also available in: Unified diff