From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [IPv6:2a0f:8001:1:32::40]) by lore.proxmox.com (Postfix) with ESMTPS id 5A3CD1FF0A7 for ; Mon, 17 Aug 2026 11:36:23 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 781E123AD4; Mon, 17 Aug 2026 11:36:02 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=genua.de; s=202307; t=1786958975; bh=c1te6mtdYpAdrbT8UZpEXi4YUNuSSCYmQzYuLD7ADDM=; h=Date:From:To:Subject:References:In-Reply-To:From; b=GKFwZ2J2U+U6t/jS5cnmJ2DLvw2fzDklalUTLoLfiyz5HtQwU4BLqn+C0465jeZTs nj3ZmHPevN0imMxPQVpWnqJcjjjHoqA0GtxhVWy1A/gdS3HKwv/ZyeINMEJ8UBAM2T uEsYwsGuzeoinzh4zBokHO3ZgaDNDWQtoUdJw5nAU2BIixi1XgH7ZC9SPcYS65G/l7 ZO2Q73UySBctivdG1sAc0XfMDGMX8BhIJbZ31WVbhOdqznPgUg6nXn0gbXHKu1I4Qx 7uugEQbXbnxdlVsNUynd1x5YZTDCdrAczJLeANiYQugmMK02Z50uir8zc0jr1hQii7 fO3+ELzqViwyg== Date: Mon, 17 Aug 2026 11:29:33 +0200 From: Christian Ludwig To: , <-b@genua.de>, Subject: [PATCH qemu-server 10/13] test: efi-firmware key in VM config Message-ID: References: MIME-Version: 1.0 In-Reply-To: X-Originating-IP: [192.168.217.185] X-ClientProxiedBy: kch1-mta07.win.genua.de (10.208.16.107) To kch1-mta07.win.genua.de (10.208.16.107) Content-Type: multipart/signed; protocol="application/pkcs7-signature"; micalg="sha-256"; boundary="----ACE9CD54EA977EE9277A83C4783E8595" X-SPAM-LEVEL: Spam detection results: 0 DKIM_INVALID 0.1 DKIM or DK signature exists, but is not valid DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DMARC_PASS -0.1 DMARC pass policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) SPF_HELO_PASS -0.001 SPF: HELO matches SPF record SPF_PASS -0.001 SPF: sender matches SPF record UNPARSEABLE_RELAY 0.001 Informational: message has unparseable relay lines Message-ID-Hash: R2VVAUI6AALZEVVAFTUYO5PNVJQVLKOP X-Message-ID-Hash: R2VVAUI6AALZEVVAFTUYO5PNVJQVLKOP X-MailFrom: christian_ludwig@genua.de X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Content-Filtered-By: Mailman/MimeDel 3.3.10 X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: ------ACE9CD54EA977EE9277A83C4783E8595 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline Add test cases for different efi-firmware settings in VM config. Also enhance the PVE::QemuServer::OVMF test mock to trigger to handle nonexistent files. Signed-off-by: Christian Ludwig --- .../cfg2cmd/efi-custom-firmware-legacy.conf | 6 ++++ .../efi-custom-firmware-legacy.conf.cmd | 27 ++++++++++++++++ .../efi-custom-firmware-not-found.conf | 6 ++++ src/test/cfg2cmd/efi-custom-firmware-old.conf | 6 ++++ .../cfg2cmd/efi-custom-firmware-old.conf.cmd | 27 ++++++++++++++++ src/test/cfg2cmd/efi-custom-firmware-sev.conf | 7 +++++ .../cfg2cmd/efi-custom-firmware-sev.conf.cmd | 31 +++++++++++++++++++ src/test/cfg2cmd/efi-custom-firmware-snp.conf | 6 ++++ .../cfg2cmd/efi-custom-firmware-snp.conf.cmd | 29 +++++++++++++++++ src/test/cfg2cmd/efi-custom-firmware-tdx.conf | 6 ++++ .../cfg2cmd/efi-custom-firmware-tdx.conf.cmd | 29 +++++++++++++++++ src/test/cfg2cmd/efi-custom-firmware.conf | 5 +++ src/test/cfg2cmd/efi-custom-firmware.conf.cmd | 30 ++++++++++++++++++ .../efi-firmware-bad-volid.conf.strict.error | 1 + .../efi-firmware-no-ovmf.conf.strict.error | 1 + .../efi-firmware-bad-volid.conf | 13 ++++++++ .../efi-firmware-no-ovmf.conf | 11 +++++++ src/test/parse-config-input/efi-firmware.conf | 13 ++++++++ .../regular-vm-efifirmware.conf | 17 ++++++++++ src/test/run_config2command_tests.pl | 2 ++ src/test/run_parse_config_tests.pl | 2 +- 21 files changed, 274 insertions(+), 1 deletion(-) create mode 100644 src/test/cfg2cmd/efi-custom-firmware-legacy.conf create mode 100644 src/test/cfg2cmd/efi-custom-firmware-legacy.conf.cmd create mode 100644 src/test/cfg2cmd/efi-custom-firmware-not-found.conf create mode 100644 src/test/cfg2cmd/efi-custom-firmware-old.conf create mode 100644 src/test/cfg2cmd/efi-custom-firmware-old.conf.cmd create mode 100644 src/test/cfg2cmd/efi-custom-firmware-sev.conf create mode 100644 src/test/cfg2cmd/efi-custom-firmware-sev.conf.cmd create mode 100644 src/test/cfg2cmd/efi-custom-firmware-snp.conf create mode 100644 src/test/cfg2cmd/efi-custom-firmware-snp.conf.cmd create mode 100644 src/test/cfg2cmd/efi-custom-firmware-tdx.conf create mode 100644 src/test/cfg2cmd/efi-custom-firmware-tdx.conf.cmd create mode 100644 src/test/cfg2cmd/efi-custom-firmware.conf create mode 100644 src/test/cfg2cmd/efi-custom-firmware.conf.cmd create mode 100644 src/test/parse-config-expected/efi-firmware-bad-volid.conf.strict.error create mode 100644 src/test/parse-config-expected/efi-firmware-no-ovmf.conf.strict.error create mode 100644 src/test/parse-config-input/efi-firmware-bad-volid.conf create mode 100644 src/test/parse-config-input/efi-firmware-no-ovmf.conf create mode 100644 src/test/parse-config-input/efi-firmware.conf create mode 100644 src/test/parse-config-input/regular-vm-efifirmware.conf diff --git a/src/test/cfg2cmd/efi-custom-firmware-legacy.conf b/src/test/cfg2cmd/efi-custom-firmware-legacy.conf new file mode 100644 index 00000000..27d2a59d --- /dev/null +++ b/src/test/cfg2cmd/efi-custom-firmware-legacy.conf @@ -0,0 +1,6 @@ +# TEST: Custom efi-firmware replaces system OVMF_CODE path in legacy -drive command line +smbios1: uuid=7b10d7af-b932-4c66-b2c3-3996152ec465 +bios: ovmf +machine: pc-i440fx-4.1+pve0 +efidisk0: local:100/vm-100-disk-0.raw +efi-firmware: local:efi-firmware/custom.fd diff --git a/src/test/cfg2cmd/efi-custom-firmware-legacy.conf.cmd b/src/test/cfg2cmd/efi-custom-firmware-legacy.conf.cmd new file mode 100644 index 00000000..e7e870a5 --- /dev/null +++ b/src/test/cfg2cmd/efi-custom-firmware-legacy.conf.cmd @@ -0,0 +1,27 @@ +/usr/bin/kvm \ + -id 8006 \ + -name vm8006 \ + -no-shutdown \ + -chardev 'socket,id=qmp,path=/var/run/qemu-server/8006.qmp,server=on,wait=off' \ + -mon 'chardev=qmp,mode=control' \ + -chardev 'socket,id=qmp-event,path=/var/run/qmeventd.sock,reconnect-ms=5000' \ + -mon 'chardev=qmp-event,mode=control' \ + -pidfile /var/run/qemu-server/8006.pid \ + -daemonize \ + -smbios 'type=1,uuid=7b10d7af-b932-4c66-b2c3-3996152ec465' \ + -drive 'if=pflash,unit=0,format=raw,readonly=on,file=/var/lib/vz/efi-firmware/custom.fd' \ + -drive 'if=pflash,unit=1,id=drive-efidisk0,format=raw,file=/var/lib/vz/images/100/vm-100-disk-0.raw' \ + -smp '1,sockets=1,cores=1,maxcpus=1' \ + -nodefaults \ + -boot 'menu=on,strict=on,reboot-timeout=1000,splash=/usr/share/qemu-server/bootsplash.jpg' \ + -vnc 'unix:/var/run/qemu-server/8006.vnc,password=on' \ + -cpu kvm64,enforce,+kvm_pv_eoi,+kvm_pv_unhalt,+lahf_lm,+sep \ + -m 512 \ + -device 'pci-bridge,id=pci.1,chassis_nr=1,bus=pci.0,addr=0x1e' \ + -device 'pci-bridge,id=pci.2,chassis_nr=2,bus=pci.0,addr=0x1f' \ + -device 'piix3-usb-uhci,id=uhci,bus=pci.0,addr=0x1.0x2' \ + -device 'usb-tablet,id=tablet,bus=uhci.0,port=1' \ + -device 'VGA,id=vga,bus=pci.0,addr=0x2' \ + -device 'virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3' \ + -iscsi 'initiator-name=iqn.1993-08.org.debian:01:aabbccddeeff' \ + -machine 'type=pc-i440fx-4.1+pve0' diff --git a/src/test/cfg2cmd/efi-custom-firmware-not-found.conf b/src/test/cfg2cmd/efi-custom-firmware-not-found.conf new file mode 100644 index 00000000..fcc8774a --- /dev/null +++ b/src/test/cfg2cmd/efi-custom-firmware-not-found.conf @@ -0,0 +1,6 @@ +# TEST: efi-firmware pointing to a nonexistent file causes die +# EXPECT_ERROR: efi-firmware volume 'local:efi-firmware/nonexistent.fd' not found at '/var/lib/vz/efi-firmware/nonexistent.fd' +smbios1: uuid=7b10d7af-b932-4c66-b2c3-3996152ec465 +bios: ovmf +efidisk0: local:100/vm-100-disk-0.raw +efi-firmware: local:efi-firmware/nonexistent.fd diff --git a/src/test/cfg2cmd/efi-custom-firmware-old.conf b/src/test/cfg2cmd/efi-custom-firmware-old.conf new file mode 100644 index 00000000..5ac13d9c --- /dev/null +++ b/src/test/cfg2cmd/efi-custom-firmware-old.conf @@ -0,0 +1,6 @@ +# TEST: Custom efi-firmware replaces system OVMF_CODE path in legacy -drive command line (old naming) +smbios1: uuid=7b10d7af-b932-4c66-b2c3-3996152ec465 +bios: ovmf +machine: pc-i440fx-4.1+pve0 +efidisk0: local:100/vm-100-disk-0.raw +efi-firmware: local:efi-firmware/custom.fd diff --git a/src/test/cfg2cmd/efi-custom-firmware-old.conf.cmd b/src/test/cfg2cmd/efi-custom-firmware-old.conf.cmd new file mode 100644 index 00000000..e7e870a5 --- /dev/null +++ b/src/test/cfg2cmd/efi-custom-firmware-old.conf.cmd @@ -0,0 +1,27 @@ +/usr/bin/kvm \ + -id 8006 \ + -name vm8006 \ + -no-shutdown \ + -chardev 'socket,id=qmp,path=/var/run/qemu-server/8006.qmp,server=on,wait=off' \ + -mon 'chardev=qmp,mode=control' \ + -chardev 'socket,id=qmp-event,path=/var/run/qmeventd.sock,reconnect-ms=5000' \ + -mon 'chardev=qmp-event,mode=control' \ + -pidfile /var/run/qemu-server/8006.pid \ + -daemonize \ + -smbios 'type=1,uuid=7b10d7af-b932-4c66-b2c3-3996152ec465' \ + -drive 'if=pflash,unit=0,format=raw,readonly=on,file=/var/lib/vz/efi-firmware/custom.fd' \ + -drive 'if=pflash,unit=1,id=drive-efidisk0,format=raw,file=/var/lib/vz/images/100/vm-100-disk-0.raw' \ + -smp '1,sockets=1,cores=1,maxcpus=1' \ + -nodefaults \ + -boot 'menu=on,strict=on,reboot-timeout=1000,splash=/usr/share/qemu-server/bootsplash.jpg' \ + -vnc 'unix:/var/run/qemu-server/8006.vnc,password=on' \ + -cpu kvm64,enforce,+kvm_pv_eoi,+kvm_pv_unhalt,+lahf_lm,+sep \ + -m 512 \ + -device 'pci-bridge,id=pci.1,chassis_nr=1,bus=pci.0,addr=0x1e' \ + -device 'pci-bridge,id=pci.2,chassis_nr=2,bus=pci.0,addr=0x1f' \ + -device 'piix3-usb-uhci,id=uhci,bus=pci.0,addr=0x1.0x2' \ + -device 'usb-tablet,id=tablet,bus=uhci.0,port=1' \ + -device 'VGA,id=vga,bus=pci.0,addr=0x2' \ + -device 'virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3' \ + -iscsi 'initiator-name=iqn.1993-08.org.debian:01:aabbccddeeff' \ + -machine 'type=pc-i440fx-4.1+pve0' diff --git a/src/test/cfg2cmd/efi-custom-firmware-sev.conf b/src/test/cfg2cmd/efi-custom-firmware-sev.conf new file mode 100644 index 00000000..cb0d6a9e --- /dev/null +++ b/src/test/cfg2cmd/efi-custom-firmware-sev.conf @@ -0,0 +1,7 @@ +# TEST: Custom efi-firmware replaces system OVMF_SEV_CODE path in SEV CVM blockdev command line +# HW_CAPABILITIES: amd-turin-9005 +smbios1: uuid=7b10d7af-b932-4c66-b2c3-3996152ec465 +bios: ovmf +efidisk0: local:100/vm-100-disk-0.raw,efitype=4m,pre-enrolled-keys=1,size=528K +amd-sev: type=std +efi-firmware: local:efi-firmware/custom.fd diff --git a/src/test/cfg2cmd/efi-custom-firmware-sev.conf.cmd b/src/test/cfg2cmd/efi-custom-firmware-sev.conf.cmd new file mode 100644 index 00000000..4b3a67dc --- /dev/null +++ b/src/test/cfg2cmd/efi-custom-firmware-sev.conf.cmd @@ -0,0 +1,31 @@ +/usr/bin/kvm \ + -id 8006 \ + -name vm8006 \ + -no-shutdown \ + -chardev 'socket,id=qmp,path=/var/run/qemu-server/8006.qmp,server=on,wait=off' \ + -mon 'chardev=qmp,mode=control' \ + -chardev 'socket,id=qmp-event,path=/var/run/qmeventd.sock,reconnect-ms=5000' \ + -mon 'chardev=qmp-event,mode=control' \ + -pidfile /var/run/qemu-server/8006.pid \ + -daemonize \ + -smbios 'type=1,uuid=7b10d7af-b932-4c66-b2c3-3996152ec465' \ + -object '{"id":"throttle-drive-efidisk0","limits":{},"qom-type":"throttle-group"}' \ + -blockdev '{"driver":"raw","file":{"driver":"file","filename":"/var/lib/vz/efi-firmware/custom.fd"},"node-name":"pflash0","read-only":true}' \ + -blockdev '{"detect-zeroes":"on","discard":"ignore","driver":"throttle","file":{"cache":{"direct":false,"no-flush":false},"detect-zeroes":"on","discard":"ignore","driver":"raw","file":{"aio":"io_uring","cache":{"direct":false,"no-flush":false},"detect-zeroes":"on","discard":"ignore","driver":"file","filename":"/var/lib/vz/images/100/vm-100-disk-0.raw","node-name":"e1175f2a490414e7c53337589fde17a","read-only":false},"node-name":"f1175f2a490414e7c53337589fde17a","read-only":false,"size":540672},"node-name":"drive-efidisk0","read-only":false,"throttle-group":"throttle-drive-efidisk0"}' \ + -smp '1,sockets=1,cores=1,maxcpus=1' \ + -nodefaults \ + -boot 'menu=on,strict=on,reboot-timeout=1000,splash=/usr/share/qemu-server/bootsplash.jpg' \ + -vnc 'unix:/var/run/qemu-server/8006.vnc,password=on' \ + -cpu kvm64,enforce,+kvm_pv_eoi,+kvm_pv_unhalt,+lahf_lm,+sep \ + -m 512 \ + -global 'PIIX4_PM.disable_s3=1' \ + -global 'PIIX4_PM.disable_s4=1' \ + -device 'pci-bridge,id=pci.1,chassis_nr=1,bus=pci.0,addr=0x1e' \ + -device 'pci-bridge,id=pci.2,chassis_nr=2,bus=pci.0,addr=0x1f' \ + -device 'piix3-usb-uhci,id=uhci,bus=pci.0,addr=0x1.0x2' \ + -device 'usb-tablet,id=tablet,bus=uhci.0,port=1' \ + -device 'VGA,id=vga,bus=pci.0,addr=0x2' \ + -device 'virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3,free-page-reporting=on' \ + -iscsi 'initiator-name=iqn.1993-08.org.debian:01:aabbccddeeff' \ + -object 'sev-guest,id=sev0,cbitpos=51,reduced-phys-bits=6,policy=0x8' \ + -machine 'pflash0=pflash0,pflash1=drive-efidisk0,type=pc+pve0,confidential-guest-support=sev0' diff --git a/src/test/cfg2cmd/efi-custom-firmware-snp.conf b/src/test/cfg2cmd/efi-custom-firmware-snp.conf new file mode 100644 index 00000000..07a80a29 --- /dev/null +++ b/src/test/cfg2cmd/efi-custom-firmware-snp.conf @@ -0,0 +1,6 @@ +# TEST: Custom efi-firmware replaces default SNP firmware in -bios argument +# HW_CAPABILITIES: amd-turin-9005 +smbios1: uuid=7b10d7af-b932-4c66-b2c3-3996152ec465 +bios: ovmf +amd-sev: type=snp +efi-firmware: local:efi-firmware/custom.fd diff --git a/src/test/cfg2cmd/efi-custom-firmware-snp.conf.cmd b/src/test/cfg2cmd/efi-custom-firmware-snp.conf.cmd new file mode 100644 index 00000000..678d1356 --- /dev/null +++ b/src/test/cfg2cmd/efi-custom-firmware-snp.conf.cmd @@ -0,0 +1,29 @@ +/usr/bin/kvm \ + -id 8006 \ + -name vm8006 \ + -no-shutdown \ + -chardev 'socket,id=qmp,path=/var/run/qemu-server/8006.qmp,server=on,wait=off' \ + -mon 'chardev=qmp,mode=control' \ + -chardev 'socket,id=qmp-event,path=/var/run/qmeventd.sock,reconnect-ms=5000' \ + -mon 'chardev=qmp-event,mode=control' \ + -pidfile /var/run/qemu-server/8006.pid \ + -daemonize \ + -smbios 'type=1,uuid=7b10d7af-b932-4c66-b2c3-3996152ec465' \ + -bios /var/lib/vz/efi-firmware/custom.fd \ + -smp '1,sockets=1,cores=1,maxcpus=1' \ + -nodefaults \ + -boot 'menu=on,strict=on,reboot-timeout=1000,splash=/usr/share/qemu-server/bootsplash.jpg' \ + -vnc 'unix:/var/run/qemu-server/8006.vnc,password=on' \ + -cpu kvm64,enforce,+kvm_pv_eoi,+kvm_pv_unhalt,+lahf_lm,+sep \ + -m 512 \ + -global 'PIIX4_PM.disable_s3=1' \ + -global 'PIIX4_PM.disable_s4=1' \ + -device 'pci-bridge,id=pci.1,chassis_nr=1,bus=pci.0,addr=0x1e' \ + -device 'pci-bridge,id=pci.2,chassis_nr=2,bus=pci.0,addr=0x1f' \ + -device 'piix3-usb-uhci,id=uhci,bus=pci.0,addr=0x1.0x2' \ + -device 'usb-tablet,id=tablet,bus=uhci.0,port=1' \ + -device 'VGA,id=vga,bus=pci.0,addr=0x2' \ + -device 'virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3,free-page-reporting=on' \ + -iscsi 'initiator-name=iqn.1993-08.org.debian:01:aabbccddeeff' \ + -object 'sev-snp-guest,id=sev0,cbitpos=51,reduced-phys-bits=6,policy=0xb0000' \ + -machine 'type=pc+pve0,confidential-guest-support=sev0' diff --git a/src/test/cfg2cmd/efi-custom-firmware-tdx.conf b/src/test/cfg2cmd/efi-custom-firmware-tdx.conf new file mode 100644 index 00000000..8219dad3 --- /dev/null +++ b/src/test/cfg2cmd/efi-custom-firmware-tdx.conf @@ -0,0 +1,6 @@ +# TEST: Custom efi-firmware replaces default TDX firmware in -bios argument +# HW_CAPABILITIES: {"intel-tdx":{"tdx-support":true},"amd-sev":{"cbitpos":0,"reduced-phys-bits":0,"sev-support":false,"sev-support-es":false,"sev-support-snp":false}} +smbios1: uuid=7b10d7af-b932-4c66-b2c3-3996152ec465 +bios: ovmf +intel-tdx: tdx,attestation=0 +efi-firmware: local:efi-firmware/custom.fd diff --git a/src/test/cfg2cmd/efi-custom-firmware-tdx.conf.cmd b/src/test/cfg2cmd/efi-custom-firmware-tdx.conf.cmd new file mode 100644 index 00000000..7902aaef --- /dev/null +++ b/src/test/cfg2cmd/efi-custom-firmware-tdx.conf.cmd @@ -0,0 +1,29 @@ +/usr/bin/kvm \ + -id 8006 \ + -name vm8006 \ + -no-shutdown \ + -chardev 'socket,id=qmp,path=/var/run/qemu-server/8006.qmp,server=on,wait=off' \ + -mon 'chardev=qmp,mode=control' \ + -chardev 'socket,id=qmp-event,path=/var/run/qmeventd.sock,reconnect-ms=5000' \ + -mon 'chardev=qmp-event,mode=control' \ + -pidfile /var/run/qemu-server/8006.pid \ + -daemonize \ + -smbios 'type=1,uuid=7b10d7af-b932-4c66-b2c3-3996152ec465' \ + -bios /var/lib/vz/efi-firmware/custom.fd \ + -smp '1,sockets=1,cores=1,maxcpus=1' \ + -nodefaults \ + -boot 'menu=on,strict=on,reboot-timeout=1000,splash=/usr/share/qemu-server/bootsplash.jpg' \ + -vnc 'unix:/var/run/qemu-server/8006.vnc,password=on' \ + -cpu kvm64,enforce,+kvm_pv_eoi,+kvm_pv_unhalt,+lahf_lm,+sep \ + -m 512 \ + -global 'PIIX4_PM.disable_s3=1' \ + -global 'PIIX4_PM.disable_s4=1' \ + -device 'pci-bridge,id=pci.1,chassis_nr=1,bus=pci.0,addr=0x1e' \ + -device 'pci-bridge,id=pci.2,chassis_nr=2,bus=pci.0,addr=0x1f' \ + -device 'piix3-usb-uhci,id=uhci,bus=pci.0,addr=0x1.0x2' \ + -device 'usb-tablet,id=tablet,bus=uhci.0,port=1' \ + -device 'VGA,id=vga,bus=pci.0,addr=0x2' \ + -device 'virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3,free-page-reporting=on' \ + -iscsi 'initiator-name=iqn.1993-08.org.debian:01:aabbccddeeff' \ + -object '{"id":"tdx0","qom-type":"tdx-guest"}' \ + -machine 'type=pc+pve0,confidential-guest-support=tdx0,kernel_irqchip=split' diff --git a/src/test/cfg2cmd/efi-custom-firmware.conf b/src/test/cfg2cmd/efi-custom-firmware.conf new file mode 100644 index 00000000..25ca7bc4 --- /dev/null +++ b/src/test/cfg2cmd/efi-custom-firmware.conf @@ -0,0 +1,5 @@ +# TEST: Custom efi-firmware replaces system OVMF_CODE path in blockdev command line +smbios1: uuid=7b10d7af-b932-4c66-b2c3-3996152ec465 +bios: ovmf +efidisk0: local:100/vm-100-disk-0.raw +efi-firmware: local:efi-firmware/custom.fd diff --git a/src/test/cfg2cmd/efi-custom-firmware.conf.cmd b/src/test/cfg2cmd/efi-custom-firmware.conf.cmd new file mode 100644 index 00000000..526d99c3 --- /dev/null +++ b/src/test/cfg2cmd/efi-custom-firmware.conf.cmd @@ -0,0 +1,30 @@ +/usr/bin/kvm \ + -id 8006 \ + -name vm8006 \ + -no-shutdown \ + -chardev 'socket,id=qmp,path=/var/run/qemu-server/8006.qmp,server=on,wait=off' \ + -mon 'chardev=qmp,mode=control' \ + -chardev 'socket,id=qmp-event,path=/var/run/qmeventd.sock,reconnect-ms=5000' \ + -mon 'chardev=qmp-event,mode=control' \ + -pidfile /var/run/qemu-server/8006.pid \ + -daemonize \ + -smbios 'type=1,uuid=7b10d7af-b932-4c66-b2c3-3996152ec465' \ + -object '{"id":"throttle-drive-efidisk0","limits":{},"qom-type":"throttle-group"}' \ + -blockdev '{"driver":"raw","file":{"driver":"file","filename":"/var/lib/vz/efi-firmware/custom.fd"},"node-name":"pflash0","read-only":true}' \ + -blockdev '{"detect-zeroes":"on","discard":"ignore","driver":"throttle","file":{"cache":{"direct":false,"no-flush":false},"detect-zeroes":"on","discard":"ignore","driver":"raw","file":{"aio":"io_uring","cache":{"direct":false,"no-flush":false},"detect-zeroes":"on","discard":"ignore","driver":"file","filename":"/var/lib/vz/images/100/vm-100-disk-0.raw","node-name":"e1175f2a490414e7c53337589fde17a","read-only":false},"node-name":"f1175f2a490414e7c53337589fde17a","read-only":false,"size":131072},"node-name":"drive-efidisk0","read-only":false,"throttle-group":"throttle-drive-efidisk0"}' \ + -smp '1,sockets=1,cores=1,maxcpus=1' \ + -nodefaults \ + -boot 'menu=on,strict=on,reboot-timeout=1000,splash=/usr/share/qemu-server/bootsplash.jpg' \ + -vnc 'unix:/var/run/qemu-server/8006.vnc,password=on' \ + -cpu kvm64,enforce,+kvm_pv_eoi,+kvm_pv_unhalt,+lahf_lm,+sep \ + -m 512 \ + -global 'PIIX4_PM.disable_s3=1' \ + -global 'PIIX4_PM.disable_s4=1' \ + -device 'pci-bridge,id=pci.1,chassis_nr=1,bus=pci.0,addr=0x1e' \ + -device 'pci-bridge,id=pci.2,chassis_nr=2,bus=pci.0,addr=0x1f' \ + -device 'piix3-usb-uhci,id=uhci,bus=pci.0,addr=0x1.0x2' \ + -device 'usb-tablet,id=tablet,bus=uhci.0,port=1' \ + -device 'VGA,id=vga,bus=pci.0,addr=0x2' \ + -device 'virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3,free-page-reporting=on' \ + -iscsi 'initiator-name=iqn.1993-08.org.debian:01:aabbccddeeff' \ + -machine 'pflash0=pflash0,pflash1=drive-efidisk0,type=pc+pve0' diff --git a/src/test/parse-config-expected/efi-firmware-bad-volid.conf.strict.error b/src/test/parse-config-expected/efi-firmware-bad-volid.conf.strict.error new file mode 100644 index 00000000..35672ff1 --- /dev/null +++ b/src/test/parse-config-expected/efi-firmware-bad-volid.conf.strict.error @@ -0,0 +1 @@ +vm 8006 - efi-firmware: invalid volid format, expected :efi-firmware/ diff --git a/src/test/parse-config-expected/efi-firmware-no-ovmf.conf.strict.error b/src/test/parse-config-expected/efi-firmware-no-ovmf.conf.strict.error new file mode 100644 index 00000000..3a56d271 --- /dev/null +++ b/src/test/parse-config-expected/efi-firmware-no-ovmf.conf.strict.error @@ -0,0 +1 @@ +vm 8006 - efi-firmware requires bios=ovmf diff --git a/src/test/parse-config-input/efi-firmware-bad-volid.conf b/src/test/parse-config-input/efi-firmware-bad-volid.conf new file mode 100644 index 00000000..c91afb69 --- /dev/null +++ b/src/test/parse-config-input/efi-firmware-bad-volid.conf @@ -0,0 +1,13 @@ +bios: ovmf +boot: order=scsi0 +cores: 2 +efi-firmware: local:iso/custom.fd +efidisk0: local-lvm:vm-100-disk-0,efitype=4m,pre-enrolled-keys=1 +memory: 1024 +name: test-vm +net0: virtio=BC:24:11:2C:69:EC,bridge=vmbr0 +numa: 0 +ostype: l26 +scsi0: local-lvm:vm-100-disk-1,size=8G +scsihw: virtio-scsi-pci +sockets: 1 diff --git a/src/test/parse-config-input/efi-firmware-no-ovmf.conf b/src/test/parse-config-input/efi-firmware-no-ovmf.conf new file mode 100644 index 00000000..3739d8f5 --- /dev/null +++ b/src/test/parse-config-input/efi-firmware-no-ovmf.conf @@ -0,0 +1,11 @@ +boot: order=scsi0 +cores: 2 +efi-firmware: local:efi-firmware/custom.fd +memory: 1024 +name: test-vm +net0: virtio=BC:24:11:2C:69:EC,bridge=vmbr0 +numa: 0 +ostype: l26 +scsi0: local-lvm:vm-100-disk-0,size=8G +scsihw: virtio-scsi-pci +sockets: 1 diff --git a/src/test/parse-config-input/efi-firmware.conf b/src/test/parse-config-input/efi-firmware.conf new file mode 100644 index 00000000..c39570d9 --- /dev/null +++ b/src/test/parse-config-input/efi-firmware.conf @@ -0,0 +1,13 @@ +bios: ovmf +boot: order=scsi0 +cores: 2 +efi-firmware: local:efi-firmware/custom.fd +efidisk0: local-lvm:vm-100-disk-0,efitype=4m,pre-enrolled-keys=1 +memory: 1024 +name: test-vm +net0: virtio=BC:24:11:2C:69:EC,bridge=vmbr0 +numa: 0 +ostype: l26 +scsi0: local-lvm:vm-100-disk-1,size=8G +scsihw: virtio-scsi-pci +sockets: 1 diff --git a/src/test/parse-config-input/regular-vm-efifirmware.conf b/src/test/parse-config-input/regular-vm-efifirmware.conf new file mode 100644 index 00000000..78a03e71 --- /dev/null +++ b/src/test/parse-config-input/regular-vm-efifirmware.conf @@ -0,0 +1,17 @@ +# regular VM with an EFI disk and custom firmware +bios: ovmf +boot: order=scsi0;ide2;net0 +cores: 1 +efi-firmware: mydir:efi-firmware/custom.fd +efidisk0: mydir:139/vm-139-disk-0.qcow2,size=128K +ide2: local:iso/debian-10.6.0-amd64-netinst.iso,media=cdrom +memory: 2048 +name: eficloneclone +net0: virtio=7A:6C:A5:8B:11:93,bridge=vmbr0,firewall=1 +numa: 0 +ostype: l26 +scsi0: rbdkvm:vm-139-disk-1,size=4G +scsihw: virtio-scsi-pci +smbios1: uuid=21a7e7bc-3cd2-4232-a009-a41f4ee992ae +sockets: 1 +vmgenid: 0 diff --git a/src/test/run_config2command_tests.pl b/src/test/run_config2command_tests.pl index 47250c67..a2e95add 100755 --- a/src/test/run_config2command_tests.pl +++ b/src/test/run_config2command_tests.pl @@ -31,6 +31,7 @@ my $base_env = { content => { images => 1, iso => 1, + 'efi-firmware' => 1, }, path => '/var/lib/vz', type => 'dir', @@ -285,6 +286,7 @@ my $qemu_server_ovmf_module = Test::MockModule->new("PVE::QemuServer::OVMF"); $qemu_server_ovmf_module->mock( file_exists => sub { my ($path) = @_; + return 0 if $path =~ m/nonexistent/; return 1; }, file_get_size => sub { diff --git a/src/test/run_parse_config_tests.pl b/src/test/run_parse_config_tests.pl index 62e36ee0..3e31bc30 100755 --- a/src/test/run_parse_config_tests.pl +++ b/src/test/run_parse_config_tests.pl @@ -26,7 +26,7 @@ my $OUTPUT_DIR = './parse-config-output'; my $EXPECTED_DIR = './parse-config-expected'; # NOTE update when you add/remove tests -plan tests => 2 * 10; +plan tests => 2 * 14; sub run_tests { my ($strict) = @_; -- 2.34.1 ------ACE9CD54EA977EE9277A83C4783E8595--