Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/archinstall/lib/disk/blockdevice.py
diff options
context:
space:
mode:
authorAnton Hvornum <anton@hvornum.se>2021-11-11 18:11:38 +0000
committerGitHub <noreply@github.com>2021-11-11 18:11:38 +0000
commitca52c796a55fd34cc1309f26bab86e15da722182 (patch)
tree6dd56f60f5445920788fc1a94d1e93f34c78aea7 /archinstall/lib/disk/blockdevice.py
parent9b944b90b151a616e36f7361c7cf3c6951e61970 (diff)
parentc0bf44e0ae82bf2e379e57965c0e21694b61cd3c (diff)
Merged PR #711 - Fixing disk "ghosting" issues using partprobe
* Adding partprobe at strategic places. * Swapped `for partition in blockdevice` to `for uuid, partition in blockdevice.partitions.items()` instead as `__iter__` for debugging purposes. * `get_mount_info()` now causes a exception rather than returning nothing if there is nothing to be shown. This to avoid issues where in places this is crucial information and it went by unnoticeable. Using exception handlers where it doesn't matter if there's any information or not.
Diffstat (limited to 'archinstall/lib/disk/blockdevice.py')
-rw-r--r--archinstall/lib/disk/blockdevice.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/archinstall/lib/disk/blockdevice.py b/archinstall/lib/disk/blockdevice.py
index 5204f09b..307c5983 100644
--- a/archinstall/lib/disk/blockdevice.py
+++ b/archinstall/lib/disk/blockdevice.py
@@ -112,8 +112,8 @@ class BlockDevice:
@property
def partitions(self):
from .filesystem import Partition
- SysCommand(['partprobe', self.path])
+ self.partprobe()
result = SysCommand(['/usr/bin/lsblk', '-J', self.path])
if b'not a block device' in result:
@@ -202,6 +202,9 @@ class BlockDevice:
info = space_info
return info
+ def partprobe(self):
+ SysCommand(['partprobe', self.path])
+
def has_partitions(self):
return len(self.partitions)
@@ -217,7 +220,7 @@ class BlockDevice:
def get_partition(self, uuid):
count = 0
while count < 5:
- for partition in self:
+ for partition_uuid, partition in self.partitions.items():
if partition.uuid == uuid:
return partition
else:
@@ -226,4 +229,7 @@ class BlockDevice:
count += 1
else:
log(f"Could not find {uuid} in disk after 5 retries",level=logging.INFO)
+ print(f"Cache: {self.part_cache}")
+ print(f"Partitions: {self.partitions.items()}")
+ print(f"UUID: {[uuid]}")
raise DiskError(f"New partition {uuid} never showed up after adding new partition on {self}")