summaryrefslogtreecommitdiffstats
path: root/src/virtual
diff options
context:
space:
mode:
authorJavier Sánchez Parra <jsanchez@soleta.eu>2020-11-19 12:44:40 +0100
committerOpenGnSys Support Team <soporte-og@soleta.eu>2020-11-19 13:20:08 +0100
commit0411d2bf94c8854f3589213074f40056d026a020 (patch)
tree774e52457a658d5f5a42140478c044410b62c393 /src/virtual
parent91f034e37121a6ec085fe14a69421793f1fb3087 (diff)
#1008 Adapt virtual disk setup JSON format
Previous commits updates ogClient and ogServer to support several disks in Linux (ogLive) mode. This changes disk setup JSON format from an object to an array. ogClient in virtual mode also need to satisfy this new format, although it not support several disks. Adapt ogClient virtual mode to satisfy new disk setup JSON format. Old format: "disk_setup": { "disk": 1, "partition": 0, "code": "0", "filesystem": "", "os": "", "size": 32685957, "used_size": 6 }, New format: "disk_setup": [ { "disk": 1, "partition": 0, "code": "0", "filesystem": "", "os": "", "size": 32685957, "used_size": 6 } ],
Diffstat (limited to 'src/virtual')
-rw-r--r--src/virtual/ogOperations.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/virtual/ogOperations.py b/src/virtual/ogOperations.py
index 5e5ee44..60370cb 100644
--- a/src/virtual/ogOperations.py
+++ b/src/virtual/ogOperations.py
@@ -252,7 +252,9 @@ class OgVirtualOperations:
part.pop('virt-drive')
for k, v in part.items():
part[k] = str(v)
- data['disk_setup'] = {k: str(v) for k, v in data['disk_setup'].items()}
+ for disk in data['disk_setup']:
+ for k, v in disk.items():
+ disk[k] = str(v)
return data
def refresh(self, ogRest):
@@ -318,13 +320,13 @@ class OgVirtualOperations:
total_disk, used_disk, free_disk = shutil.disk_usage("/")
free_disk = int(free_disk * self.USABLE_DISK)
data = {'serial_number': '',
- 'disk_setup': {'disk': 1,
+ 'disk_setup': [{'disk': 1,
'partition': 0,
'code': '0',
'filesystem': '',
'os': '',
'size': int(free_disk / 1024),
- 'used_size': int(100 * used_disk / total_disk)},
+ 'used_size': int(100 * used_disk / total_disk)}],
'partition_setup': []}
for i in range(4):
part_json = {'disk': 1,