livemedia-creator: Fix calculation of disk_size in some cases

If the kickstart includes multiple definitions for the same mount point,
the last one defined is used. The current code includes all of them in
size calculation, and the image file that livemedia-creator makes is big
enough to hold all of the partitions, even though the duplicates are
ignored by Anaconda.
This commit is contained in:
Scott K Logan 2015-12-12 15:35:16 -08:00 committed by Brian C. Lane
parent f04fa1ea34
commit 33d008d9f2

View File

@ -931,10 +931,11 @@ def make_image(opts, ks):
""" """
# Disk size for a filesystem image should only be the size of / # Disk size for a filesystem image should only be the size of /
# to prevent surprises when using the same kickstart for different installations. # to prevent surprises when using the same kickstart for different installations.
unique_partitions = dict((p.mountpoint, p) for p in ks.handler.partition.partitions)
if opts.no_virt and (opts.make_iso or opts.make_fsimage): if opts.no_virt and (opts.make_iso or opts.make_fsimage):
disk_size = 2 + sum(p.size for p in ks.handler.partition.partitions if p.mountpoint == "/") disk_size = 2 + sum(p.size for p in unique_partitions.values() if p.mountpoint == "/")
else: else:
disk_size = 2 + sum(p.size for p in ks.handler.partition.partitions) disk_size = 2 + sum(p.size for p in unique_partitions.values())
log.info("disk_size = %sMiB", disk_size) log.info("disk_size = %sMiB", disk_size)
if opts.image_name: if opts.image_name: