diff options
author | OpenGnSys Support Team <soporte-og@soleta.eu> | 2024-05-06 18:07:41 +0200 |
---|---|---|
committer | OpenGnSys Support Team <soporte-og@soleta.eu> | 2024-05-06 18:33:41 +0200 |
commit | f42e2ba201c33d36a9e528ec2f3f217d02a8184b (patch) | |
tree | 60749ce364a84cd6bdc9eb8bfc95a7ea704185ab | |
parent | 170d7e1be98f7b2caf924abfdbbacf30438361ad (diff) |
live: partprobe breaks with mounted partitions
partprobe requires that all disk partitions are unmounted.
partprobe needs to be called to report the OS that the partition table
has changed, otherwise ogclient reports incorrect partition information.
iterate over the partition list and mount cache after partprobe is
called.
-rw-r--r-- | src/live/ogOperations.py | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/live/ogOperations.py b/src/live/ogOperations.py index a72a842..86470aa 100644 --- a/src/live/ogOperations.py +++ b/src/live/ogOperations.py @@ -346,7 +346,6 @@ class OgLiveOperations: cxt.add_partition(pa) cxt.write_disklabel() - subprocess.run(['partprobe', f'/dev/{diskname}']) for part in partlist: if part["filesystem"] == 'EMPTY': @@ -358,10 +357,20 @@ class OgLiveOperations: partition = int(part["partition"]) if fs == 'cache': mkfs('ext4', int(disk), partition, label='CACHE') - init_cache() else: mkfs(fs, int(disk), partition) + ret = subprocess.run(['partprobe', f'/dev/{diskname}']) + logging.info(f'partprobe /dev/{diskname} reports {ret.returncode}') + + for part in partlist: + if part["filesystem"] == 'EMPTY': + continue + + fs = part["filesystem"].lower() + if fs == 'cache': + init_cache() + logging.info('Partition setup command OK') result = self.refresh(ogRest) |