Add a pxe/uefi/grub2 CI job

Fixes the grub2 based devstack logic and adds a grub2 CI job
such that the ironic team can safely clean-up some of the PXE
code without fear of breaking the grub2 scenario.

Story: 2003936
Task: 27724
Change-Id: Ieb395bf35e2689741a243c11b56d08a237b200bc
This commit is contained in:
Julia Kreger 2018-10-29 10:22:22 -07:00
parent 73845b3655
commit 55e8d3fde1
6 changed files with 61 additions and 12 deletions

View File

@ -22,6 +22,9 @@ pxelinux [platform:ubuntu-xenial platform:debian-jessie default]
syslinux [platform:rpm platform:ubuntu-trusty platform:debian-wheezy default] syslinux [platform:rpm platform:ubuntu-trusty platform:debian-wheezy default]
syslinux-common [platform:ubuntu-xenial platform:debian-jessie default] syslinux-common [platform:ubuntu-xenial platform:debian-jessie default]
socat [default] socat [default]
# Grub2 files for boot loadingusing PXE/GRUB2
shim [platform:dpkg default]
grub-efi-amd64-signed [platform:dpkg default]
# these are needed to create and access VMs when testing with virtual hardware # these are needed to create and access VMs when testing with virtual hardware
libvirt-bin [platform:dpkg devstack] libvirt-bin [platform:dpkg devstack]

View File

@ -36,3 +36,5 @@ libvirt-dev
socat socat
ipxe-qemu ipxe-qemu
jq jq
shim
grub-efi-amd64-signed

View File

