From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id 869DF1FF17A for ; Tue, 14 Oct 2025 16:41:19 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 6709D7BE5; Tue, 14 Oct 2025 16:40:31 +0200 (CEST) From: Fiona Ebner To: pve-devel@lists.proxmox.com Date: Tue, 14 Oct 2025 16:39:27 +0200 Message-ID: <20251014143946.160679-17-f.ebner@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20251014143946.160679-1-f.ebner@proxmox.com> References: <20251014143946.160679-1-f.ebner@proxmox.com> MIME-Version: 1.0 X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1760452753067 X-SPAM-LEVEL: Spam detection results: 0 AWL -0.021 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pve-devel] [PATCH qemu-server 16/16] fix #4693: drive: allow non-raw image formats for TPM state drive X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox VE development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" 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 --- 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