summaryrefslogtreecommitdiffstats
path: root/src/virtual/ogOperations.py
diff options
context:
space:
mode:
authorAlejandro Sirgo Rica <asirgo@soleta.eu>2024-09-23 13:08:51 +0200
committerAlejandro Sirgo Rica <asirgo@soleta.eu>2024-09-25 14:35:41 +0200
commit8754c21694b5dff69105a0d9b739dd87088626ee (patch)
tree57ecca7dc8fcc01d67aa6755924124ed8bce76a5 /src/virtual/ogOperations.py
parent3b40ec7918531cf60d9d4b7749d97ea3f0bf1b1f (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/virtual/ogOperations.py')
-rw-r--r--src/virtual/ogOperations.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/virtual/ogOperations.py b/src/virtual/ogOperations.py
index 763c126..836967a 100644
--- a/src/virtual/ogOperations.py
+++ b/src/virtual/ogOperations.py
@@ -286,6 +286,7 @@ class OgVirtualOperations:
part['os'] = ''
part['size'] = 0
part['used_size'] = 0
+ part['free_size'] = 0
part['virt-drive'] = ''
continue
g = guestfs.GuestFS(python_return_dict=True)
@@ -332,7 +333,8 @@ class OgVirtualOperations:
'filesystem': '',
'os': '',
'size': int(free_disk / 1024),
- 'used_size': int(100 * used_disk / total_disk)}],
+ 'used_size': used_disk,
+ 'free_size': free_disk}],
'partition_setup': []}
for i in range(4):
part_json = {'disk': 1,
@@ -342,6 +344,7 @@ class OgVirtualOperations:
'os': '',
'size': 0,
'used_size': 0,
+ 'free_size': 0,
'virt-drive': ''}
data['partition_setup'].append(part_json)
with open(self.OG_PARTITIONS_CFG_PATH, 'w+') as f: