[lxc-devel] [lxc-ci/master] images/centos: Add CentOS VM support
monstermunchkin on Github
lxc-bot at linuxcontainers.org
Wed Mar 4 15:34:15 UTC 2020
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 357 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20200304/b9a12475/attachment.bin>
-------------- next part --------------
From e09e1dbdbe7f21dbe134db30208c926848d1947b Mon Sep 17 00:00:00 2001
From: Thomas Hipp <thomas.hipp at canonical.com>
Date: Wed, 4 Mar 2020 14:29:28 +0100
Subject: [PATCH] images/centos: Add CentOS VM support
Signed-off-by: Thomas Hipp <thomas.hipp at canonical.com>
---
images/centos.yaml | 106 +++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 106 insertions(+)
diff --git a/images/centos.yaml b/images/centos.yaml
index 054fa14..d530dc1 100644
--- a/images/centos.yaml
+++ b/images/centos.yaml
@@ -327,6 +327,9 @@ files:
path: /etc/hosts
generator: hosts
+ - path: /etc/machine-id
+ generator: dump
+
- name: ifcfg-eth0
path: /etc/sysconfig/network-scripts/ifcfg-eth0
generator: dump
@@ -375,6 +378,26 @@ files:
releases:
- 8
- 8-Stream
+ types:
+ - container
+
+ - name: ifcfg-enp5s0
+ path: /etc/sysconfig/network-scripts/ifcfg-enp5s0
+ generator: dump
+ templated: true
+ content: |-
+ DEVICE=enp5s0
+ BOOTPROTO=dhcp
+ ONBOOT=yes
+ HOSTNAME=LXC_NAME
+ TYPE=Ethernet
+ MTU=
+ DHCP_HOSTNAME=`cat /proc/sys/kernel/hostname`
+ releases:
+ - 8
+ - 8-Stream
+ types:
+ - vm
- name: ifcfg-eth0.lxd
path: /etc/sysconfig/network-scripts/ifcfg-eth0
@@ -390,6 +413,51 @@ files:
releases:
- 8
- 8-Stream
+ types:
+ - container
+
+ - name: ifcfg-enp5s0.lxd
+ path: /etc/sysconfig/network-scripts/ifcfg-enp5s0
+ generator: template
+ content: |-
+ DEVICE=enp5s0
+ BOOTPROTO=dhcp
+ ONBOOT=yes
+ HOSTNAME={{ container.name }}
+ TYPE=Ethernet
+ MTU=
+ DHCP_HOSTNAME=`cat /proc/sys/kernel/hostname`
+ releases:
+ - 8
+ - 8-Stream
+ types:
+ - vm
+
+ - 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 virtio_pci virtio_console"
+ types:
+ - vm
+ - generator: fstab
+ types:
+ - vm
- name: override.conf
path: /etc/systemd/system/NetworkManager.service.d/override.conf
@@ -468,6 +536,10 @@ files:
variants:
- cloud
+ - generator: lxd-agent
+ types:
+ - vm
+
packages:
manager: yum
update: true
@@ -501,7 +573,25 @@ packages:
variants:
- cloud
+ - packages:
+ - grub2-efi
+ - kernel-plus
+ - shim
+ action: install
+ types:
+ - vm
+
actions:
+ - trigger: post-unpack
+ action: |-
+ #!/bin/sh
+ set -eux
+
+ # Enable the centosplus repo which has a kernel with 9p support
+ sed -i 's/^enabled=0/enabled=1/' /etc/yum.repos.d/CentOS-Base.repo
+ types:
+ - vm
+
- trigger: post-packages
action: |-
#!/bin/sh
@@ -513,3 +603,19 @@ actions:
# Disable loginuid in PAM stack
sed -i '/^session.*pam_loginuid.so/s/^session/# session/' /etc/pam.d/*
+
+
+ - trigger: post-files
+ action: |-
+ #!/bin/sh
+ set -eux
+
+ # Regenerate initramfs
+ kver=$(ls /boot/initramfs-*.img | sed -r 's#.*initramfs-(.+)\.img#\1#')
+ dracut --kver "${kver}" -f
+
+ target="$(readlink -f /etc/grub2-efi.cfg)"
+ grub2-mkconfig -o "${target}"
+ sed -i "s#root=[^ ]*#root=/dev/sda2#g" "${target}"
+ types:
+ - vm
More information about the lxc-devel
mailing list