@ -510,7 +510,16 @@ if [[ "$IRONIC_BOOT_MODE" == "uefi" ]]; then
die $LINENO "Boot mode UEFI only works in Ubuntu or Fedora for now." die $LINENO "Boot mode UEFI only works in Ubuntu or Fedora for now."
fi fi
if is_ubuntu && [[ -z $IRONIC_GRUB2_FILE ]]; then
IRONIC_GRUB2_SHIM_FILE=/usr/lib/shim/shimx64.efi
IRONIC_GRUB2_FILE=/usr/lib/grub/x86_64-efi-signed/grubx64.efi.signed
fi
if [[ "$IRONIC_IPXE_ENABLED" == "False" ]]; then if [[ "$IRONIC_IPXE_ENABLED" == "False" ]]; then
# NOTE(TheJulia): While we no longer directly copy the
# IRONIC_GRUB2_FILE, we still check the exisstence as
# without the bootloader package we would be unable to build
# the netboot core image.
if [[ -z $IRONIC_GRUB2_SHIM_FILE ]] || [[ -z $IRONIC_GRUB2_FILE ]] || [[ ! -f $IRONIC_GRUB2_SHIM_FILE ]] || [[ ! -f $IRONIC_GRUB2_FILE ]]; then if [[ -z $IRONIC_GRUB2_SHIM_FILE ]] || [[ -z $IRONIC_GRUB2_FILE ]] || [[ ! -f $IRONIC_GRUB2_SHIM_FILE ]] || [[ ! -f $IRONIC_GRUB2_FILE ]]; then
die $LINENO "Grub2 Bootloader and Shim file missing." die $LINENO "Grub2 Bootloader and Shim file missing."
fi fi
@ -976,8 +985,8 @@ function install_ironic {
sudo dpkg -i "$temp_deb" sudo dpkg -i "$temp_deb"
rm -f "$temp_deb" rm -f "$temp_deb"
sudo rm /usr/share/qemu/pxe-virtio.rom # sudo rm /usr/share/qemu/pxe-virtio.rom
sudo ln -s /usr/lib/ipxe/qemu/efi-virtio.rom /usr/share/qemu/pxe-virtio.rom # sudo ln -s /usr/lib/ipxe/qemu/efi-virtio.rom /usr/share/qemu/pxe-virtio.rom
elif is_fedora; then elif is_fedora; then
sudo rm /usr/share/qemu/pxe-virtio.rom sudo rm /usr/share/qemu/pxe-virtio.rom
sudo ln -s /usr/share/ipxe.efi/1af41000.rom /usr/share/qemu/pxe-virtio.rom sudo ln -s /usr/share/ipxe.efi/1af41000.rom /usr/share/qemu/pxe-virtio.rom
@ -1100,16 +1109,17 @@ function configure_ironic_dirs {
fi fi
if [[ "$IRONIC_BOOT_MODE" == "uefi" ]]; then if [[ "$IRONIC_BOOT_MODE" == "uefi" ]]; then
local uefi_ipxe_boot_file local uefi_boot_file
local uefi_loader local uefi_loader
local uefi_nvram local uefi_nvram
uefi_ipxe_boot_file=$(get_uefi_ipxe_boot_file)
if [ ! -f $uefi_ipxe_boot_file ]; then uefi_boot_file=$(get_uefi_ipxe_boot_file)
die $LINENO "iPXE UEFI boot file $uefi_pxe_bootfile_name not found." if [ ! -f $uefi_boot_file ]; then
die $LINENO "UEFI boot file $uefi_boot_file not found."
fi fi
cp $uefi_ipxe_boot_file $IRONIC_TFTPBOOT_DIR cp $uefi_boot_file $IRONIC_TFTPBOOT_DIR
# Copy the OVMF images to libvirt's path # Copy the OVMF images to libvirt's path
uefi_loader=$(get_uefi_loader) uefi_loader=$(get_uefi_loader)
@ -1792,6 +1802,8 @@ SUBSHELL
vbmc_port=$((vbmc_port+1)) vbmc_port=$((vbmc_port+1))
pdu_outlet=$((pdu_outlet+1)) pdu_outlet=$((pdu_outlet+1))
# It is sometimes useful to dump out the VM configuration to validate it.
# sudo virsh dumpxml $vm_name
done done
if [[ -z "${IRONIC_PROVISION_NETWORK_NAME}" ]]; then if [[ -z "${IRONIC_PROVISION_NETWORK_NAME}" ]]; then
@ -1812,7 +1824,10 @@ SUBSHELL
fi fi
sudo ip route replace $replace_range via $r_net_gateway sudo ip route replace $replace_range via $r_net_gateway
fi fi
# Here is a good place to restart tcpdump to begin capturing packets.
# See: https://docs.openstack.org/devstack/latest/debugging.html
# stop_tcpdump
# start_tcpdump
} }
function wait_for_nova_resources { function wait_for_nova_resources {
@ -2337,20 +2352,28 @@ function configure_tftpd {
echo "re ^([^/]) $IRONIC_TFTPBOOT_DIR/\1" >>$IRONIC_TFTPBOOT_DIR/map-file echo "re ^([^/]) $IRONIC_TFTPBOOT_DIR/\1" >>$IRONIC_TFTPBOOT_DIR/map-file
sudo cp $IRONIC_GRUB2_SHIM_FILE $IRONIC_TFTPBOOT_DIR/bootx64.efi sudo cp $IRONIC_GRUB2_SHIM_FILE $IRONIC_TFTPBOOT_DIR/bootx64.efi
sudo cp $IRONIC_GRUB2_FILE $IRONIC_TFTPBOOT_DIR/grubx64.efi
if is_fedora; then if is_fedora; then
grub_subdir="EFI/fedora"
grub_dir=$IRONIC_TFTPBOOT_DIR/EFI/fedora grub_dir=$IRONIC_TFTPBOOT_DIR/EFI/fedora
elif is_ubuntu; then elif is_ubuntu; then
grub_dir=$IRONIC_TFTPBOOT_DIR/grub grub_subdir="boot/grub"
grub_dir=$IRONIC_TFTPBOOT_DIR/boot/grub
fi fi
mkdir -p $grub_dir mkdir -p $grub_dir
# Grub looks for numerous files when the grubnetx.efi binary is used :\
# specifically .lst files which define module lists which we can't seem
# to find on disk. That being said, the grub-mknetdir utility generates
# these files for us.
grub-mknetdir --net-directory="$IRONIC_TFTPBOOT_DIR" --subdir="$grub_subdir"
sudo cp $IRONIC_TFTPBOOT_DIR/$grub_subdir/x86_64-efi/core.efi $IRONIC_TFTPBOOT_DIR/grubx64.efi
cat << EOF > $grub_dir/grub.cfg cat << EOF > $grub_dir/grub.cfg
set default=master set default=master
set timeout=5 set timeout=1
set hidden_timeout_quiet=false set hidden_timeout_quiet=false
menuentry "master" { menuentry "master" {
configfile $IRONIC_TFTPBOOT_DIR/\$net_default_ip.conf configfile $IRONIC_TFTPBOOT_DIR/\$net_default_mac.conf
} }
EOF EOF
chmod 644 $grub_dir/grub.cfg chmod 644 $grub_dir/grub.cfg

View File

@ -4,7 +4,9 @@
<vcpu>{{ cpus }}</vcpu> <vcpu>{{ cpus }}</vcpu>
<os> <os>
<type arch='{{ arch }}' machine='pc-1.0'>hvm</type> <type arch='{{ arch }}' machine='pc-1.0'>hvm</type>
{% if bootdev == 'network' and not uefi_loader %}
<boot dev='{{ bootdev }}'/> <boot dev='{{ bootdev }}'/>
{% endif %}
{% if uefi_loader %} {% if uefi_loader %}
<loader readonly='yes' type='pflash'>{{ uefi_loader }}</loader> <loader readonly='yes' type='pflash'>{{ uefi_loader }}</loader>
{% if uefi_nvram %} {% if uefi_nvram %}
@ -52,6 +54,9 @@
<source dev='{{ "tap-" + name + "i" + n|string }}'/> <source dev='{{ "tap-" + name + "i" + n|string }}'/>
<model type='{{ nicdriver }}'/> <model type='{{ nicdriver }}'/>
<address type='pci' domain='0x0000' bus='0x01' slot='{{ "0x0" + n|string }}' function='0x0'/> <address type='pci' domain='0x0000' bus='0x01' slot='{{ "0x0" + n|string }}' function='0x0'/>
{% if uefi_loader and bootdev == 'network' %}
<boot order='{{ n|string }}'/>
{% endif %}
</interface> </interface>
{% endfor %} {% endfor %}
<input type='mouse' bus='ps2'/> <input type='mouse' bus='ps2'/>

View File

@ -479,3 +479,17 @@
IRONIC_INSPECTOR_POWER_OFF: False IRONIC_INSPECTOR_POWER_OFF: False
IRONIC_DEPLOY_FAST_TRACK: True IRONIC_DEPLOY_FAST_TRACK: True
IRONIC_DEPLOY_FAST_TRACK_CLEANING: True IRONIC_DEPLOY_FAST_TRACK_CLEANING: True
- job:
name: ironic-tempest-ipa-partition-uefi-pxe-grub2
description: Ironic tempest scenario test utilizing PXE, UEFI, and Grub2
parent: ironic-base
vars:
devstack_localrc:
USE_PYTHON3: True
IRONIC_ENABLED_HARDWARE_TYPES: ipmi
IRONIC_ENABLED_BOOT_INTERFACES: pxe
IRONIC_VM_SPECS_RAM: 512
IRONIC_IPXE_ENABLED: False
IRONIC_BOOT_MODE: uefi
IRONIC_AUTOMATED_CLEAN_ENABLED: False

View File

@ -25,6 +25,7 @@
- ironic-tempest-ipa-wholedisk-bios-agent_ipmitool-tinyipa-indirect - ironic-tempest-ipa-wholedisk-bios-agent_ipmitool-tinyipa-indirect
- ironic-tempest-ipa-partition-bios-agent_ipmitool-tinyipa-indirect - ironic-tempest-ipa-partition-bios-agent_ipmitool-tinyipa-indirect
- ironic-tempest-bfv - ironic-tempest-bfv
- ironic-tempest-ipa-partition-uefi-pxe-grub2
# Non-voting jobs # Non-voting jobs
- ironic-tempest-ipa-wholedisk-bios-pxe_snmp-tinyipa: - ironic-tempest-ipa-wholedisk-bios-pxe_snmp-tinyipa:
voting: false voting: false
@ -54,3 +55,4 @@
- ironic-tempest-ipa-wholedisk-bios-agent_ipmitool-tinyipa-indirect - ironic-tempest-ipa-wholedisk-bios-agent_ipmitool-tinyipa-indirect
- ironic-tempest-ipa-partition-bios-agent_ipmitool-tinyipa-indirect - ironic-tempest-ipa-partition-bios-agent_ipmitool-tinyipa-indirect
- ironic-tempest-bfv - ironic-tempest-bfv
- ironic-tempest-ipa-partition-uefi-pxe-grub2