Check exit status of vdfs image creation
authorJungseung Lee <js07.lee@samsung.com>
Wed, 28 Mar 2018 10:15:18 +0000 (19:15 +0900)
committerXiao Jin <jin.xiao@samsung.com>
Wed, 2 May 2018 06:31:16 +0000 (14:31 +0800)
If vdfs creation process exit with failure (EXIT_FAILURE), it should be checked.
Because it could cause malformed vdfs image creation.

In this patch, we added checking code of exit status.

Change-Id: I5aae6a8cb6de0b4dcf2dc1f9e27ee6139b26f918
Signed-off-by: Jungseung Lee <js07.lee@samsung.com>
mic/imager/loop.py

index 04abd0a..dc2123d 100644 (file)
@@ -20,7 +20,7 @@ import glob
 import shutil
 
 from mic import kickstart, msger
-from mic.utils.errors import CreatorError, MountError
+from mic.utils.errors import CreatorError, MountError, VdfsError
 from mic.utils import misc, runner, fs_related as fs
 from mic.imager.baseimager import BaseImageCreator
 from mic.archive import packing, compressing
@@ -455,7 +455,10 @@ class LoopImageCreator(BaseImageCreator):
                     fullpathmkvdfs = "mkfs.vdfs" #find_binary_path("mkfs.vdfs")
                     runner.show("%s --help" % fullpathmkvdfs)
 #                    fs.mkvdfs(mountpoint, self._outdir+"/"+item['label']+fs_suffix, vdfsopts)
-                    runner.show('%s %s -r %s %s' % (fullpathmkvdfs, vdfsopts, mountpoint, self._imgdir+"/"+item['label']+fs_suffix))
+                    ret = runner.show('%s %s -r %s %s' % (fullpathmkvdfs, vdfsopts, mountpoint, self._imgdir+"/"+item['label']+fs_suffix))
+                    if ret != 0:
+                        runner.show("mkfs.vdfs return error")
+                        raise VdfsError("' %s' exited with error (%d)" % (fullpathmkvdfs, ret))
 
                 runner.show('umount %s' % mountpoint)
 #               os.unlink(mountpoint)