From: Fiona Ebner <f.ebner@proxmox.com>
To: Christian Ludwig <christian_ludwig@genua.de>,
pve-devel@lists.proxmox.com
Subject: Re: [PATCH qemu-server v3 11/19] api: check the custom firmware of the bios option
Date: Thu, 5 Nov 2026 16:23:54 +0100 [thread overview]
Message-ID: <c4472e8a-232c-46ea-851a-b7df5cd5407a@proxmox.com> (raw)
In-Reply-To: <e5d97d6d0b572fbde4bbbae919a5cc62ddbec434.1793029144.git@genua.de>
Am 27.10.26 um 11:14 AM schrieb Christian Ludwig:
> When the bios option is set via the POST/PUT {vmid}/config endpoints,
> check that the user may access the custom firmware image, that it is an
> efi-firmware volume, and that the BIOS type is 'ovmf'. Like for ISO
> images, whether the image is usable on the node is only checked when the
> VM is started. The option keeps requiring the VM.Config.Options
> permission.
>
> A cloned VM references the same firmware image, like an ISO image, so a
> clone is only considered shared if the image is on a shared storage.
>
> Report custom firmware images in the local disks of the migration
> precondition check, so that clients can tell why a migration is not
> possible.
>
> Signed-off-by: Christian Ludwig <christian_ludwig@genua.de>
> ---
> src/PVE/API2/Qemu.pm | 37 +++++++++++++++++++++++++++++++++++++
> 1 file changed, 37 insertions(+)
>
> diff --git a/src/PVE/API2/Qemu.pm b/src/PVE/API2/Qemu.pm
> index 922c6599..3338edc2 100644
> --- a/src/PVE/API2/Qemu.pm
> +++ b/src/PVE/API2/Qemu.pm
> @@ -29,6 +29,7 @@ use PVE::GuestImport;
> use PVE::QemuConfig;
> use PVE::QemuServer;
> use PVE::QemuServer::Agent;
> +use PVE::QemuServer::BIOS;
> use PVE::QemuServer::Blockdev;
> use PVE::QemuServer::BlockJob;
> use PVE::QemuServer::Cloudinit;
> @@ -107,6 +108,20 @@ my $foreach_volume_with_alloc = sub {
> }
> };
>
> +my $check_bios_param = sub {
Style nit: please use "my sub check_bios_param {"
> + my ($param) = @_;
> +
> + return if !defined($param->{bios});
> +
> + eval {
> + PVE::QemuServer::BIOS::check_bios(PVE::QemuServer::BIOS::parse_bios($param->{bios}));
> + };
> + if (my $err = $@) {
> + chomp($err);
> + raise_param_exc({ bios => $err });
> + }
> +};
> +
> my $check_drive_param = sub {
> my ($param, $storecfg, $extra_checks) = @_;
>
> @@ -277,6 +292,13 @@ my $check_storage_access = sub {
> "/storage/$settings->{vmstatestorage}",
> ['Datastore.AllocateSpace'],
> ) if defined($settings->{vmstatestorage});
> +
> + if (defined($settings->{bios})) {
> + my $firmware = PVE::QemuServer::BIOS::parse_bios($settings->{bios})->{firmware};
> + PVE::Storage::check_volume_access(
> + $rpcenv, $authuser, $storecfg, $vmid, $firmware, 'efi-firmware',
> + ) if defined($firmware);
Style nit: multiline post-if should be avoided.
> + }
> };
>
> my $check_storage_access_clone = sub {
> @@ -319,6 +341,13 @@ my $check_storage_access_clone = sub {
> $rpcenv->check($authuser, "/storage/$conf->{vmstatestorage}", ['Datastore.AllocateSpace'])
> if defined($conf->{vmstatestorage});
>
> + # like ISO images, a custom firmware image is simply referenced by the clone
> + if (my $firmware = PVE::QemuServer::BIOS::get_bios_firmware($conf)) {
> + my ($sid) = PVE::Storage::parse_volume_id($firmware);
> + my $scfg = PVE::Storage::storage_config($storecfg, $sid);
> + $sharedvm = 0 if !$scfg->{shared};
> + }
> +
> return $sharedvm;
> };
>
> @@ -1365,6 +1394,7 @@ __PACKAGE__->register_method({
> &$check_cpu_model_access($rpcenv, $authuser, $param);
>
> $check_drive_param->($param, $storecfg);
> + $check_bios_param->($param);
>
> PVE::QemuServer::Network::add_random_macs($param);
> }
> @@ -2203,6 +2233,8 @@ my $update_vm_api = sub {
> $rpcenv, $authuser, $storecfg, $vmid, $param, undef, $extraction_storage,
> );
>
> + $check_bios_param->($param);
> +
> PVE::QemuServer::check_bridge_access($rpcenv, $authuser, $param);
>
> my $load_and_check_config = sub {
> @@ -5348,6 +5380,11 @@ __PACKAGE__->register_method({
> type => 'boolean',
> description => 'True if the disk is a cdrom.',
> },
> + is_firmware => {
> + type => 'boolean',
> + description => 'True if the volume is a custom firmware image.',
> + optional => 1,
> + },
> is_unused => {
> type => 'boolean',
> description => 'True if the disk is unused.',
next prev parent reply other threads:[~2026-11-05 15:24 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-27 10:12 [PATCH v3 00/19] Support for custom EFI firmware Christian Ludwig
2026-10-27 10:12 ` [PATCH pve-storage v3 01/19] plugin: add efi-firmware content type Christian Ludwig
2026-11-03 16:31 ` Fiona Ebner
2026-10-27 10:12 ` [PATCH pve-storage v3 02/19] test: get_subdir: cover the " Christian Ludwig
2026-10-27 10:12 ` [PATCH pve-storage v3 03/19] plugins: allow the efi-firmware content type on file based storages Christian Ludwig
2026-10-27 10:12 ` [PATCH pve-storage v3 04/19] plugin: support efi-firmware volumes in volume export and import Christian Ludwig
2026-10-27 10:12 ` [PATCH pve-storage v3 05/19] api: status: support efi-firmware in upload and download-url Christian Ludwig
2026-11-03 16:31 ` Fiona Ebner
2026-10-27 10:12 ` [PATCH pve-storage v3 06/19] test: volume access: cover efi-firmware volumes Christian Ludwig
2026-10-27 10:12 ` [PATCH pve-storage v3 07/19] test: list volumes: " Christian Ludwig
2026-10-27 10:12 ` [PATCH pve-storage v3 08/19] test: cover efi-firmware volumes in parse_volname and path_to_volume_id Christian Ludwig
2026-10-27 10:12 ` [PATCH qemu-server v3 09/19] config: define bios schema as property-string Christian Ludwig
2026-11-05 15:23 ` Fiona Ebner
2026-10-27 10:12 ` [PATCH qemu-server v3 10/19] bios: add a custom firmware sub-property Christian Ludwig
2026-11-05 15:23 ` Fiona Ebner
2026-10-27 10:12 ` [PATCH qemu-server v3 11/19] api: check the custom firmware of the bios option Christian Ludwig
2026-11-05 15:23 ` Fiona Ebner [this message]
2026-10-27 10:12 ` [PATCH qemu-server v3 12/19] test: custom firmware in " Christian Ludwig
2026-10-27 10:12 ` [PATCH qemu-server v3 13/19] test: custom firmware volumes in replication and migration Christian Ludwig
2026-10-27 10:12 ` [PATCH pve-manager v3 14/19] ui: storage: add efi-firmware content type support Christian Ludwig
2026-10-27 10:12 ` [PATCH pve-manager v3 15/19] ui: form: support other content types in the ISO selector Christian Ludwig
2026-10-27 10:12 ` [PATCH pve-manager v3 16/19] ui: qemu: allow selecting a custom EFI firmware image Christian Ludwig
2026-10-27 10:12 ` [PATCH pve-manager v3 17/19] ui: migrate: refuse migration with a local custom " Christian Ludwig
2026-10-27 10:12 ` [PATCH pve-docs v3 18/19] pvesm: document the efi-firmware content type Christian Ludwig
2026-10-27 10:12 ` [PATCH pve-docs v3 19/19] qm: document the custom firmware of the bios option Christian Ludwig
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=c4472e8a-232c-46ea-851a-b7df5cd5407a@proxmox.com \
--to=f.ebner@proxmox.com \
--cc=christian_ludwig@genua.de \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox