From b97c4d157adfcbdaa0f7ede40bd68e54c0aaaef3 Mon Sep 17 00:00:00 2001 From: OpenGnSys Support Team Date: Tue, 12 Dec 2023 11:15:44 +0100 Subject: live: report image size when creating image add .size json field to report the real size of the image file. --- src/live/ogOperations.py | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/live') 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) -- cgit v1.2.3-18-g5258