From af68a98abe9bcf8071f4578a982368ea88ad9852 Mon Sep 17 00:00:00 2001 From: "Brian C. Lane" Date: Tue, 20 Mar 2018 14:07:49 -0700 Subject: [PATCH] Add qcow2 image type Very similar to partitioned-disk, image is named disk.qcow2 instead of disk.img --- lorax.spec | 1 + share/composer/qcow2.ks | 56 ++++++++++++++++++++++++++++++++++++++ src/pylorax/api/compose.py | 26 ++++++++++++++++-- 3 files changed, 80 insertions(+), 3 deletions(-) create mode 100644 share/composer/qcow2.ks diff --git a/lorax.spec b/lorax.spec index 08eabebe..dc9798e4 100644 --- a/lorax.spec +++ b/lorax.spec @@ -97,6 +97,7 @@ Requires: libgit2-glib Requires: python-flask Requires: python-gevent Requires: anaconda-tui +Requires: qemu-img %{?systemd_requires} BuildRequires: systemd diff --git a/share/composer/qcow2.ks b/share/composer/qcow2.ks new file mode 100644 index 00000000..242ca216 --- /dev/null +++ b/share/composer/qcow2.ks @@ -0,0 +1,56 @@ +# Lorax Composer qcow2 output kickstart template + +# +sshpw --username=root --plaintext randOmStrinGhERE +# Firewall configuration +firewall --enabled + +# Root password +rootpw --plaintext removethispw +# Network information +network --bootproto=dhcp --onboot=on --activate +# System authorization information +auth --useshadow --enablemd5 +# System keyboard +keyboard --xlayouts=us --vckeymap=us +# System language +lang en_US.UTF-8 +# SELinux configuration +selinux --enforcing +# Installation logging level +logging --level=info +# Shutdown after installation +shutdown +# System timezone +timezone US/Eastern +# System bootloader configuration +bootloader --location=mbr +# Clear the Master Boot Record +zerombr +# Partition clearing information +clearpart --all +# Disk partitioning information +part / --fstype="ext4" --size=4000 +part swap --size=1000 + +%post +# Remove root password +passwd -d root > /dev/null + +# Remove random-seed +rm /var/lib/systemd/random-seed +%end + +%packages +kernel +-dracut-config-rescue + +shim +shim-ia32 +grub2 +grub2-efi +grub2-efi-*-cdboot +grub2-efi-ia32 +efibootmgr + +# NOTE lorax-composer will add the recipe packages below here, including the final %end diff --git a/src/pylorax/api/compose.py b/src/pylorax/api/compose.py index 3c76362d..04e61643 100644 --- a/src/pylorax/api/compose.py +++ b/src/pylorax/api/compose.py @@ -247,7 +247,7 @@ def compose_args(compose_type): "live_rootfs_keep_size": False, "live_rootfs_size": 0, "qcow2": False, - "qcow2_arg": [], + "qcow2_args": [], "image_name": default_image_name("xz", "root.tar"), "image_only": True, "app_name": None, @@ -266,7 +266,7 @@ def compose_args(compose_type): "live_rootfs_keep_size": False, "live_rootfs_size": 0, "qcow2": False, - "qcow2_arg": [], + "qcow2_args": [], "image_name": "live.iso", "fs_label": "Anaconda", # Live booting may expect this to be 'Anaconda' "image_only": False, @@ -286,7 +286,7 @@ def compose_args(compose_type): "live_rootfs_keep_size": False, "live_rootfs_size": 0, "qcow2": False, - "qcow2_arg": [], + "qcow2_args": [], "image_name": "disk.img", "fs_label": "", "image_only": True, @@ -294,6 +294,26 @@ def compose_args(compose_type): "app_template": None, "app_file": None }, + "qcow2": {"make_iso": False, + "make_disk": True, + "make_fsimage": False, + "make_appliance": False, + "make_ami": False, + "make_tar": False, + "make_pxe_live": False, + "make_ostree_live": False, + "ostree": False, + "live_rootfs_keep_size": False, + "live_rootfs_size": 0, + "qcow2": True, + "qcow2_args": [], + "image_name": "disk.qcow2", + "fs_label": "", + "image_only": True, + "app_name": None, + "app_template": None, + "app_file": None + }, } return _MAP[compose_type]