public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Christian Ludwig <christian_ludwig@genua.de>
To: <pve-devel@lists.proxmox.com>
Subject: [PATCH pve-storage 4/13] Extend storage API endpoints for efi-firmware
Date: Mon, 17 Aug 2026 13:59:25 +0200	[thread overview]
Message-ID: <aoL3nbGg+Dn8tZ3Q@pc43.vpn.genua.de> (raw)
In-Reply-To: <e9670c8e-1101-4591-9534-09217632176b@pc43.vpn.genua.de>

[-- Attachment #1: Type: text/plain, Size: 3790 bytes --]

Extend the storage upload and download-url API endpoints for the
efi-firmware content type. Provide an error message if the file name
does not match the safe character set.

Signed-off-by: Christian Ludwig <christian_ludwig@genua.de>
---
 src/PVE/API2/Storage/Status.pm | 14 ++++++++++++--
 src/PVE/Storage.pm             | 13 +++++++++++--
 2 files changed, 23 insertions(+), 4 deletions(-)

diff --git a/src/PVE/API2/Storage/Status.pm b/src/PVE/API2/Storage/Status.pm
index 741d514..a6fc317 100644
--- a/src/PVE/API2/Storage/Status.pm
+++ b/src/PVE/API2/Storage/Status.pm
@@ -533,7 +533,7 @@ __PACKAGE__->register_method({
                 description => "Content type.",
                 type => 'string',
                 format => 'pve-storage-content',
-                enum => ['iso', 'vztmpl', 'import'],
+                enum => ['iso', 'vztmpl', 'import', 'efi-firmware'],
             },
             filename => {
                 description =>
@@ -618,6 +618,11 @@ __PACKAGE__->register_method({
             }
 
             $path = PVE::Storage::get_import_dir($cfg, $storage);
+        } elsif ($content eq 'efi-firmware') {
+            if ($filename !~ m!${PVE::Storage::SAFE_CHAR_CLASS_RE}+$!) {
+                raise_param_exc({ filename => "invalid file name" });
+            }
+            $path = PVE::Storage::get_efi_firmware_dir($cfg, $storage);
         } else {
             raise_param_exc({ content => "upload content type '$content' not allowed" });
         }
@@ -770,7 +775,7 @@ __PACKAGE__->register_method({
                 description => "Content type.", # TODO: could be optional & detected in most cases
                 type => 'string',
                 format => 'pve-storage-content',
-                enum => ['iso', 'vztmpl', 'import'],
+                enum => ['iso', 'vztmpl', 'import', 'efi-firmware'],
             },
             filename => {
                 description =>
@@ -859,6 +864,11 @@ __PACKAGE__->register_method({
             }
 
             $path = PVE::Storage::get_import_dir($cfg, $storage);
+        } elsif ($content eq 'efi-firmware') {
+            if ($filename !~ m!${PVE::Storage::SAFE_CHAR_CLASS_RE}+$!) {
+                raise_param_exc({ filename => "invalid file name" });
+            }
+            $path = PVE::Storage::get_efi_firmware_dir($cfg, $storage);
         } else {
             raise_param_exc({ content => "upload content-type '$content' is not allowed" });
         }
diff --git a/src/PVE/Storage.pm b/src/PVE/Storage.pm
index 64ea9da..1083b1d 100755
--- a/src/PVE/Storage.pm
+++ b/src/PVE/Storage.pm
@@ -555,6 +555,15 @@ sub get_iso_dir {
     return $plugin->get_subdir($scfg, 'iso');
 }
 
+sub get_efi_firmware_dir {
+    my ($cfg, $storeid) = @_;
+
+    my $scfg = storage_config($cfg, $storeid);
+    my $plugin = PVE::Storage::Plugin->lookup($scfg->{type});
+
+    return $plugin->get_subdir($scfg, 'efi-firmware');
+}
+
 sub get_import_dir {
     my ($cfg, $storeid) = @_;
 
@@ -629,7 +638,7 @@ 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,
@@ -1297,7 +1306,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);
 
     my $cts = $content ? [$content] : [@ctypes];
 
-- 
2.34.1


  parent reply	other threads:[~2026-08-17 12:00 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-17  9:29 [PATCH storage/qemu 0/13]: Custom UEFI firmware in PVE Christian Ludwig
2026-08-17  9:29 ` [PATCH pve-storage 1/13] Add efi-firmware content type Christian Ludwig
2026-08-17  9:29 ` [PATCH pve-storage 2/13] Test for " Christian Ludwig
2026-08-17  9:29 ` [PATCH pve-storage 3/13] Allow efi-firmware in file-based storage Christian Ludwig
2026-08-17  9:29 ` [PATCH pve-storage 4/13] Extend storage API endpoints for efi-firmware Christian Ludwig
2026-08-17  9:29 ` [PATCH pve-storage 5/13] Volume access check test " Christian Ludwig
2026-08-17  9:29 ` [PATCH pve-storage 6/13] efi-firmware storage path to volume conversion test Christian Ludwig
2026-08-17  9:29 ` [PATCH qemu-server 07/13] Add efi-firmware key to VM config schema Christian Ludwig
2026-08-17  9:29 ` [PATCH qemu-server 08/13] Add efi-firmware support to the API Christian Ludwig
2026-08-17  9:29 ` [PATCH qemu-server 09/13] Generate efi-firmware Qemu command line Christian Ludwig
2026-08-17  9:29 ` [PATCH qemu-server 10/13] test: efi-firmware key in VM config Christian Ludwig
2026-08-17  9:29 ` [PATCH qemu-server 11/13] test: efi-firmware volumes replication Christian Ludwig
2026-08-17  9:29 ` [PATCH pve-docs 12/13] pvesm: Document efi-firmware content type Christian Ludwig
2026-08-17  9:29 ` [PATCH pve-docs 13/13] qm: Document efi-firmware VM option Christian Ludwig
2026-08-17 11:59 ` [PATCH storage/qemu 0/13]: Custom UEFI firmware in PVE Christian Ludwig
2026-08-17 11:59 ` [PATCH pve-storage 1/13] Add efi-firmware content type Christian Ludwig
2026-08-17 11:59 ` [PATCH pve-storage 2/13] Test for " Christian Ludwig
2026-08-17 11:59 ` [PATCH pve-storage 3/13] Allow efi-firmware in file-based storage Christian Ludwig
2026-08-17 11:59 ` Christian Ludwig [this message]
2026-08-17 11:59 ` [PATCH pve-storage 5/13] Volume access check test for efi-firmware Christian Ludwig
2026-08-17 11:59 ` [PATCH pve-storage 6/13] efi-firmware storage path to volume conversion test Christian Ludwig
2026-08-17 11:59 ` [PATCH qemu-server 07/13] Add efi-firmware key to VM config schema Christian Ludwig
2026-08-17 11:59 ` [PATCH qemu-server 08/13] Add efi-firmware support to the API Christian Ludwig
2026-08-17 11:59 ` [PATCH qemu-server 09/13] Generate efi-firmware Qemu command line Christian Ludwig
2026-08-17 11:59 ` [PATCH qemu-server 10/13] test: efi-firmware key in VM config Christian Ludwig
2026-08-17 11:59 ` [PATCH qemu-server 11/13] test: efi-firmware volumes replication Christian Ludwig
2026-08-17 11:59 ` [PATCH pve-docs 12/13] pvesm: Document efi-firmware content type Christian Ludwig
2026-08-17 11:59 ` [PATCH pve-docs 13/13] qm: Document efi-firmware VM 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=aoL3nbGg+Dn8tZ3Q@pc43.vpn.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
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal