From: Christian Ludwig <christian_ludwig@genua.de>
To: <pve-devel@lists.proxmox.com>
Subject: [PATCH pve-storage v4 01/20] plugin: add efi-firmware content type
Date: Thu, 19 Nov 2026 15:14:06 +0100 [thread overview]
Message-ID: <b1ce4b03e66addc1a704f7647897c69dd5228e09.1795092172.git.christian_ludwig@genua.de> (raw)
In-Reply-To: <cover.1795092172.git.christian_ludwig@genua.de>
Holds custom OVMF code images in the efi-firmware/ subdirectory of a
storage. File names are restricted to the safe character class and must
end with '.fd'. Requiring the extension avoids confusion with other
image formats and leaves room for supporting other firmware formats
later on. Access is granted like for ISO images.
Reviewed-by: Fiona Ebner <f.ebner@proxmox.com>
Signed-off-by: Christian Ludwig <christian_ludwig@genua.de>
---
src/PVE/Storage.pm | 25 +++++++++++++++++++++----
src/PVE/Storage/Plugin.pm | 17 +++++++++++++++--
src/test/parse_volname_test.pm | 8 ++++++++
3 files changed, 44 insertions(+), 6 deletions(-)
diff --git a/src/PVE/Storage.pm b/src/PVE/Storage.pm
index faf325f..8c79c13 100755
--- a/src/PVE/Storage.pm
+++ b/src/PVE/Storage.pm
@@ -188,6 +188,8 @@ our $IMPORT_EXT_RE_1 = qr/\.(ova|ovf|qcow2|raw|vmdk)/;
our $UPLOAD_IMPORT_EXT_RE_1 = qr/\.(ova|qcow2|raw|vmdk)/;
+our $EFI_FIRMWARE_EXT_RE_1 = qr/\.(fd)/;
+
our $SAFE_CHAR_CLASS_RE = qr/[a-zA-Z0-9\-\.\+\=\_]/;
our $SAFE_CHAR_WITH_WHITESPACE_CLASS_RE = qr/[ a-zA-Z0-9\-\.\+\=\_]/;
@@ -698,7 +700,12 @@ sub check_volume_access {
return if $rpcenv->check($user, "/storage/$sid", ['Datastore.Allocate'], 1);
- if ($vtype eq 'iso' || $vtype eq 'vztmpl' || $vtype eq 'import') {
+ if (
+ $vtype eq 'iso'
+ || $vtype eq 'vztmpl'
+ || $vtype eq 'import'
+ || $vtype eq 'efi-firmware'
+ ) {
# require at least read access to storage, (custom) templates/ISOs could be sensitive
$rpcenv->check_any(
$user,
@@ -797,6 +804,7 @@ sub path_to_volume_id {
my $backupdir = $plugin->get_subdir($scfg, 'backup');
my $snippetsdir = $plugin->get_subdir($scfg, 'snippets');
my $importdir = $plugin->get_subdir($scfg, 'import');
+ my $firmwaredir = $plugin->get_subdir($scfg, 'efi-firmware');
if ($path =~ m!^\Q$imagedir\E/(\d+)/([^/\s]+)$!) {
my $vmid = $1;
@@ -826,6 +834,9 @@ sub path_to_volume_id {
} elsif ($path =~ m!^\Q$importdir\E/(${SAFE_CHAR_CLASS_RE}+${IMPORT_EXT_RE_1})$!) {
my $name = $1;
return ('import', "$sid:import/$name");
+ } elsif ($path =~ m!^\Q$firmwaredir\E/(${SAFE_CHAR_CLASS_RE}+${EFI_FIRMWARE_EXT_RE_1})$!) {
+ my $name = $1;
+ return ('efi-firmware', "$sid:efi-firmware/$name");
}
}
@@ -1357,7 +1368,11 @@ sub template_list {
my ($cfg, $storeid, $tt) = @_;
die "unknown template type '$tt'\n"
- if !($tt eq 'iso' || $tt eq 'vztmpl' || $tt eq 'backup' || $tt eq 'snippets');
+ if !($tt eq 'iso'
+ || $tt eq 'vztmpl'
+ || $tt eq 'backup'
+ || $tt eq 'snippets'
+ || $tt eq 'efi-firmware');
my $ids = $cfg->{ids};
@@ -1385,7 +1400,7 @@ sub template_list {
sub volume_list {
my ($cfg, $storeid, $vmid, $content) = @_;
- my @ctypes = qw(rootdir images vztmpl iso backup snippets import);
+ my @ctypes = qw(rootdir images vztmpl iso backup snippets import efi-firmware);
# plugins list the volumes of guests by their generic content type
my $vtype;
@@ -2390,7 +2405,9 @@ sub complete_storage_enabled {
sub complete_content_type {
my ($cmdname, $pname, $cvalue) = @_;
- return [qw(rootdir ct-vol images vm-vol vm-state vztmpl iso backup snippets import)];
+ return [
+ qw(rootdir ct-vol images vm-vol vm-state vztmpl iso backup snippets import efi-firmware)
+ ];
}
sub complete_volume {
diff --git a/src/PVE/Storage/Plugin.pm b/src/PVE/Storage/Plugin.pm
index 724c2d3..fd4a2cc 100644
--- a/src/PVE/Storage/Plugin.pm
+++ b/src/PVE/Storage/Plugin.pm
@@ -427,7 +427,7 @@ PVE::JSONSchema::register_format('pve-storage-content', \&verify_content);
sub verify_content {
my ($ct, $noerr) = @_;
- return $ct if $ct eq 'import';
+ return $ct if $ct eq 'import' || $ct eq 'efi-firmware';
my $valid_content = valid_content_types('dir'); # dir includes all other types
@@ -922,6 +922,10 @@ sub parse_volname {
m!^import/(${PVE::Storage::SAFE_CHAR_WITH_WHITESPACE_CLASS_RE}+$PVE::Storage::IMPORT_EXT_RE_1)$!
) {
return ('import', $1, undef, undef, undef, undef, $2);
+ } elsif ($volname =~
+ m!^efi-firmware/(${PVE::Storage::SAFE_CHAR_CLASS_RE}+$PVE::Storage::EFI_FIRMWARE_EXT_RE_1)$!
+ ) {
+ return ('efi-firmware', $1, undef, undef, undef, undef, 'raw');
}
die "unable to parse directory volume name '$volname'\n";
@@ -1028,6 +1032,7 @@ my $vtype_subdirs = {
backup => 'dump',
snippets => 'snippets',
import => 'import',
+ 'efi-firmware' => 'efi-firmware',
};
sub get_vtype_subdirs {
@@ -1874,7 +1879,7 @@ sub list_images {
return $res;
}
-# list templates ($tt = <iso|vztmpl|backup|snippets|import>)
+# list templates ($tt = <iso|vztmpl|backup|snippets|import|efi-firmware>)
my $get_subdir_files = sub {
my ($sid, $path, $tt, $vmid) = @_;
@@ -1940,6 +1945,12 @@ my $get_subdir_files = sub {
m!/(${PVE::Storage::SAFE_CHAR_CLASS_RE}+$PVE::Storage::IMPORT_EXT_RE_1)$!i;
$info = { volid => "$sid:import/$1", format => "$2" };
+ } elsif ($tt eq 'efi-firmware') {
+ next
+ if $fn !~
+ m!/(${PVE::Storage::SAFE_CHAR_CLASS_RE}+$PVE::Storage::EFI_FIRMWARE_EXT_RE_1)$!;
+
+ $info = { volid => "$sid:efi-firmware/$1", format => 'raw' };
}
$info->{size} = $st->size;
@@ -1976,6 +1987,8 @@ sub list_volumes {
$data = $get_subdir_files->($storeid, $path, 'snippets');
} elsif ($type eq 'import') {
$data = $get_subdir_files->($storeid, $path, 'import');
+ } elsif ($type eq 'efi-firmware' && !defined($vmid)) {
+ $data = $get_subdir_files->($storeid, $path, 'efi-firmware');
}
}
diff --git a/src/test/parse_volname_test.pm b/src/test/parse_volname_test.pm
index 5eb7f55..b8a4a21 100644
--- a/src/test/parse_volname_test.pm
+++ b/src/test/parse_volname_test.pm
@@ -203,6 +203,14 @@ my $tests = [
expected => ['import', 'import.ova/disk.raw', undef, undef, undef, undef, 'ova+raw'],
},
#
+ # EFI firmware
+ #
+ {
+ description => 'EFI firmware, fd',
+ volname => 'efi-firmware/custom-ovmf-code.fd',
+ expected => ['efi-firmware', 'custom-ovmf-code.fd', undef, undef, undef, undef, 'raw'],
+ },
+ #
# failed matches
#
{
--
2.34.1
next prev parent reply other threads:[~2026-11-19 14:15 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-19 14:14 [PATCH v4 00/20] Support for custom EFI firmware Christian Ludwig
2026-11-19 14:14 ` Christian Ludwig [this message]
2026-11-19 14:14 ` [PATCH pve-storage v4 02/20] test: get_subdir: cover the efi-firmware content type Christian Ludwig
2026-11-19 14:14 ` [PATCH pve-storage v4 03/20] plugins: allow the efi-firmware content type on file based storages Christian Ludwig
2026-11-19 14:14 ` [PATCH pve-storage v4 04/20] plugin: allow overriding the efi-firmware directory Christian Ludwig
2026-11-19 14:14 ` [PATCH pve-storage v4 05/20] plugin: support efi-firmware volumes in volume export and import Christian Ludwig
2026-11-19 14:14 ` [PATCH pve-storage v4 06/20] api: status: support efi-firmware in upload and download-url Christian Ludwig
2026-11-19 14:14 ` [PATCH pve-storage v4 07/20] test: volume access: cover efi-firmware volumes Christian Ludwig
2026-11-19 14:14 ` [PATCH pve-storage v4 08/20] test: list volumes: " Christian Ludwig
2026-11-19 14:14 ` [PATCH pve-storage v4 09/20] test: cover efi-firmware volumes in parse_volname and path_to_volume_id Christian Ludwig
2026-11-19 14:14 ` [PATCH qemu-server v4 10/20] config: define bios schema as property-string Christian Ludwig
2026-11-19 14:14 ` [PATCH qemu-server v4 11/20] bios: add a custom firmware sub-property Christian Ludwig
2026-11-19 14:14 ` [PATCH qemu-server v4 12/20] api: check the custom firmware of the bios option Christian Ludwig
2026-11-19 14:14 ` [PATCH qemu-server v4 13/20] test: custom firmware in " Christian Ludwig
2026-11-19 14:14 ` [PATCH qemu-server v4 14/20] test: custom firmware volumes in replication and migration Christian Ludwig
2026-11-19 14:14 ` [PATCH pve-manager v4 15/20] ui: storage: add efi-firmware content type support Christian Ludwig
2026-11-19 14:14 ` [PATCH pve-manager v4 16/20] ui: form: support other content types in the ISO selector Christian Ludwig
2026-11-19 14:14 ` [PATCH pve-manager v4 17/20] ui: qemu: allow selecting a custom EFI firmware image Christian Ludwig
2026-11-19 14:14 ` [PATCH pve-manager v4 18/20] ui: migrate: refuse migration with a local custom " Christian Ludwig
2026-11-19 14:14 ` [PATCH pve-docs v4 19/20] pvesm: document the efi-firmware content type Christian Ludwig
2026-11-19 14:14 ` [PATCH pve-docs v4 20/20] 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=b1ce4b03e66addc1a704f7647897c69dd5228e09.1795092172.git.christian_ludwig@genua.de \
--to=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