Revision 620a85fd lib/utils.py
b/lib/utils.py | ||
---|---|---|
1890 | 1890 |
return BytesToMebibyte(size) |
1891 | 1891 |
|
1892 | 1892 |
|
1893 |
def GetFreeFilesystemSpace(path):
|
|
1894 |
"""Returns the free space on a filesystem. |
|
1893 |
def GetFilesystemStats(path):
|
|
1894 |
"""Returns the total and free space on a filesystem.
|
|
1895 | 1895 |
|
1896 | 1896 |
@type path: string |
1897 | 1897 |
@param path: Path on filesystem to be examined |
1898 | 1898 |
@rtype: int |
1899 |
@return: Free space in mebibytes
|
|
1899 |
@return: tuple of (Total space, Free space) in mebibytes
|
|
1900 | 1900 |
|
1901 | 1901 |
""" |
1902 | 1902 |
st = os.statvfs(path) |
1903 | 1903 |
|
1904 |
return BytesToMebibyte(st.f_bavail * st.f_frsize) |
|
1904 |
fsize = BytesToMebibyte(st.f_bavail * st.f_frsize) |
|
1905 |
tsize = BytesToMebibyte(st.f_blocks * st.f_frsize) |
|
1906 |
return (tsize, fsize) |
|
1905 | 1907 |
|
1906 | 1908 |
|
1907 | 1909 |
def LockedMethod(fn): |
Also available in: Unified diff