From 8754c21694b5dff69105a0d9b739dd87088626ee Mon Sep 17 00:00:00 2001 From: Alejandro Sirgo Rica Date: Mon, 23 Sep 2024 13:08:51 +0200 Subject: 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'} ] } } --- src/utils/fs.py | 11 ----------- 1 file changed, 11 deletions(-) (limited to 'src/utils/fs.py') 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. -- cgit v1.2.3-18-g5258