From: Lars Wirzenius Date: Tue, 18 Mar 2014 21:40:32 +0000 (+0000) Subject: Apply patch from Neil Williams to fix kpartx timing problem X-Git-Url: https://git.siccegge.de//index.cgi?a=commitdiff_plain;h=d1bb4c91882c4b2c8e25ae04dc75b62f78898d8e;p=forks%2Fvmdebootstrap.git Apply patch from Neil Williams to fix kpartx timing problem --- 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)