summaryrefslogtreecommitdiffstats
path: root/src/live
diff options
context:
space:
mode:
Diffstat (limited to 'src/live')
-rw-r--r--src/live/ogOperations.py40
1 files changed, 21 insertions, 19 deletions
diff --git a/src/live/ogOperations.py b/src/live/ogOperations.py
index 4b3ec13..2451c9b 100644
--- a/src/live/ogOperations.py
+++ b/src/live/ogOperations.py
@@ -454,23 +454,7 @@ class OgLiveOperations:
logging.info('Successful hardware inventory command execution')
return result
- def setup(self, request, ogRest):
- table_type = request.getType()
- disk = int(request.getDisk())
- cache = request.getCache()
- cache_size = request.getCacheSize()
- partlist = request.getPartitionSetup()
-
- self._ogbrowser_clear_logs()
- self._restartBrowser(self._url_log)
-
- umount_all()
- umount_cache()
-
- if disk < 0 or disk > len(get_disks()):
- raise OgError(f'Invalid disk number {disk}, {len(get_disks())} disks available.')
-
- diskname = get_disks()[disk-1]
+ def _partition(self, diskname, table_type, partlist):
cxt = fdisk.Context(f'/dev/{diskname}',
details=True)
@@ -487,8 +471,6 @@ class OgLiveOperations:
logging.info(f'Creating partition {part["partition"]} with {part["code"]} of {int(part["size"])//1024} MiB')
if part["code"] == 'EMPTY':
continue
- if ogRest.terminated:
- break
pa = fdisk.Partition(start_follow_default=True,
end_follow_default=False,
@@ -503,6 +485,26 @@ class OgLiveOperations:
cxt.write_disklabel()
os.sync()
+
+ def setup(self, request, ogRest):
+ table_type = request.getType()
+ disk = int(request.getDisk())
+ cache = request.getCache()
+ cache_size = request.getCacheSize()
+ partlist = request.getPartitionSetup()
+
+ self._ogbrowser_clear_logs()
+ self._restartBrowser(self._url_log)
+
+ umount_all()
+ umount_cache()
+
+ if disk < 0 or disk > len(get_disks()):
+ raise OgError(f'Invalid disk number {disk}, {len(get_disks())} disks available.')
+
+ diskname = get_disks()[disk-1]
+ self._partition(diskname, table_type, partlist)
+
ret = subprocess.run(['partprobe', f'/dev/{diskname}'])
logging.info(f'first partprobe /dev/{diskname} reports {ret.returncode}')