public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Fiona Ebner <f.ebner@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH qemu-server 16/16] fix #4693: drive: allow non-raw image formats for TPM state drive
Date: Tue, 14 Oct 2025 16:39:27 +0200	[thread overview]
Message-ID: <20251014143946.160679-17-f.ebner@proxmox.com> (raw)
In-Reply-To: <20251014143946.160679-1-f.ebner@proxmox.com>

Now that there is a mechanism to export non-raw images as FUSE for
swtpm, it's possible to align the possible formats with what other
disk types can use. This also reduces special-casing for TPM state
volumes.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
---

Build-dependency bump and dependency bump for pve-storage needed!

 src/PVE/API2/Qemu.pm        | 7 ++-----
 src/PVE/QemuServer.pm       | 1 -
 src/PVE/QemuServer/Drive.pm | 2 ++
 3 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/src/PVE/API2/Qemu.pm b/src/PVE/API2/Qemu.pm
index 4243e4da..e77245a3 100644
--- a/src/PVE/API2/Qemu.pm
+++ b/src/PVE/API2/Qemu.pm
@@ -627,13 +627,13 @@ my sub create_disks : prototype($$$$$$$$$$$) {
                         $storecfg, $storeid, $vmid, $fmt, $arch, $disk, $smm, $amd_sev_type,
                     );
                 } elsif ($ds eq 'tpmstate0') {
-                    # swtpm can only use raw volumes, and uses a fixed size
+                    # A fixed size is used for TPM state volumes
                     $size = PVE::Tools::convert_size(
                         PVE::QemuServer::Drive::TPMSTATE_DISK_SIZE,
                         'b' => 'kb',
                     );
                     $volid =
-                        PVE::Storage::vdisk_alloc($storecfg, $storeid, $vmid, "raw", undef, $size);
+                        PVE::Storage::vdisk_alloc($storecfg, $storeid, $vmid, $fmt, undef, $size);
                 } else {
                     $volid =
                         PVE::Storage::vdisk_alloc($storecfg, $storeid, $vmid, $fmt, undef, $size);
@@ -675,9 +675,6 @@ my sub create_disks : prototype($$$$$$$$$$$) {
                     ) {
                         die "$ds - cloud-init drive is already attached at '$ci_key'\n";
                     }
-                } elsif ($ds eq 'tpmstate0' && $volume_format ne 'raw') {
-                    die
-                        "tpmstate0: volume format is '$volume_format', only 'raw' is supported!\n";
                 }
             }
 
diff --git a/src/PVE/QemuServer.pm b/src/PVE/QemuServer.pm
index dcc5cafb..0326c054 100644
--- a/src/PVE/QemuServer.pm
+++ b/src/PVE/QemuServer.pm
@@ -7825,7 +7825,6 @@ sub clone_disk {
         } elsif ($dst_drivename eq 'efidisk0') {
             $size = $efisize or die "internal error - need to specify EFI disk size\n";
         } elsif ($dst_drivename eq 'tpmstate0') {
-            $dst_format = 'raw';
             $size = PVE::QemuServer::Drive::TPMSTATE_DISK_SIZE;
         } else {
             clone_disk_check_io_uring(
diff --git a/src/PVE/QemuServer/Drive.pm b/src/PVE/QemuServer/Drive.pm
index 79dd22e6..f54f9612 100644
--- a/src/PVE/QemuServer/Drive.pm
+++ b/src/PVE/QemuServer/Drive.pm
@@ -10,6 +10,7 @@ use List::Util qw(first);
 
 use PVE::RESTEnvironment qw(log_warn);
 use PVE::Storage;
+use PVE::Storage::Common;
 use PVE::JSONSchema qw(get_standard_option);
 
 use base qw(Exporter);
@@ -570,6 +571,7 @@ my $tpmstate_fmt = {
         format_description => 'volume',
         description => "The drive's backing volume.",
     },
+    format => get_standard_option('pve-vm-image-format', { optional => 1 }),
     size => {
         type => 'string',
         format => 'disk-size',
-- 
2.47.3



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


  parent reply	other threads:[~2025-10-14 14:41 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-14 14:39 [pve-devel] [PATCH-SERIES qemu/swtpm/storage/qemu-server 00/16] " Fiona Ebner
2025-10-14 14:39 ` [pve-devel] [PATCH qemu 01/16] d/rules: enable fuse Fiona Ebner
2025-10-17 13:09   ` Daniel Kral
2025-10-17 14:03     ` Fiona Ebner
2025-10-14 14:39 ` [pve-devel] [PATCH swtpm 02/16] swtpm setup: file: always just clear header rather than unlinking Fiona Ebner
2025-10-14 14:39 ` [pve-devel] [PATCH storage 03/16] common: add pve-vm-image-format standard option for VM image formats Fiona Ebner
2025-10-14 14:39 ` [pve-devel] [PATCH qemu-server 04/16] tests: cfg2cmd: remove invalid mocking of qmp_cmd Fiona Ebner
2025-10-14 14:39 ` [pve-devel] [PATCH qemu-server 05/16] migration: offline volumes: drop deprecated special casing for TPM state Fiona Ebner
2025-10-14 14:39 ` [pve-devel] [PATCH qemu-server 06/16] qmp client: better abstract peer in preparation for qemu-storage-daemon Fiona Ebner
2025-10-17 12:38   ` Daniel Kral
2025-10-17 13:36     ` Fiona Ebner
2025-10-14 14:39 ` [pve-devel] [PATCH qemu-server 07/16] monitor: qmp: precise error message by logging peer type Fiona Ebner
2025-10-14 14:39 ` [pve-devel] [PATCH qemu-server 08/16] helpers: add functions for qemu-storage-daemon instances Fiona Ebner
2025-10-14 14:39 ` [pve-devel] [PATCH qemu-server 09/16] monitor: qmp: allow 'qsd' peer type for qemu-storage-daemon Fiona Ebner
2025-10-14 14:39 ` [pve-devel] [PATCH qemu-server 10/16] monitor: align interface of qmp_cmd() with other helpers Fiona Ebner
2025-10-14 14:39 ` [pve-devel] [PATCH qemu-server 11/16] machine: include +pve version when getting installed machine version Fiona Ebner
2025-10-14 14:39 ` [pve-devel] [PATCH qemu-server 12/16] blockdev: support attaching to qemu-storage-daemon Fiona Ebner
2025-10-14 14:39 ` [pve-devel] [PATCH qemu-server 13/16] blockdev: attach: also return whether attached blockdev is read-only Fiona Ebner
2025-10-14 14:39 ` [pve-devel] [PATCH qemu-server 14/16] introduce QSD module for qemu-storage-daemon functionality Fiona Ebner
2025-10-17 13:08   ` Daniel Kral
2025-10-17 14:46     ` Fiona Ebner
2025-10-20  8:47   ` Laurent GUERBY
2025-10-20  9:49     ` Fiona Ebner
2025-10-20 10:00       ` Fiona Ebner
2025-10-20 11:27       ` Laurent GUERBY
2025-10-14 14:39 ` [pve-devel] [PATCH qemu-server 15/16] tpm: support non-raw volumes via FUSE exports for swtpm Fiona Ebner
2025-10-14 14:39 ` Fiona Ebner [this message]
2025-10-17 13:17 ` [pve-devel] [PATCH-SERIES qemu/swtpm/storage/qemu-server 00/16] fix #4693: drive: allow non-raw image formats for TPM state drive Daniel Kral

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=20251014143946.160679-17-f.ebner@proxmox.com \
    --to=f.ebner@proxmox.com \
    --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