summaryrefslogtreecommitdiffstats
path: root/scripts/lib/wic/plugins/imager/direct.py
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/lib/wic/plugins/imager/direct.py')
-rw-r--r--scripts/lib/wic/plugins/imager/direct.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/scripts/lib/wic/plugins/imager/direct.py b/scripts/lib/wic/plugins/imager/direct.py
index 235eb24f59..7d38ab34fb 100644
--- a/scripts/lib/wic/plugins/imager/direct.py
+++ b/scripts/lib/wic/plugins/imager/direct.py
@@ -344,6 +344,10 @@ class PartitionedImage():
344 344
345 logger.debug("Assigning %s partitions to disks", self.ptable_format) 345 logger.debug("Assigning %s partitions to disks", self.ptable_format)
346 346
347 # The number of primary and logical partitions. Extended partition and
348 # partitions not listed in the table are not included.
349 num_real_partitions = len([p for p in self.partitions if not p.no_table])
350
347 # Go through partitions in the order they are added in .ks file 351 # Go through partitions in the order they are added in .ks file
348 for num in range(len(self.partitions)): 352 for num in range(len(self.partitions)):
349 part = self.partitions[num] 353 part = self.partitions[num]
@@ -369,7 +373,7 @@ class PartitionedImage():
369 # Skip one sector required for the partitioning scheme overhead 373 # Skip one sector required for the partitioning scheme overhead
370 self.offset += overhead 374 self.offset += overhead
371 375
372 if self.realpart > 3: 376 if self.realpart > 3 and num_real_partitions > 4:
373 # Reserve a sector for EBR for every logical partition 377 # Reserve a sector for EBR for every logical partition
374 # before alignment is performed. 378 # before alignment is performed.
375 if self.ptable_format == "msdos": 379 if self.ptable_format == "msdos":
@@ -408,7 +412,7 @@ class PartitionedImage():
408 412
409 if self.ptable_format == "msdos": 413 if self.ptable_format == "msdos":
410 # only count the partitions that are in partition table 414 # only count the partitions that are in partition table
411 if len([p for p in self.partitions if not p.no_table]) > 4: 415 if num_real_partitions > 4:
412 if self.realpart > 3: 416 if self.realpart > 3:
413 part.type = 'logical' 417 part.type = 'logical'
414 part.num = self.realpart + 1 418 part.num = self.realpart + 1