Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/archinstall/lib/disk/filesystem.py
diff options
context:
space:
mode:
Diffstat (limited to 'archinstall/lib/disk/filesystem.py')
-rw-r--r--archinstall/lib/disk/filesystem.py26
1 files changed, 15 insertions, 11 deletions
diff --git a/archinstall/lib/disk/filesystem.py b/archinstall/lib/disk/filesystem.py
index 4d137163..0be1ec8b 100644
--- a/archinstall/lib/disk/filesystem.py
+++ b/archinstall/lib/disk/filesystem.py
@@ -167,17 +167,21 @@ class Filesystem:
parted_string = f'{self.blockdevice.device} mkpart {partition_type} {start} {end}'
if self.parted(parted_string):
- start_wait = time.time()
-
- while previous_partition_uuids == {partition.uuid for partition in self.blockdevice.partitions.values()}:
- if time.time() - start_wait > 10:
- raise DiskError(f"New partition never showed up after adding new partition on {self} (timeout 10 seconds).")
- time.sleep(0.025)
-
- # Todo: Find a better way to detect if the new UUID of the partition has showed up.
- # But this will address (among other issues)
- time.sleep(float(storage['arguments'].get('disk-sleep', 2.0))) # Let the kernel catch up with quick block devices (nvme for instance)
- return self.blockdevice.get_partition(uuid=(previous_partition_uuids ^ {partition.uuid for partition in self.blockdevice.partitions.values()}).pop())
+ count = 0
+ while count < 10:
+ new_uuid = None
+ new_uuid_set = (previous_partition_uuids ^ {partition.uuid for partition in self.blockdevice.partitions.values()})
+ if len(new_uuid_set) > 0:
+ new_uuid = new_uuid_set.pop()
+ if new_uuid:
+ return self.blockdevice.get_partition(new_uuid)
+ else:
+ count += 1
+ log(f"Could not get uuid for partition. Waiting for the {count} time",level=logging.DEBUG)
+ time.sleep(float(storage['arguments'].get('disk-sleep', 0.2)))
+ else:
+ log("Add partition exiting due to excesive wait time",level=logging.INFO)
+ raise DiskError(f"New partition never showed up after adding new partition on {self}.")
def set_name(self, partition: int, name: str):
return self.parted(f'{self.blockdevice.device} name {partition + 1} "{name}"') == 0