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.
*WIP: The tests have not actually been run and are just adjusted as a guesswork
Modifying the XFS uuid of the VM image's root partition failed, because it was supposedly already mounted. In fact it was not, but we are hitting an edge case of the interplay of xfs_admin, findmnt, filesystem labels, and udev, see PL-133416 for details:
/dev/disk/by-label/root
. This refers to the root filesystem device using the symlink created by udev when the partition is mapped at boot time./dev/disk/by-label
to point to the device node for the partition on the nbd image.xfs_admin
is a shell script, which wraps lower level tools likexfs_db
with a more convenient interface.xfs_db
.xfs_io
. In order to determine which command to use, the script therefore invokesfindmnt
from util-linux to resolve the named block device to a mount point, if one exists.findmnt
resolves the mount points using procfs and sysfs. If any mountpoints use symlinks under/dev/disk
they are also evaluated, to detect cases where the queried partition was mounted through one of those symlinks.findmnt
misidentifies the nbd partition as the root partion (due to/dev/disk/by-label/root
being rewritten), and then runsxfs_io
to print the UUID of the currently mounted root filesystem.xfs_admin
to assume that the partition is already mounted as the root filesystem, and refuses to change the UUID.xfs_admin
, if this collision did not occur and it managed to correctly identify that the nbd partition is not mounted, then it should run the "uuid" command fromxfs_db
to change the UUID of the XFS filesystem on the nbd partition.TL;DR: replace
xfs_admin -U insert-uuid-here /path/to/device
withxfs_db -x -c 'uuid insert-uuid-here' /path/to/device
.PL-133416