raise error if load mapper device failed
authorGui Chen <gui.chen@intel.com>
Tue, 27 Aug 2013 02:31:19 +0000 (22:31 -0400)
committerGui Chen <gui.chen@intel.com>
Tue, 27 Aug 2013 02:31:19 +0000 (22:31 -0400)
if calling 'dmsetup mknodes' doesn't take effect, mic
should raise error to avoid user

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

index e040310..0460f05 100644 (file)
@@ -459,7 +459,13 @@ class PartitionedMount(Mount):
                                  d['disk'].device)
 
             if not os.path.exists(mapperdev):
+                # load mapper device if not updated
                 runner.quiet([self.dmsetup, "mknodes"])
+                # still not updated, roll back
+                if not os.path.exists(mapperdev):
+                    runner.quiet([self.kpartx, "-d", d['disk'].device])
+                    raise MountError("Failed to load mapper devices for '%s'" %
+                                     d['disk'].device)
 
             d['mapped'] = True