summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/live/ogOperations.py9
-rw-r--r--src/ogRest.py1
-rw-r--r--src/utils/legacy.py1
3 files changed, 11 insertions, 0 deletions
diff --git a/src/live/ogOperations.py b/src/live/ogOperations.py
index a8412c6..66f3024 100644
--- a/src/live/ogOperations.py
+++ b/src/live/ogOperations.py
@@ -478,6 +478,15 @@ class OgLiveOperations:
logging.exception('Exception when running "image create" subprocess')
raise ValueError('Error: Incorrect command value')
+ try:
+ stat = os.stat(image_path)
+ size = stat.st_size
+ except:
+ logging.info(f'cannot retrieve size from {image_path}')
+ size = 0
+
+ image_info.size = size
+
self._write_md5_file(f'/opt/opengnsys/images/{name}.img')
self._restartBrowser(self._url)
diff --git a/src/ogRest.py b/src/ogRest.py
index 5a89d27..f567280 100644
--- a/src/ogRest.py
+++ b/src/ogRest.py
@@ -206,6 +206,7 @@ class ogThread():
json_body.add_element('compressor', image_info.compressor)
json_body.add_element('filesystem', image_info.filesystem)
json_body.add_element('datasize', datasize)
+ json_body.add_element('size', image_info.size)
response = restResponse(ogResponses.OK, json_body, seq=client.seq)
client.send(response.get())
diff --git a/src/utils/legacy.py b/src/utils/legacy.py
index cfcec5e..6e907b4 100644
--- a/src/utils/legacy.py
+++ b/src/utils/legacy.py
@@ -25,6 +25,7 @@ class ImageInfo:
def __init__(self, filesystem=None, datasize=None):
self.filesystem = filesystem
self.datasize = datasize
+ self.size = 0
self.clonator = 'PARTCLONE'
self.compressor = 'LZOP'