7
7
from landscape.lib.disk import get_mount_info, get_filesystem_for_path
10
# List of filesystem types to exclude when generating disk use statistics.
11
BORING_FILESYSTEMS = set(["udf", "iso9660", "fuse.gvfs-fuse-daemon",
12
"squashfs", "ecryptfs"])
10
# List of filesystem types authorized when generating disk use statistics.
11
STABLE_FILESYSTEMS = set(
12
["ext", "ext2", "ext3", "ext4", "reiserfs", "ntfs", "msdos", "dos", "vfat",
13
"xfs", "hpfs", "jfs", "ufs", "hfs", "hfsplus"])
15
16
def format_megabytes(megabytes):
40
41
main_info = get_filesystem_for_path("/home", self._mounts_file,
42
total = main_info["total-space"]
44
main_info = get_filesystem_for_path("/", self._mounts_file,
42
self._statvfs, STABLE_FILESYSTEMS)
43
if main_info is not None:
46
44
total = main_info["total-space"]
48
main_usage = "unknown"
46
root_main_info = get_filesystem_for_path(
47
"/", self._mounts_file, self._statvfs, STABLE_FILESYSTEMS)
48
if root_main_info is not None:
49
total = root_main_info["total-space"]
50
main_info = root_main_info
52
main_usage = "unknown"
54
main_usage = usage(main_info)
55
self._sysinfo.add_header("Usage of " + main_info["mount-point"],
50
main_usage = usage(main_info)
51
self._sysinfo.add_header("Usage of " + main_info["mount-point"],
58
self._sysinfo.add_header("Usage of /home", "unknown")
54
60
seen_mounts = set()
55
61
seen_devices = set()
56
infos = list(get_mount_info(self._mounts_file, self._statvfs))
62
infos = list(get_mount_info(self._mounts_file, self._statvfs,
57
64
infos.sort(key=lambda i: len(i["mount-point"]))
59
66
total = info["total-space"]