summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Johnson <johnsomor@gmail.com>2017-06-16 09:26:06 -0700
committerIan Wienand <iwienand@redhat.com>2017-06-17 09:00:13 +1000
commit250aeb5d219db1a0fc01033168a55f7f61e60c74 (patch)
tree8b3865c6494018eeadb91b7773fbc173a8580e10
parent1324f5b7dbc148f1bf4ab35d77ef7c21da18e533 (diff)
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
Notes
Notes (review): Code-Review+2: Ian Wienand <iwienand@redhat.com> Workflow+1: Ian Wienand <iwienand@redhat.com> Code-Review+1: Erik Olof Gunnar Andersson <eandersson@blizzard.com> Verified+2: Jenkins Submitted-by: Jenkins Submitted-at: Sat, 17 Jun 2017 06:43:47 +0000 Reviewed-on: https://review.openstack.org/475022 Project: openstack/diskimage-builder Branch: refs/heads/master
-rw-r--r--diskimage_builder/block_device/level1/partitioning.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/diskimage_builder/block_device/level1/partitioning.py b/diskimage_builder/block_device/level1/partitioning.py
index f7fd07c..926207e 100644
--- a/diskimage_builder/block_device/level1/partitioning.py
+++ b/diskimage_builder/block_device/level1/partitioning.py
@@ -147,6 +147,12 @@ class Partitioning(PluginBase):
147 # mount them 147 # mount them
148 if not os.path.exists("/.dockerenv"): 148 if not os.path.exists("/.dockerenv"):
149 exec_sudo(["kpartx", "-avs", device_path]) 149 exec_sudo(["kpartx", "-avs", device_path])
150 # We need to make sure udev finishes creating the device
151 # before continuting, so "udevadm settle". Otherwise later
152 # commands can fail with "file does not exist".
153 # XXX: "-s" (synchronous) to kpartx should avoid this,
154 # but experience shows it does not.
155 exec_sudo(["udevadm", "settle"])
150 else: 156 else:
151 # If running inside Docker, make our nodes manually, 157 # If running inside Docker, make our nodes manually,
152 # because udev will not be working. kpartx cannot run in 158 # because udev will not be working. kpartx cannot run in