NAS-129045 / 24.10 / Improve disk.get_partitions_quick #13744
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As pointed out in recent PR: #13738,
device.settle_udev_events
is needed (sporadically) after partitioning disks. The reason why is that certain operations will generate udev events. We try to access the information before those events have been processed and so sysfs information will not be complete.The problem by calling
settle_udev_events
is that it will tell udev to drain the entire event queue. The queue holds information for ALL hardware and related events. This means, depending on what the system is doing at the time this is called, it can block and wait for 120 seconds (default timeout).This PR changes it so that
disk.get_partitions_quick
actually tries 10 times (maximum) for the sysfs files to be generated. While I'm here, I noticed that if a disk had > 9 partitions, this would not return correct information. To be fair, however, we don't have any logic to handle disks with that many partitions but I went ahead and fixed this while I was here.