Multi-threaded compression and user specified disk label

Allow xz to use all available cores on node. If bootloader is disabled
in kickstart then use user provided disk label.

This speeds up disk image creation for RISC-V (riscv64) and allows
having GPT instead of msdos for partition tables.

Signed-off-by: David Abdurachmanov <david.abdurachmanov@gmail.com>
This commit is contained in:
David Abdurachmanov 2018-06-15 21:54:59 +02:00
parent 973d7dc325
commit 981a8b348a
Signed by: davidlt
GPG Key ID: 7108702C938B13C1
2 changed files with 82 additions and 1 deletions

View File

@ -0,0 +1,73 @@
diff --git a/appcreate/appliance.py b/appcreate/appliance.py
index 9f22ea2..ba0e85d 100644
--- a/appcreate/appliance.py
+++ b/appcreate/appliance.py
@@ -165,22 +165,29 @@ class ApplianceImageCreator(ImageCreator):
packages = kickstart.get_packages(self.ks)
# make this the default
partition_layout = 'msdos'
- # check for extlinux in kickstart then grub2 and falling back to grub
- if hasattr(self.ks.handler.bootloader, "extlinux"):
- if 'syslinux-extlinux' in packages:
- self.bootloader = 'extlinux'
- elif 'extlinux-bootloader' in packages:
- self.bootloader = 'extlinux-bootloader'
+ if (not hasattr(self.ks.handler.bootloader, "disabled")) or \
+ (hasattr(self.ks.handler.bootloader, "disabled") and self.ks.handler.bootloader.disabled is False):
+ # check for extlinux in kickstart then grub2 and falling back to grub
+ if hasattr(self.ks.handler.bootloader, "extlinux"):
+ if 'syslinux-extlinux' in packages:
+ self.bootloader = 'extlinux'
+ elif 'extlinux-bootloader' in packages:
+ self.bootloader = 'extlinux-bootloader'
+ else:
+ logging.warning("WARNING! syslinux-extlinux package not found.")
else:
- logging.warning("WARNING! syslinux-extlinux package not found.")
+ if 'grub2' in packages:
+ self.bootloader = 'grub2'
+ partition_layout = 'gpt'
+ elif 'grub' in packages:
+ self.bootloader = 'grub'
+ else:
+ logging.warning("WARNING! grub package not found.")
else:
- if 'grub2' in packages:
- self.bootloader = 'grub2'
- partition_layout = 'gpt'
- elif 'grub' in packages:
- self.bootloader = 'grub'
- else:
- logging.warning("WARNING! grub package not found.")
+ # user explicitly disabled bootloader (i.e. not part of the image)
+ if hasattr(self.ks.handler.clearpart, "disklabel"):
+ logging.debug("Using user set default disk label: {}".format(self.ks.handler.clearpart.disklabel))
+ partition_layout = self.ks.handler.clearpart.disklabel
self.__instloop = PartitionedMount(self.__disks,
self._instroot,
@@ -507,9 +514,12 @@ class ApplianceImageCreator(ImageCreator):
def _create_bootconfig(self):
logging.debug("Writing kickstart file.")
self._write_kickstart()
- # For EC2 lets always make a grub Legacy config file
- logging.debug("Writing GRUB Legacy config.")
- self._create_grub_config()
+ # For EC2 lets make a grub Legacy config file
+ # (only if bootloader is enabled)
+ if (hasattr(self.ks.handler.bootloader, "disabled") and self.ks.handler.bootloader.disabled is False) and \
+ (hasattr(self.ks.handler.bootloader, "location") and self.ks.handler.bootloader.location != "none"):
+ logging.debug("Writing GRUB Legacy config.")
+ self._create_grub_config()
if self.bootloader == 'grub2':
# We have GRUB2 package installed
@@ -634,7 +644,7 @@ class ApplianceImageCreator(ImageCreator):
if self.__compress:
# Compress with xz using 16 MiB block size for seekability
- rc = subprocess.call(["xz", "-z", "--block-size=16777216", src])
+ rc = subprocess.call(["xz", "-z", "--block-size=16777216", "-T 0", src])
if rc == 0:
logging.debug("compression successful")
if rc != 0:

View File

@ -1,7 +1,7 @@
Name: appliance-tools
Summary: Tools for building Appliances
Version: 008.0
Release: 8%{?dist}
Release: 8.0.riscv64%{?dist}
License: GPLv2
Group: System Environment/Base
URL: https://pagure.io/appliance-tools
@ -13,6 +13,10 @@ Patch0: 0001-Set-releasever.patch
Patch1: 0002-Make-it-possible-to-disable-compression.patch
Patch3: 0001-Use-block-size-with-xz-to-make-seekable-xz-compresse.patch
Patch4: 0001-Remove-usage-of-kickstart.get_modules-rhbz-1544075.patch
# See: https://pagure.io/appliance-tools/pull-request/4
# See: https://pagure.io/appliance-tools/pull-request/3
# These are not arch specific changes, they are generic
Patch5: appliance-tools-008.0-riscv64-mods.patch
# Ensure system deps are installed (rhbz#1409536)
Requires: python2-imgcreate >= 1:25.0-2
@ -57,6 +61,10 @@ rm -fv %{buildroot}%{_pkgdocdir}/COPYING
%{python2_sitelib}/ec2convert/*
%changelog
* Fri Jun 15 2018 David Abdurachmanov <david.abdurachmanov@gmail.com> - 008.0-8.0.riscv64
- Allow xz to use all cores on machine for compression
- If bootloader is disabled use user provided disk label
* Sat Feb 10 2018 Neal Gompa <ngompa13@gmail.com> - 008.0-8
- Fix compatibility with pykickstart 3.9+ (#1544075)
- Bump requires of livecd-tools to minimum version with pykickstart 3.9+ compatibility