From a2bfc586757f67bb11db95739cd7f1569de70e79 Mon Sep 17 00:00:00 2001 From: Dmitry Tantsur Date: Mon, 3 Aug 2020 11:00:56 +0200 Subject: [PATCH] Add a CI job with Redfish and UEFI The keystone jobs test Redfish+Legacy+PXE, add one more job with Redfish+UEFI (and intention to switch it to virtual media). Only Fedora works reliably now. CentOS ships with an OVMF firmware that seems to require secure boot, Ubuntu has problems with TFTP. Make testing VM configuration much closer to what works in devstack. Change-Id: Ic231e16f34176187d6179219356fd3c1de885423 --- .../bifrost-create-vm-nodes/defaults/main.yml | 5 ++-- .../defaults/required_defaults_CentOS.yml | 1 - .../tasks/prepare_libvirt.yml | 23 ++++++++++++++++++- .../templates/redfish-emulator.conf.j2 | 2 ++ .../templates/testvm.xml.j2 | 15 +++++++----- .../notes/uefi-emu-5fd047d01c09ed32.yaml | 11 +++++++++ scripts/test-bifrost.sh | 3 ++- zuul.d/bifrost-jobs.yaml | 7 ++++++ zuul.d/project.yaml | 2 ++ 9 files changed, 58 insertions(+), 11 deletions(-) create mode 100644 releasenotes/notes/uefi-emu-5fd047d01c09ed32.yaml diff --git a/playbooks/roles/bifrost-create-vm-nodes/defaults/main.yml b/playbooks/roles/bifrost-create-vm-nodes/defaults/main.yml index 2d34f1f39..b8c14e0bc 100644 --- a/playbooks/roles/bifrost-create-vm-nodes/defaults/main.yml +++ b/playbooks/roles/bifrost-create-vm-nodes/defaults/main.yml @@ -2,11 +2,12 @@ # defaults file for bifrost-create-vm-nodes baremetal_json_file: '/tmp/baremetal.json' baremetal_nodes_json: '/tmp/nodes.json' +default_boot_mode: '' test_vm_memory_size: "3072" test_vm_num_nodes: 1 test_vm_domain_type: "qemu" test_vm_arch: "x86_64" -test_vm_nic: "e1000" +test_vm_nic: "{{ 'virtio' if default_boot_mode == 'uefi' else 'e1000' }}" test_vm_groups: {} test_vm_default_groups: "{{ lookup('env', 'DEFAULT_HOST_GROUPS').split() | default(['baremetal'], true) }}" test_vm_disk_gib: "{{ lookup('env', 'VM_DISK') | default(10, true) }}" @@ -33,7 +34,7 @@ test_vm_storage_pool_path: "/var/lib/libvirt/images" test_vm_logdir: "/var/log/libvirt/baremetal_logs" # NOTE(pas-ha) next two are generic values for most OSes, overridden by distro-specifc vars test_vm_emulator: "/usr/bin/qemu-system-x86_64" -test_vm_machine: "pc-1.0" +test_vm_machine: "pc" # NOTE(pas-ha) not really tested with non-local qemu connections test_vm_libvirt_uri: "{{ lookup('env', 'LIBVIRT_CONNECT_URI') | default('qemu:///system', true) }}" # Settings related to installing bifrost in a virtual environment diff --git a/playbooks/roles/bifrost-create-vm-nodes/defaults/required_defaults_CentOS.yml b/playbooks/roles/bifrost-create-vm-nodes/defaults/required_defaults_CentOS.yml index f9d6d022d..c8917036b 100644 --- a/playbooks/roles/bifrost-create-vm-nodes/defaults/required_defaults_CentOS.yml +++ b/playbooks/roles/bifrost-create-vm-nodes/defaults/required_defaults_CentOS.yml @@ -24,4 +24,3 @@ required_packages: - trousers - edk2-ovmf test_vm_emulator: "/usr/libexec/qemu-kvm" -test_vm_machine: "pc" diff --git a/playbooks/roles/bifrost-create-vm-nodes/tasks/prepare_libvirt.yml b/playbooks/roles/bifrost-create-vm-nodes/tasks/prepare_libvirt.yml index 6982a7487..8e81f5bfc 100644 --- a/playbooks/roles/bifrost-create-vm-nodes/tasks/prepare_libvirt.yml +++ b/playbooks/roles/bifrost-create-vm-nodes/tasks/prepare_libvirt.yml @@ -215,9 +215,30 @@ set_fact: efi_loader_path: "{{ item }}" with_first_found: - - /usr/share/OVMF/OVMF_CODE.secboot.fd + - /usr/share/edk2/ovmf/OVMF_CODE.fd - /usr/share/OVMF/OVMF_CODE.fd - /usr/share/qemu/ovmf-x86_64-code.bin + ignore_errors: true + when: efi_loader_path is undefined + +- name: fail if UEFI is requested and no OVMF firmware is found + fail: + msg: > + UEFI is requested but no OVMF firmware can be found. Please set + efi_loader_path explicitly. Note that firmware with secure boot enabled + may not work yet. + when: + - efi_loader_path is undefined + - default_boot_mode == 'uefi' + +- name: find OVMF NVRAM + set_fact: + efi_nvram_path: "{{ item }}" + with_first_found: + - /usr/share/edk2/ovmf/OVMF_VARS.fd + - /usr/share/OVMF/OVMF_VARS.fd + - /usr/share/qemu/ovmf-x86_64-vars.bin + when: default_boot_mode == 'uefi' - name: write Redfish Emulator configuration file template: diff --git a/playbooks/roles/bifrost-create-vm-nodes/templates/redfish-emulator.conf.j2 b/playbooks/roles/bifrost-create-vm-nodes/templates/redfish-emulator.conf.j2 index 7c9689e70..9dd334e84 100644 --- a/playbooks/roles/bifrost-create-vm-nodes/templates/redfish-emulator.conf.j2 +++ b/playbooks/roles/bifrost-create-vm-nodes/templates/redfish-emulator.conf.j2 @@ -1,7 +1,9 @@ SUSHY_EMULATOR_BOOT_LOADER_MAP = { +{% if efi_loader_path is defined %} 'UEFI': { 'x86_64': '{{ efi_loader_path }}' }, +{% endif %} 'Legacy': { 'x86_64': None } diff --git a/playbooks/roles/bifrost-create-vm-nodes/templates/testvm.xml.j2 b/playbooks/roles/bifrost-create-vm-nodes/templates/testvm.xml.j2 index 687eefa64..385eac9cf 100644 --- a/playbooks/roles/bifrost-create-vm-nodes/templates/testvm.xml.j2 +++ b/playbooks/roles/bifrost-create-vm-nodes/templates/testvm.xml.j2 @@ -4,7 +4,12 @@ {{ test_vm_cpu_count }} hvm - + {% if default_boot_mode == 'uefi' %} + {{ efi_loader_path }} + /var/lib/libvirt/nvram-{{ vm_name }}.fd + {% else %} + + {% endif %} @@ -29,13 +34,11 @@ + {% if default_boot_mode == 'uefi' %} + + {% endif %} - -