diff options
author | Dohyung Kim <dohyung2.kim@samsung.com> | 2015-07-02 11:39:09 +0900 |
---|---|---|
committer | yuhuan.yang <yuhuan.yang@samsung.com> | 2018-01-30 10:56:02 +0800 |
commit | 701778b56a56edaefa7b508d6bb3f31ee8ece83a (patch) | |
tree | 60c65cbd3c96a9158b77516f25165b001b832617 | |
parent | 486cea5abfb762d02f8c06c0311ecc7dacd24756 (diff) | |
download | mic-701778b56a56edaefa7b508d6bb3f31ee8ece83a.tar.gz mic-701778b56a56edaefa7b508d6bb3f31ee8ece83a.tar.bz2 mic-701778b56a56edaefa7b508d6bb3f31ee8ece83a.zip |
add no_shrink option to partition, fix parameter of disk.expand()
* add no_shrink option to partition
- if no_shrink is enable in specific partition, this partition do not shrink.
- if not, following pack_to or shrink option in loop command
* fix parameter of disk.expand()
- expand(size) -> expand(size=size)
Change-Id: Ic9486621795c0e1a867fd551d61f152c693b6c52
Signed-off-by: Dohyung Kim <dohyung2.kim@samsung.com>
-rwxr-xr-x | mic/imager/loop.py | 4 | ||||
-rwxr-xr-x | mic/kickstart/custom_commands/partition.py | 4 | ||||
-rw-r--r-- | mic/utils/fs_related.py | 6 |
3 files changed, 11 insertions, 3 deletions
diff --git a/mic/imager/loop.py b/mic/imager/loop.py index eab83b2..7fb5024 100755 --- a/mic/imager/loop.py +++ b/mic/imager/loop.py @@ -169,6 +169,7 @@ class LoopImageCreator(BaseImageCreator): 'uuid': part.uuid or None, 'kspart' : part, 'exclude_image' : part.exclude_image or None, + 'no_shrink': part.no_shrink or False, }) self._instloops = allloops @@ -310,6 +311,9 @@ class LoopImageCreator(BaseImageCreator): minsize = 0 for item in self._instloops: if not item['cpioopts']: + if item['no_shrink']: + item['loop'].resparse() + continue if item['name'] == self._img_name: minsize = item['loop'].resparse(size) else: diff --git a/mic/kickstart/custom_commands/partition.py b/mic/kickstart/custom_commands/partition.py index d692a91..d0385b7 100755 --- a/mic/kickstart/custom_commands/partition.py +++ b/mic/kickstart/custom_commands/partition.py @@ -32,6 +32,7 @@ class Mic_PartData(FC4_PartData): self.vdfsopts = kwargs.get("vdfsopts", None) self.squashfsopts = kwargs.get("squashfsopts", None) self.cpioopts = kwargs.get("cpioopts", None) + self.no_shrink = kwargs.get("no_shrink", False) def _getArgsAsStr(self): retval = FC4_PartData._getArgsAsStr(self) @@ -52,6 +53,8 @@ class Mic_PartData(FC4_PartData): retval += " --squashfsoptions=%s" % self.squashfsopts if self.cpioopts: retval += " --cpiooptions=%s" % self.cpioopts + if self.no_shrink: + retval += " --no-shrink" return retval class Mic_Partition(FC4_Partition): @@ -77,4 +80,5 @@ class Mic_Partition(FC4_Partition): default=None) op.add_option("--cpiooptions", type="string", action="store", dest="cpioopts", default=None) + op.add_option("--no-shrink", action="store_true", dest="no_shrink", default=False) return op diff --git a/mic/utils/fs_related.py b/mic/utils/fs_related.py index 11ff5af..cee4c8a 100644 --- a/mic/utils/fs_related.py +++ b/mic/utils/fs_related.py @@ -483,7 +483,7 @@ class ExtDiskMount(DiskMount): return if size > current_size: - self.disk.expand(size) + self.disk.expand(size=size) self.__fsck() @@ -580,7 +580,7 @@ class VfatDiskMount(DiskMount): return if size > current_size: - self.disk.expand(size) + self.disk.expand(size=size) self.__fsck() @@ -685,7 +685,7 @@ class BtrfsDiskMount(DiskMount): return if size > current_size: - self.disk.expand(size) + self.disk.expand(size=size) self.__fsck() return size |