Fix mkfs failure when loop device is not ready
There was a race in diskimage-builder where the mkfs call after a kpartx -avs for the loop device would fail because the device was not yet ready. This adds a udevadm settle call after the kpartx to make sure the udev event queue has cleared. Change-Id: I90103b59357edebbac7a641e8980cb282d37561b Closes-Bug: #1698337
This commit is contained in:
parent
1324f5b7db
commit
250aeb5d21
@ -147,6 +147,12 @@ class Partitioning(PluginBase):
|
||||
# mount them
|
||||
if not os.path.exists("/.dockerenv"):
|
||||
exec_sudo(["kpartx", "-avs", device_path])
|
||||
# We need to make sure udev finishes creating the device
|
||||
# before continuting, so "udevadm settle". Otherwise later
|
||||
# commands can fail with "file does not exist".
|
||||
# XXX: "-s" (synchronous) to kpartx should avoid this,
|
||||
# but experience shows it does not.
|
||||
exec_sudo(["udevadm", "settle"])
|
||||
else:
|
||||
# If running inside Docker, make our nodes manually,
|
||||
# because udev will not be working. kpartx cannot run in
|
||||
|
Loading…
Reference in New Issue
Block a user