diff options
author | Alejandro Sirgo Rica <asirgo@soleta.eu> | 2024-09-23 13:08:51 +0200 |
---|---|---|
committer | Alejandro Sirgo Rica <asirgo@soleta.eu> | 2024-09-25 14:35:41 +0200 |
commit | 8754c21694b5dff69105a0d9b739dd87088626ee (patch) | |
tree | 57ecca7dc8fcc01d67aa6755924124ed8bce76a5 /src/utils | |
parent | 3b40ec7918531cf60d9d4b7749d97ea3f0bf1b1f (diff) |
src: report used and free partition data in bytes
Add "used_size" and "free_size" to the partition data and the
cache data.
Old response from ogClient for /cache/delete, /cache/fetch
and /image/restore:
{
'cache': [
{'name': 'windows.img', 'size': 2432370213, checksum: '5d4dcc677bc19f40a647d0002f4ade90'},
{'name': 'linux.img', 'size': 243234534213, checksum: '3eb22f888f88a55ad954f55644e1192e'}
]
}
New response:
{
'cache': {
'used_size': 4520232322423,
'free_size': 48273465287452945,
'images': [
{'name': 'windows.img', 'size': 2432370213, checksum: '5d4dcc677bc19f40a647d0002f4ade90'},
{'name': 'linux.img', 'size': 243234534213, checksum: '3eb22f888f88a55ad954f55644e1192e'}
]
}
}
Diffstat (limited to 'src/utils')
-rw-r--r-- | src/utils/fs.py | 11 |
1 files changed, 0 insertions, 11 deletions
diff --git a/src/utils/fs.py b/src/utils/fs.py index 3de8ee2..381f65b 100644 --- a/src/utils/fs.py +++ b/src/utils/fs.py @@ -81,17 +81,6 @@ def umount_all(): umount(path) -def get_usedperc(mountpoint): - """ - Returns percetage of used filesystem as decimal number. - """ - try: - total, used, free, perc = psutil.disk_usage(mountpoint) - except FileNotFoundError: - return '0' - return str(perc) - - def ogReduceFs(disk, part): """ Shrink filesystem of a partition. Supports ext4 and ntfs partitions. |