use sync mode in kpartx command
authorGui Chen <gui.chen@intel.com>
Wed, 25 Sep 2013 04:00:37 +0000 (00:00 -0400)
committerGui Chen <gui.chen@intel.com>
Thu, 26 Sep 2013 02:12:49 +0000 (22:12 -0400)
see kpartx man page:
-s sync mode. Don't return until the partitions are created
this should be the wanted option for current kpartx use

Change-Id: I99ba7d6413a54e9845c5a9f0654bef4d434e9c52
Signed-off-by: Gui Chen <gui.chen@intel.com>
mic/utils/partitionedfs.py

index ac01ec1..d745bb9 100644 (file)
@@ -448,13 +448,13 @@ class PartitionedMount(Mount):
                 os.symlink(mapperdev, loopdev)
 
             msger.debug("Adding partx mapping for %s" % d['disk'].device)
-            rc = runner.show([self.kpartx, "-v", "-a", d['disk'].device])
+            rc = runner.show([self.kpartx, "-v", "-sa", d['disk'].device])
 
             if rc != 0:
                 # Make sure that the device maps are also removed on error case.
                 # The d['mapped'] isn't set to True if the kpartx fails so
                 # failed mapping will not be cleaned on cleanup either.
-                runner.quiet([self.kpartx, "-d", d['disk'].device])
+                runner.quiet([self.kpartx, "-sd", d['disk'].device])
                 raise MountError("Failed to map partitions for '%s'" %
                                  d['disk'].device)
 
@@ -463,7 +463,7 @@ class PartitionedMount(Mount):
                 runner.quiet([self.dmsetup, "mknodes"])
                 # still not updated, roll back
                 if not os.path.exists(mapperdev):
-                    runner.quiet([self.kpartx, "-d", d['disk'].device])
+                    runner.quiet([self.kpartx, "-sd", d['disk'].device])
                     raise MountError("Failed to load mapper devices for '%s'" %
                                      d['disk'].device)
 
@@ -482,7 +482,7 @@ class PartitionedMount(Mount):
                     self.partitions[pnum]['device'] = None
 
             msger.debug("Unmapping %s" % d['disk'].device)
-            rc = runner.quiet([self.kpartx, "-d", d['disk'].device])
+            rc = runner.quiet([self.kpartx, "-sd", d['disk'].device])
             if rc != 0:
                 raise MountError("Failed to unmap partitions for '%s'" %
                                  d['disk'].device)