From 665ee8be7ecb9b6d5b69691ddbc1a985b8fb1230 Mon Sep 17 00:00:00 2001 From: "Brian C. Lane" Date: Fri, 14 Dec 2012 10:34:53 -0800 Subject: [PATCH] imgutils: use -s for kpartx, wait for device creation kpartx can return before the devices are created. Use -s to wait. Also remove -p p and let kpartx handle adding pX if needed, we use whatever it outputs so there is no need to force a name. --- src/pylorax/imgutils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pylorax/imgutils.py b/src/pylorax/imgutils.py index 0ebb3d20..94dda5af 100644 --- a/src/pylorax/imgutils.py +++ b/src/pylorax/imgutils.py @@ -253,7 +253,7 @@ class PartitionMount(object): # kpartx -p p -v -a /tmp/diskV2DiCW.im # add map loop2p1 (253:2): 0 3481600 linear /dev/loop2 2048 # add map loop2p2 (253:3): 0 614400 linear /dev/loop2 3483648 - kpartx_output = runcmd_output(["kpartx", "-v", "-p", "p", "-a", self.disk_img]) + kpartx_output = runcmd_output(["kpartx", "-v", "-a", "-s", self.disk_img]) logger.debug(kpartx_output) # list of (deviceName, sizeInBytes) @@ -291,7 +291,7 @@ class PartitionMount(object): umount( self.mount_dir ) os.rmdir(self.mount_dir) self.mount_dir = None - execWithRedirect("kpartx", ["-d", self.disk_img]) + execWithRedirect("kpartx", ["-d", "-s", self.disk_img]) ######## Functions for making filesystem images ##########################