From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [45.144.208.40]) by lore.proxmox.com (Postfix) with ESMTPS id 3B5B71FF0B0 for ; Tue, 27 Oct 2026 11:14:13 +0100 (CET) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id A80F321724; Tue, 27 Oct 2026 11:13:32 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=genua.de; s=202307; t=1793095948; bh=4mk+689Lk4ZA6GyHUEc8+eLiKOiUwY7o9LD/VXG7Ejo=; h=Date:From:To:Subject:References:In-Reply-To:From; b=X6kW6EhS/Nb2cYeMJrN+BhAVP9WbpVDdqtwLGv1Fs7dFdLSEe6LllPUkYUrCx/nvi 4CrIzyA6emhiMTs07YoehtBDYG4Zl82h2d2vGx37EmQs0cEyO5Is6PhR4WZi4qDeN4 s5ObMbBSEZ0KMf1ugSMUg1dqiH49T+OkSaqJoRMX5C0GF7Snbxklay9X26+fLQgWXH 016gGfePzaHBWq9LhByddnChy67H2zBfl/rOtMhsTBWhUd7e0VFNklB5rPfBetArm5 lIBLJpoW7TZvSsVjfZXFkjirmoIzpL/OsLz8PZwsP/sEG8Nc9mwMj9bZkTTf5SDj1E 2HnPQKZ/SbJYw== Date: Tue, 27 Oct 2026 11:12:26 +0100 From: Christian Ludwig To: Subject: [PATCH qemu-server v3 12/19] test: custom firmware in the bios option Message-ID: <2e7eca340eb877ace1d265f5101b6ab8ffdcda47.1793029144.git@genua.de> References: MIME-Version: 1.0 In-Reply-To: X-Originating-IP: [192.168.217.185] X-ClientProxiedBy: kch1-mta08.win.genua.de (10.208.16.108) To kch1-mta07.win.genua.de (10.208.16.107) Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline X-SPAM-LEVEL: Spam detection results: 0 AWL 0.064 Adjusted score from AWL reputation of From: address DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain DMARC_PASS -0.1 DMARC pass policy 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: EXYUDHLNMUC3SDYDLWCLR24YK3LXF5OH X-Message-ID-Hash: EXYUDHLNMUC3SDYDLWCLR24YK3LXF5OH 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-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Add test cases for different custom firmware settings in the VM config, including the errors for a missing image, a BIOS type other than 'ovmf', a volume of another content type, a storage that does not exist and a storage without the efi-firmware content type. Also enhance the PVE::QemuServer::OVMF test mock to handle nonexistent files. Signed-off-by: Christian Ludwig --- .../efi-custom-firmware-content-disabled.conf | 5 +++ .../cfg2cmd/efi-custom-firmware-legacy.conf | 13 ++++++++ .../efi-custom-firmware-legacy.conf.cmd | 28 ++++++++++++++++ .../efi-custom-firmware-no-storage.conf | 5 +++ .../efi-custom-firmware-not-found.conf | 5 +++ .../cfg2cmd/efi-custom-firmware-seabios.conf | 4 +++ src/test/cfg2cmd/efi-custom-firmware-sev.conf | 6 ++++ .../cfg2cmd/efi-custom-firmware-sev.conf.cmd | 32 +++++++++++++++++++ src/test/cfg2cmd/efi-custom-firmware-snp.conf | 5 +++ .../cfg2cmd/efi-custom-firmware-snp.conf.cmd | 30 +++++++++++++++++ src/test/cfg2cmd/efi-custom-firmware-tdx.conf | 5 +++ .../cfg2cmd/efi-custom-firmware-tdx.conf.cmd | 30 +++++++++++++++++ .../efi-custom-firmware-wrong-content.conf | 5 +++ src/test/cfg2cmd/efi-custom-firmware.conf | 4 +++ src/test/cfg2cmd/efi-custom-firmware.conf.cmd | 31 ++++++++++++++++++ src/test/parse-config-input/efi-firmware.conf | 12 +++++++ .../regular-vm-efifirmware.conf | 16 ++++++++++ src/test/run_config2command_tests.pl | 2 ++ src/test/run_parse_config_tests.pl | 2 +- 19 files changed, 239 insertions(+), 1 deletion(-) create mode 100644 src/test/cfg2cmd/efi-custom-firmware-content-disabled.conf 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-no-storage.conf create mode 100644 src/test/cfg2cmd/efi-custom-firmware-not-found.conf create mode 100644 src/test/cfg2cmd/efi-custom-firmware-seabios.conf 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-wrong-content.conf 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-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-content-disabled.conf b/src/test/cfg2cmd/efi-custom-firmware-content-disabled.conf new file mode 100644 index 00000000..d8071d74 --- /dev/null +++ b/src/test/cfg2cmd/efi-custom-firmware-content-disabled.conf @@ -0,0 +1,5 @@ +# TEST: Custom firmware on a storage without the efi-firmware content type causes die +# EXPECT_ERROR: bios: custom firmware 'noimages:efi-firmware/custom.fd' - storage 'noimages' does not support content type 'efi-firmware' +smbios1: uuid=7b10d7af-b932-4c66-b2c3-3996152ec465 +bios: ovmf,firmware=noimages:efi-firmware/custom.fd +efidisk0: local:100/vm-100-disk-0.raw 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..5f0cb899 --- /dev/null +++ b/src/test/cfg2cmd/efi-custom-firmware-legacy.conf @@ -0,0 +1,13 @@ +# TEST: Custom firmware replaces system OVMF_CODE path in legacy -drive command line +bios: ovmf,firmware=local:efi-firmware/custom.fd +bootdisk: scsi0 +cores: 2 +efidisk0: local:100/vm-100-disk-1.qcow2,size=128K +machine: pc-q35-7.0 +meta: creation-qemu=6.1 +memory: 512 +net0: virtio=2E:01:68:F9:9C:87,bridge=vmbr0 +ostype: l26 +scsihw: virtio-scsi-pci +smbios1: uuid=3dd750ce-d910-44d0-9493-525c0be4e687 +vmgenid: 54d1c06c-8f5b-440f-b5b2-6eab1380e13d 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..c20ff00c --- /dev/null +++ b/src/test/cfg2cmd/efi-custom-firmware-legacy.conf.cmd @@ -0,0 +1,28 @@ +/usr/bin/kvm \ + -id 8006 \ + -name vm8006 \ + -no-shutdown \ + -chardev 'socket,id=qmp,path=/var/run/qemu-server/8006.qmp,server=on,wait=off' \ + -object 'monitor-qmp,chardev=qmp,id=monitor-qmp' \ + -chardev 'socket,id=qmp-event,path=/var/run/qmeventd.sock,reconnect-ms=5000' \ + -object 'monitor-qmp,chardev=qmp-event,id=monitor-qmp-event' \ + -pidfile /var/run/qemu-server/8006.pid \ + -daemonize \ + -smbios 'type=1,uuid=3dd750ce-d910-44d0-9493-525c0be4e687' \ + -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=qcow2,file=/var/lib/vz/images/100/vm-100-disk-1.qcow2' \ + -smp '2,sockets=1,cores=2,maxcpus=2' \ + -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 \ + -readconfig /usr/share/qemu-server/pve-q35-4.0.cfg \ + -device 'vmgenid,guid=54d1c06c-8f5b-440f-b5b2-6eab1380e13d' \ + -device 'usb-tablet,id=tablet,bus=ehci.0,port=1' \ + -device 'VGA,id=vga,bus=pcie.0,addr=0x1' \ + -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' \ + -netdev 'type=tap,id=net0,ifname=tap8006i0,script=/usr/libexec/qemu-server/pve-bridge,downscript=/usr/libexec/qemu-server/pve-bridgedown,vhost=on' \ + -device 'virtio-net-pci,mac=2E:01:68:F9:9C:87,netdev=net0,bus=pci.0,addr=0x12,id=net0,bootindex=300' \ + -machine 'type=pc-q35-7.0+pve0' diff --git a/src/test/cfg2cmd/efi-custom-firmware-no-storage.conf b/src/test/cfg2cmd/efi-custom-firmware-no-storage.conf new file mode 100644 index 00000000..1bab97ae --- /dev/null +++ b/src/test/cfg2cmd/efi-custom-firmware-no-storage.conf @@ -0,0 +1,5 @@ +# TEST: Custom firmware on a storage that does not exist causes die +# EXPECT_ERROR: bios: custom firmware 'nostorage:efi-firmware/custom.fd' - storage 'nostorage' does not exist +smbios1: uuid=7b10d7af-b932-4c66-b2c3-3996152ec465 +bios: ovmf,firmware=nostorage:efi-firmware/custom.fd +efidisk0: local:100/vm-100-disk-0.raw 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..67e9d4f5 --- /dev/null +++ b/src/test/cfg2cmd/efi-custom-firmware-not-found.conf @@ -0,0 +1,5 @@ +# TEST: Custom firmware pointing to a nonexistent file causes die +# EXPECT_ERROR: custom firmware image '/var/lib/vz/efi-firmware/nonexistent.fd' not found +smbios1: uuid=7b10d7af-b932-4c66-b2c3-3996152ec465 +bios: ovmf,firmware=local:efi-firmware/nonexistent.fd +efidisk0: local:100/vm-100-disk-0.raw diff --git a/src/test/cfg2cmd/efi-custom-firmware-seabios.conf b/src/test/cfg2cmd/efi-custom-firmware-seabios.conf new file mode 100644 index 00000000..d4435400 --- /dev/null +++ b/src/test/cfg2cmd/efi-custom-firmware-seabios.conf @@ -0,0 +1,4 @@ +# TEST: Custom firmware without the ovmf BIOS type causes die +# EXPECT_ERROR: a custom firmware image requires the 'ovmf' BIOS type +bios: seabios,firmware=local:efi-firmware/custom.fd +smbios1: uuid=7b10d7af-b932-4c66-b2c3-3996152ec465 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..237ae030 --- /dev/null +++ b/src/test/cfg2cmd/efi-custom-firmware-sev.conf @@ -0,0 +1,6 @@ +# TEST: Custom 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,firmware=local:efi-firmware/custom.fd +efidisk0: local:100/vm-100-disk-0.raw,efitype=4m,pre-enrolled-keys=1,size=528K +amd-sev: type=std 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..35d1fd91 --- /dev/null +++ b/src/test/cfg2cmd/efi-custom-firmware-sev.conf.cmd @@ -0,0 +1,32 @@ +/usr/bin/kvm \ + -id 8006 \ + -name vm8006 \ + -no-shutdown \ + -chardev 'socket,id=qmp,path=/var/run/qemu-server/8006.qmp,server=on,wait=off' \ + -object 'monitor-qmp,chardev=qmp,id=monitor-qmp' \ + -chardev 'socket,id=qmp-event,path=/var/run/qmeventd.sock,reconnect-ms=5000' \ + -object 'monitor-qmp,chardev=qmp-event,id=monitor-qmp-event' \ + -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 'pci-bridge,id=pci.4,chassis_nr=4,bus=pci.1,addr=0x1c' \ + -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..094a8e89 --- /dev/null +++ b/src/test/cfg2cmd/efi-custom-firmware-snp.conf @@ -0,0 +1,5 @@ +# TEST: Custom firmware replaces default SNP firmware in -bios argument +# HW_CAPABILITIES: amd-turin-9005 +smbios1: uuid=7b10d7af-b932-4c66-b2c3-3996152ec465 +bios: ovmf,firmware=local:efi-firmware/custom.fd +amd-sev: type=snp 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..ca1268c0 --- /dev/null +++ b/src/test/cfg2cmd/efi-custom-firmware-snp.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' \ + -object 'monitor-qmp,chardev=qmp,id=monitor-qmp' \ + -chardev 'socket,id=qmp-event,path=/var/run/qmeventd.sock,reconnect-ms=5000' \ + -object 'monitor-qmp,chardev=qmp-event,id=monitor-qmp-event' \ + -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 'pci-bridge,id=pci.4,chassis_nr=4,bus=pci.1,addr=0x1c' \ + -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..62167eb9 --- /dev/null +++ b/src/test/cfg2cmd/efi-custom-firmware-tdx.conf @@ -0,0 +1,5 @@ +# TEST: Custom 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,firmware=local:efi-firmware/custom.fd +intel-tdx: tdx,attestation=0 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..ca615654 --- /dev/null +++ b/src/test/cfg2cmd/efi-custom-firmware-tdx.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' \ + -object 'monitor-qmp,chardev=qmp,id=monitor-qmp' \ + -chardev 'socket,id=qmp-event,path=/var/run/qmeventd.sock,reconnect-ms=5000' \ + -object 'monitor-qmp,chardev=qmp-event,id=monitor-qmp-event' \ + -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 'pci-bridge,id=pci.4,chassis_nr=4,bus=pci.1,addr=0x1c' \ + -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-wrong-content.conf b/src/test/cfg2cmd/efi-custom-firmware-wrong-content.conf new file mode 100644 index 00000000..e4d11f58 --- /dev/null +++ b/src/test/cfg2cmd/efi-custom-firmware-wrong-content.conf @@ -0,0 +1,5 @@ +# TEST: Custom firmware referencing a volume of another content type causes die +# EXPECT_ERROR: bios: custom firmware 'local:iso/custom.iso' - volume has content type 'iso', expected 'efi-firmware' +smbios1: uuid=7b10d7af-b932-4c66-b2c3-3996152ec465 +bios: ovmf,firmware=local:iso/custom.iso +efidisk0: local:100/vm-100-disk-0.raw diff --git a/src/test/cfg2cmd/efi-custom-firmware.conf b/src/test/cfg2cmd/efi-custom-firmware.conf new file mode 100644 index 00000000..709ff748 --- /dev/null +++ b/src/test/cfg2cmd/efi-custom-firmware.conf @@ -0,0 +1,4 @@ +# TEST: Custom firmware replaces system OVMF_CODE path in blockdev command line +smbios1: uuid=7b10d7af-b932-4c66-b2c3-3996152ec465 +bios: ovmf,firmware=local:efi-firmware/custom.fd +efidisk0: local:100/vm-100-disk-0.raw 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..90ab2556 --- /dev/null +++ b/src/test/cfg2cmd/efi-custom-firmware.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' \ + -object 'monitor-qmp,chardev=qmp,id=monitor-qmp' \ + -chardev 'socket,id=qmp-event,path=/var/run/qmeventd.sock,reconnect-ms=5000' \ + -object 'monitor-qmp,chardev=qmp-event,id=monitor-qmp-event' \ + -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 'pci-bridge,id=pci.4,chassis_nr=4,bus=pci.1,addr=0x1c' \ + -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-input/efi-firmware.conf b/src/test/parse-config-input/efi-firmware.conf new file mode 100644 index 00000000..7c4f04cf --- /dev/null +++ b/src/test/parse-config-input/efi-firmware.conf @@ -0,0 +1,12 @@ +bios: ovmf,firmware=local:efi-firmware/custom.fd +boot: order=scsi0 +cores: 2 +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..4b76ccf8 --- /dev/null +++ b/src/test/parse-config-input/regular-vm-efifirmware.conf @@ -0,0 +1,16 @@ +# regular VM with an EFI disk and custom firmware +bios: ovmf,firmware=mydir:efi-firmware/custom.fd +boot: order=scsi0;ide2;net0 +cores: 1 +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 28f538d3..34193549 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', @@ -286,6 +287,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..b2a02374 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 * 12; sub run_tests { my ($strict) = @_; -- 2.34.1