From 98f8b2312951791d42f4f6a71706fb03f46539c7 Mon Sep 17 00:00:00 2001 From: "Brian C. Lane" Date: Fri, 5 Oct 2018 13:20:58 -0700 Subject: [PATCH] Add an openstack image type This is a qcow2 image with cloud-init in the template. --- share/composer/openstack.ks | 46 ++++++++++++++++++++++++++++++++ src/pylorax/api/compose.py | 22 +++++++++++++++ tests/cli/test_compose_sanity.sh | 2 +- tests/pylorax/test_server.py | 2 +- 4 files changed, 70 insertions(+), 2 deletions(-) create mode 100644 share/composer/openstack.ks diff --git a/share/composer/openstack.ks b/share/composer/openstack.ks new file mode 100644 index 00000000..7db64163 --- /dev/null +++ b/share/composer/openstack.ks @@ -0,0 +1,46 @@ +# Lorax Composer openstack output kickstart template + +# Firewall configuration +firewall --disabled + +# NOTE: The root account is locked by default +# Network information +network --bootproto=dhcp --onboot=on --activate +# 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 --append="no_timer_check console=ttyS0,115200n8 console=tty1 net.ifnames=0" + +# Start sshd and cloud-init at boot time +services --enabled=sshd,cloud-init,cloud-init-local,cloud-config,cloud-final + +%post +# Remove random-seed +rm /var/lib/systemd/random-seed + +# Clear /etc/machine-id +rm /etc/machine-id +touch /etc/machine-id +%end + +%packages +kernel +-dracut-config-rescue +grub2 + +# Make sure virt guest agents are installed +qemu-guest-agent +spice-vdagent +cloud-init + +# 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 703c24e6..a367ab96 100644 --- a/src/pylorax/api/compose.py +++ b/src/pylorax/api/compose.py @@ -628,6 +628,28 @@ def compose_args(compose_type): "app_template": None, "app_file": None, }, + "openstack": {"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, + "make_oci": False, + "make_vagrant": False, + "ostree": False, + "live_rootfs_keep_size": False, + "live_rootfs_size": 0, + "image_type": "qcow2", + "qemu_args": [], + "image_name": "disk.qcow2", + "fs_label": "", + "image_only": True, + "app_name": None, + "app_template": None, + "app_file": None, + }, } return _MAP[compose_type] diff --git a/tests/cli/test_compose_sanity.sh b/tests/cli/test_compose_sanity.sh index 5f1c6914..2e5b9013 100755 --- a/tests/cli/test_compose_sanity.sh +++ b/tests/cli/test_compose_sanity.sh @@ -9,7 +9,7 @@ CLI="./src/bin/composer-cli" rlJournalStart rlPhaseStartTest "compose types" rlAssertEquals "lists all supported types" \ - "`$CLI compose types | sort | xargs`" "ami ext4-filesystem live-iso partitioned-disk qcow2 tar vhd vmdk" + "`$CLI compose types | sort | xargs`" "ami ext4-filesystem live-iso openstack partitioned-disk qcow2 tar vhd vmdk" rlPhaseEnd rlPhaseStartTest "compose start" diff --git a/tests/pylorax/test_server.py b/tests/pylorax/test_server.py index a63a931d..e66ecdd8 100644 --- a/tests/pylorax/test_server.py +++ b/tests/pylorax/test_server.py @@ -810,7 +810,7 @@ class ServerTestCase(unittest.TestCase): data = json.loads(resp.data) self.assertNotEqual(data, None) self.assertEqual(data["status"], False, "Failed to fail to start test compose: %s" % data) - self.assertEqual(data["errors"], [{"id": BAD_COMPOSE_TYPE, "msg": "Invalid compose type (snakes), must be one of ['ami', 'ext4-filesystem', 'live-iso', 'partitioned-disk', 'qcow2', 'tar', 'vhd', 'vmdk']"}], + self.assertEqual(data["errors"], [{"id": BAD_COMPOSE_TYPE, "msg": "Invalid compose type (snakes), must be one of ['ami', 'ext4-filesystem', 'live-iso', 'openstack', 'partitioned-disk', 'qcow2', 'tar', 'vhd', 'vmdk']"}], "Failed to get errors: %s" % data) def test_compose_03_status_fail(self):