Skip to content

Commit 08917bd

Browse files
authored
Merge pull request #4075 from PaulYuuu/c10s-support
CentOS Stream 10 definition and image mode guest support
2 parents 4ff7f3d + 02e915c commit 08917bd

6 files changed

Lines changed: 250 additions & 0 deletions

File tree

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
- 10:
2+
variants:
3+
- aarch64:
4+
vm_arch_name = aarch64
5+
- ppc64le:
6+
vm_arch_name = ppc64le
7+
- s390x:
8+
vm_arch_name = s390x
9+
- x86_64:
10+
vm_arch_name = x86_64
11+
os_variant = centos-stream10
12+
mem = 4096
13+
image_size = 15G
14+
unattended_install.url:
15+
url = https://mirror.stream.centos.org/10-stream/BaseOS/${vm_arch_name}/os/
16+
nic_hotplug:
17+
modprobe_module =
18+
block_hotplug:
19+
modprobe_module =
20+
no unattended_install..floppy_ks
21+
unattended_install, check_block_size..extra_cdrom_ks,svirt_install:
22+
cdrom_unattended = images/${os_variant}-${vm_arch_name}/ks.iso
23+
syslog_server_proto = udp
24+
unattended_install, svirt_install:
25+
kernel = images/${os_variant}-${vm_arch_name}/vmlinuz
26+
initrd = images/${os_variant}-${vm_arch_name}/initrd.img
27+
# ARCH dependent things
28+
aarch64:
29+
grub_file = /boot/efi/EFI/redhat/grub.cfg
30+
install_timeout = 7200
31+
kernel_params = "console=ttyAMA0 console=ttyS0"
32+
ppc64le:
33+
no guest_s3, guest_s4
34+
mem_chk_cmd = numactl --hardware | awk -F: '/size/ {print $2}'
35+
netdev_peer_re = "(.*?): .*?\\\s(.*?):"
36+
kernel_params = "console=hvc0 console=ttyS0"
37+
s390x:
38+
grub_file = /boot/grub/grub.conf
39+
install_timeout = 7200
40+
kernel = images/${os_variant}-${vm_arch_name}/kernel.img
41+
kernel_params = "console=ttysclp0 console=ttyS0"
42+
x86_64:
43+
grub_file = /boot/grub2/grub.cfg
44+
kernel_params = "console=tty0 console=ttyS0"
45+
extra_cdrom_ks:
46+
kernel_params += " inst.ks=cdrom"
47+
kernel_params += " inst.sshd ip=dhcp"
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
- bootc:
2+
# Uses defaults set in 10.cfg
3+
# Adding x.y versions should only require changing the kickstart
4+
# and adding per-arch image sha.
5+
image_name = images/${os_variant}devel-${vm_arch_name}
6+
unattended_install.cdrom:
7+
# NOTE: Reuse devel ISO or point to a new location for bootc
8+
cdrom_cd1 = isos/linux/CentOS-Stream-10-devel-${vm_arch_name}.iso
9+
unattended_install, check_block_size, svirt_install:
10+
unattended_file = unattended/CentOS-Stream-10-bootc.ks
11+
kickstart_bootc_image = quay.io/centos-bootc/centos-bootc:stream10
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
- devel:
2+
# Uses defaults set in 10.cfg
3+
# Adding x.y versions should only require changing the kickstart
4+
# and adding per-arch image sha.
5+
image_name = images/${os_variant}devel-${vm_arch_name}
6+
unattended_install.cdrom:
7+
cdrom_cd1 = isos/linux/CentOS-Stream-10-devel-${vm_arch_name}.iso
8+
unattended_install, check_block_size, svirt_install:
9+
unattended_file = unattended/CentOS-Stream-10-devel.ks
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
KVM_TEST_MEDIUM
2+
GRAPHICAL_OR_TEXT
3+
poweroff
4+
lang en_US.UTF-8
5+
keyboard us
6+
network --onboot yes --device eth0 --bootproto dhcp
7+
rootpw --plaintext 123456
8+
firstboot --disable
9+
user --name=test --password=123456
10+
# Disable firewalld, as pkg may not be installed in the bootable image
11+
firewall --disabled
12+
selinux --enforcing
13+
timezone --utc America/New_York
14+
bootloader --location=mbr --append="console=tty0 console=ttyS0,115200"
15+
zerombr
16+
KVM_TEST_LOGGING
17+
clearpart --all --initlabel
18+
autopart
19+
xconfig --startxonboot
20+
# Additional repositories could be specified in 'kickstart_extra_repos' parameter
21+
KVM_TEST_REPOS
22+
23+
ostreecontainer --url BOOTC_IMAGE
24+
25+
%post
26+
# Output to all consoles defined in /proc/consoles, use "major:minor" as
27+
# device names are unreliable on some platforms
28+
# https://bugzilla.redhat.com/show_bug.cgi?id=1351968
29+
function ECHO { for TTY in `cat /proc/consoles | grep -v ttyS0 | awk '{print $NF}'`; do source "/sys/dev/char/$TTY/uevent" && echo "$*" > /dev/$DEVNAME; done }
30+
ECHO "OS install is completed"
31+
case $(arch) in
32+
"x86_64")
33+
arg="console=tty0 console=ttyS0"
34+
;;
35+
"s390x")
36+
arg="console=hvc0 console=ttyS0"
37+
;;
38+
"ppc64le")
39+
arg="console=hvc0 console=ttyS0"
40+
;;
41+
"aarch64")
42+
arg="console=ttyAMA0 console=ttyS0"
43+
;;
44+
esac
45+
ECHO "remove rhgb quiet by grubby and add kernel console parameters"
46+
grubby --remove-args="rhgb quiet" --args="$arg" --update-kernel=$(grubby --default-kernel)
47+
ECHO "dhclient"
48+
dhclient
49+
ECHO "systemctl enable sshd"
50+
sed -i "s/^#PermitRootLogin .*/PermitRootLogin yes/g" /etc/ssh/sshd_config
51+
systemctl enable sshd
52+
ECHO "iptables -F"
53+
iptables -F
54+
ECHO "systemctl enable NetworkManager"
55+
systemctl enable NetworkManager.service
56+
ECHO "Disable lock cdrom udev rules"
57+
sed -i "/--lock-media/s/^/#/" /usr/lib/udev/rules.d/60-cdrom_id.rules 2>/dev/null>&1
58+
#Workaround for graphical boot as anaconda seems to always instert skipx
59+
systemctl set-default graphical.target
60+
cat > '/etc/gdm/custom.conf' << EOF
61+
[daemon]
62+
AutomaticLogin=test
63+
AutomaticLoginEnable=True
64+
EOF
65+
cat >> '/etc/sudoers' << EOF
66+
test ALL = NOPASSWD: /sbin/shutdown -r now,/sbin/shutdown -h now
67+
EOF
68+
cat >> '/home/test/.bashrc' << EOF
69+
alias shutdown='sudo shutdown'
70+
EOF
71+
ECHO 'Post set up finished'
72+
%end
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
KVM_TEST_MEDIUM
2+
GRAPHICAL_OR_TEXT
3+
poweroff
4+
lang en_US.UTF-8
5+
keyboard us
6+
network --onboot yes --device eth0 --bootproto dhcp
7+
rootpw --plaintext 123456
8+
firstboot --disable
9+
user --name=test --password=123456
10+
firewall --enabled --ssh
11+
selinux --enforcing
12+
timezone --utc America/New_York
13+
bootloader --location=mbr --append="console=tty0 console=ttyS0,115200"
14+
zerombr
15+
KVM_TEST_LOGGING
16+
clearpart --all --initlabel
17+
autopart
18+
xconfig --startxonboot
19+
# Additional repositories could be specified in 'kickstart_extra_repos' parameter
20+
KVM_TEST_REPOS
21+
22+
%packages --ignoremissing
23+
@base
24+
@core
25+
@development
26+
@additional-devel
27+
@debugging
28+
@network-tools
29+
@gnome-desktop
30+
@fonts
31+
@smart-card
32+
dhcp-client
33+
python3-six
34+
python3-pyparsing
35+
net-tools
36+
NetworkManager
37+
dconf
38+
watchdog
39+
coreutils
40+
usbutils
41+
docbook-utils
42+
sgml-common
43+
openjade
44+
virt-viewer
45+
pulseaudio-libs-devel
46+
mesa-libGL-devel
47+
libjpeg-turbo-devel
48+
spice-vdagent
49+
usbredir
50+
SDL
51+
totem
52+
dmidecode
53+
alsa-utils
54+
sg3_utils
55+
-gnome-initial-setup
56+
%end
57+
58+
%post
59+
# Output to all consoles defined in /proc/consoles, use "major:minor" as
60+
# device names are unreliable on some platforms
61+
# https://bugzilla.redhat.com/show_bug.cgi?id=1351968
62+
function ECHO { for TTY in `cat /proc/consoles | grep -v ttyS0 | awk '{print $NF}'`; do source "/sys/dev/char/$TTY/uevent" && echo "$*" > /dev/$DEVNAME; done }
63+
ECHO "OS install is completed"
64+
case $(arch) in
65+
"x86_64")
66+
arg="console=tty0 console=ttyS0"
67+
;;
68+
"s390x")
69+
arg="console=hvc0 console=ttyS0"
70+
;;
71+
"ppc64le")
72+
arg="console=hvc0 console=ttyS0"
73+
;;
74+
"aarch64")
75+
arg="console=ttyAMA0 console=ttyS0"
76+
;;
77+
esac
78+
ECHO "remove rhgb quiet by grubby and add kernel console parameters"
79+
grubby --remove-args="rhgb quiet" --args="$arg" --update-kernel=$(grubby --default-kernel)
80+
ECHO "dhclient"
81+
dhclient
82+
ECHO "systemctl enable sshd"
83+
sed -i "s/^#PermitRootLogin .*/PermitRootLogin yes/g" /etc/ssh/sshd_config
84+
systemctl enable sshd
85+
ECHO "iptables -F"
86+
iptables -F
87+
ECHO "systemctl enable NetworkManager"
88+
systemctl enable NetworkManager.service
89+
ECHO "Disable lock cdrom udev rules"
90+
sed -i "/--lock-media/s/^/#/" /usr/lib/udev/rules.d/60-cdrom_id.rules 2>/dev/null>&1
91+
#Workaround for graphical boot as anaconda seems to always instert skipx
92+
systemctl set-default graphical.target
93+
cat > '/etc/gdm/custom.conf' << EOF
94+
[daemon]
95+
AutomaticLogin=test
96+
AutomaticLoginEnable=True
97+
EOF
98+
cat >> '/etc/sudoers' << EOF
99+
test ALL = NOPASSWD: /sbin/shutdown -r now,/sbin/shutdown -h now
100+
EOF
101+
cat >> '/home/test/.bashrc' << EOF
102+
alias shutdown='sudo shutdown'
103+
EOF
104+
ECHO 'Post set up finished'
105+
%end

virttest/tests/unattended_install.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -488,6 +488,12 @@ def answer_kickstart(self, answer_path):
488488
pkgs = self.params.get("kickstart_lock_pkgs", "")
489489
contents = re.sub(dummy_lock_pkgs_re, pkgs, contents)
490490

491+
dummy_bootc_image_re = r"\bBOOTC_IMAGE\b"
492+
if re.search(dummy_bootc_image_re, contents):
493+
# Path to the bootloader image
494+
bootc_image = self.params.get("kickstart_bootc_image", "")
495+
contents = re.sub(dummy_bootc_image_re, bootc_image, contents)
496+
491497
dummy_logging_re = r"\bKVM_TEST_LOGGING\b"
492498
if re.search(dummy_logging_re, contents):
493499
if self.syslog_server_enabled == "yes":

0 commit comments

Comments
 (0)