From: Artem Bityutskiy Date: Mon, 24 Jun 2013 06:09:29 +0000 (+0300) Subject: partitionedfs: preserve the KS partition number X-Git-Tag: 0.20~19 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=877010af73068fad5a2108a30589053f77c0a29b;p=tools%2Fmic.git partitionedfs: preserve the KS partition number The 'add_partition()' function takes partition from the KS file and processes them. A commentary in 'add_partition()' says: "partitions have to be added in the first-to-last order", so the order is important. The order number is basically the partition entry number in the KS file. Unfortunately, it is lost once the partition is added, and later on it is not easy to match a partition from the KS file to the processed partition. This patch teaches 'add_partition()' to preserve the KS file partition number for later use. The new key 'ks_pnum' will be useful in the next patch, when we export information about partitions and we want it to be in the KS file order. Signed-off-by: Artem Bityutskiy --- diff --git a/mic/utils/partitionedfs.py b/mic/utils/partitionedfs.py index f1102d4..0475844 100644 --- a/mic/utils/partitionedfs.py +++ b/mic/utils/partitionedfs.py @@ -99,6 +99,8 @@ class PartitionedMount(Mount): """ Add the next partition. Prtitions have to be added in the first-to-last order. """ + ks_pnum = len(self.partitions) + # Converting MB to sectors for parted size = size * 1024 * 1024 / self.sector_size @@ -136,7 +138,8 @@ class PartitionedMount(Mount): break fsopts = ",".join(opts) - part = { 'size': size, # In sectors + part = { 'ks_pnum' : ks_pnum, # Partition number in the KS file + 'size': size, # In sectors 'mountpoint': mountpoint, # Mount relative to chroot 'fstype': fstype, # Filesystem type 'fsopts': fsopts, # Filesystem mount options