copy the real device mapper
authorGui Chen <gui.chen@intel.com>
Wed, 13 Aug 2014 08:25:32 +0000 (04:25 -0400)
committeradmin <yuhuan.yang@samsung.com>
Thu, 4 Feb 2016 10:24:28 +0000 (18:24 +0800)
some operation like initrd creation need the real device actually,
so copy it into _instroot as well

Change-Id: Id45680bc2407bfc9e07e90753b9696bb1066db12
Signed-off-by: Gui Chen <gui.chen@intel.com>
mic/imager/raw.py

index 14b7833..649292b 100644 (file)
@@ -256,6 +256,8 @@ class RawImageCreator(BaseImageCreator):
         for p in self.__instloop.partitions:
             copy_devnode(p['mapper_device'],
                          self._instroot + p['mapper_device'])
+            copy_devnode(p['mpath_device'],
+                         self._instroot + p['mpath_device'])
 
     def unmount(self):
         """
@@ -268,10 +270,14 @@ class RawImageCreator(BaseImageCreator):
                 path = self._instroot + p['mapper_device']
                 if os.path.exists(path):
                     os.unlink(path)
+            if p['mpath_device']:
+                path = self._instroot + p['mpath_device']
+                if os.path.exists(path):
+                    os.unlink(path)
 
         path = self._instroot + "/dev/mapper"
         if os.path.exists(path):
-            os.rmdir(path)
+            shutil.rmtree(path, ignore_errors=True)
 
         for name in self.__disks.keys():
             if self.__disks[name].device: