Skip to content

Commit

Permalink
Merge pull request #88 from truenas/more-partition-fixes
Browse files Browse the repository at this point in the history
NAS-130084 / 24.10 / try to help partition detection
  • Loading branch information
yocalebo authored Jul 17, 2024
2 parents f164ef0 + a787fab commit 3483407
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions truenas_installer/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,15 @@ async def get_partitions(
else:
tries = min(tries, MAX_PARTITION_WAIT_TIME_SECS)

# by the time this function is called, partitions should have been
# written to the disk. However, it doesn't mean the kernel/udev has
# updated the various symlinks in sysfs. We'll open the block device
# in write mode. This should send a kernel and udev change event for
# the device and any partitions as well. Ideally, this will help bubble
# up the events so sysfs is populated before the logic below kicks in
with open(device, 'w'):
pass

disk_partitions = {i: None for i in partitions}
device = device.removeprefix('/dev/')
for _try in range(tries):
Expand Down

0 comments on commit 3483407

Please sign in to comment.