[lxc-devel] [lxc-ci/master] Add Fedora VM support
monstermunchkin on Github
lxc-bot at linuxcontainers.org
Mon Mar 2 16:27:26 UTC 2020
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 303 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20200302/4d21b080/attachment.bin>
-------------- next part --------------
From 5b26324d5cb49c01c722ce7ab528b10e2902bcf8 Mon Sep 17 00:00:00 2001
From: Thomas Hipp <thomas.hipp at canonical.com>
Date: Thu, 20 Feb 2020 10:53:52 +0100
Subject: [PATCH 1/2] images: Add Fedora VM support
Signed-off-by: Thomas Hipp <thomas.hipp at canonical.com>
---
images/fedora.yaml | 76 ++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 76 insertions(+)
diff --git a/images/fedora.yaml b/images/fedora.yaml
index 68056c1..7f31db5 100644
--- a/images/fedora.yaml
+++ b/images/fedora.yaml
@@ -36,6 +36,42 @@ targets:
lxc.arch = {{ image.architecture_kernel }}
files:
+ - path: /etc/default/grub
+ generator: dump
+ content: |-
+ # Set the recordfail timeout
+ GRUB_RECORDFAIL_TIMEOUT=0
+
+ # Do not wait on grub prompt
+ GRUB_TIMEOUT=0
+
+ # Set the default commandline
+ GRUB_CMDLINE_LINUX_DEFAULT="console=tty1 console=ttyS0"
+
+ # Set the grub console type
+ GRUB_TERMINAL=console
+
+ # Disable os-prober
+ GRUB_DISABLE_OS_PROBER=true
+ types:
+ - vm
+
+ - path: /etc/dracut.conf.d/lxd.conf
+ generator: dump
+ content: |-
+ add_drivers+=virtio_scsi
+ types:
+ - vm
+
+ - generator: fstab
+ types:
+ - vm
+
+ - path: /etc/machine-id
+ generator: dump
+ types:
+ - vm
+
- path: /etc/hostname
generator: hostname
@@ -94,6 +130,10 @@ files:
variants:
- cloud
+ - generator: lxd-agent
+ types:
+ - vm
+
packages:
manager: dnf
update: true
@@ -140,6 +180,16 @@ packages:
- sssd-client
action: remove
+ - packages:
+ - grub2-efi-x64
+ - kernel
+ - shim
+ - btrfs-progs
+ - dracut
+ action: install
+ types:
+ - vm
+
actions:
- trigger: post-packages
action: |-
@@ -167,3 +217,29 @@ actions:
systemctl enable cloud-final
variants:
- cloud
+
+ - trigger: post-unpack
+ action: |-
+ # Generate machine-id in order for the kernel stuff to be configured properly
+ systemd-machine-id-setup
+
+ - trigger: post-files
+ action: |-
+ #!/bin/sh
+ set -eux
+
+ grub2-mkconfig -o $(readlink -f /etc/grub2-efi.cfg)
+
+ # Regenerate initramfs
+ kver=$(ls /boot/initramfs-*.img | sed -r 's#.*initramfs-(.+)\.img#\1#')
+ dracut --kver "${kver}" -f
+
+ # Unmask all masked unit files
+ for f in $(find /etc/systemd/system -type l); do
+ [[ "$(readlink ${f})" == /dev/null ]] && rm "${f}"
+ done
+
+ # Remove the "Container Image" string as this is going to be am VM
+ sed -i 's/[ ]*(Container Image)//;/^VARIANT/d' /etc/os-release
+ types:
+ - vm
From 4e8fd18b4200d001eee16e232622a8dc2b60dbee Mon Sep 17 00:00:00 2001
From: Thomas Hipp <thomas.hipp at canonical.com>
Date: Mon, 2 Mar 2020 17:26:08 +0100
Subject: [PATCH 2/2] jenkins/jobs: Add Fedora VM support
Signed-off-by: Thomas Hipp <thomas.hipp at canonical.com>
---
jenkins/jobs/image-fedora.yaml | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/jenkins/jobs/image-fedora.yaml b/jenkins/jobs/image-fedora.yaml
index bed18f0..715d6fa 100644
--- a/jenkins/jobs/image-fedora.yaml
+++ b/jenkins/jobs/image-fedora.yaml
@@ -45,8 +45,13 @@
[ "${ARCH}" = "armhf" ] && ARCH="armhfp"
[ "${ARCH}" = "ppc64el" ] && ARCH="ppc64le"
+ TYPE="container"
+ if [ "${architecture}" = "amd64" ] || [ "${architecture}" = "arm64" ]; then
+ TYPE="container,vm"
+ fi
+
exec sudo /lxc-ci/bin/build-distro /lxc-ci/images/fedora.yaml \
- ${LXD_ARCHITECTURE} container 1800 ${WORKSPACE} \
+ ${LXD_ARCHITECTURE} ${TYPE} 1800 ${WORKSPACE} \
-o image.architecture=${ARCH} -o image.release=${release} \
-o image.variant=${variant}
@@ -59,7 +64,7 @@
publishers:
- archive:
- artifacts: "*.tar.xz,*.squashfs,image.yaml,serial"
+ artifacts: "*.qcow2,*.tar.xz,*.squashfs,image.yaml,serial"
only-if-success: true
- workspace-cleanup:
More information about the lxc-devel
mailing list