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 <artem.bityutskiy@intel.com>
""" 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
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