From d1bb4c91882c4b2c8e25ae04dc75b62f78898d8e Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Tue, 18 Mar 2014 21:40:32 +0000 Subject: [PATCH] Apply patch from Neil Williams to fix kpartx timing problem --- vmdebootstrap | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/vmdebootstrap b/vmdebootstrap index a6d43ac..a8126fd 100755 --- a/vmdebootstrap +++ b/vmdebootstrap @@ -23,6 +23,7 @@ import re import shutil import subprocess import tempfile +import time __version__ = '0.2' @@ -469,10 +470,15 @@ append initrd=%(initrd)s root=UUID=%(uuid)s ro %(kserial)s if self.settings['image']: for i in xrange(len(self.mount_points) - 1, -1, -1): mount_point = self.mount_points[i] - self.runcmd(['umount', mount_point], ignore_fail=True) + try: + self.runcmd(['umount', mount_point], ignore_fail=False) + except cliapp.AppException: + logging.debug("umount failed, sleeping and trying again") + time.sleep(5) + self.runcmd(['umount', mount_point], ignore_fail=False) self.runcmd(['kpartx', '-d', self.settings['image']], ignore_fail=True) - + for dirname in self.remove_dirs: shutil.rmtree(dirname) -- 2.39.5