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 855B41FF13C for ; Thu, 30 Apr 2026 12:21:40 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 76105549; Thu, 30 Apr 2026 12:21:35 +0200 (CEST) From: Fiona Ebner To: pve-devel@lists.proxmox.com Subject: [PATCH qemu-server] snapshot: tpm state: revert to using 'storage' snapshot type when not using QSD Date: Thu, 30 Apr 2026 12:03:39 +0200 Message-ID: <20260430101035.73226-1-f.ebner@proxmox.com> X-Mailer: git-send-email 2.47.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1777543739849 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.009 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 URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [qemuserver.pm] Message-ID-Hash: RQRP465SRMQ4HOMGMJAZL2L7RUJBIKFU X-Message-ID-Hash: RQRP465SRMQ4HOMGMJAZL2L7RUJBIKFU X-MailFrom: f.ebner@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: When the QEMU Storage Daemon is not used for a TPM state drive, the snapshot still needs to be made via the storage layer, because the drive is neither attached to the VM nor QSD, so the snapshot cannot be taken via QMP. Fixes: da752aaf ("snapshot: support live snapshot (remove) of qcow2 TPM drive on storage with snapshot-as-volume-chain") Signed-off-by: Fiona Ebner --- src/PVE/QemuServer.pm | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/PVE/QemuServer.pm b/src/PVE/QemuServer.pm index 964b9dd2..62ebb0e6 100644 --- a/src/PVE/QemuServer.pm +++ b/src/PVE/QemuServer.pm @@ -4351,7 +4351,7 @@ sub qemu_volume_snapshot { my $volid = $drive->{file}; my $running = check_running($vmid); - my $do_snapshots_type = do_snapshots_type($storecfg, $volid, $deviceid, $running); + my $do_snapshots_type = do_snapshots_type($storecfg, $drive, $deviceid, $running); if ($do_snapshots_type eq 'internal') { print "internal qemu snapshot\n"; @@ -4396,7 +4396,7 @@ sub qemu_volume_snapshot_delete { ); } - my $do_snapshots_type = do_snapshots_type($storecfg, $volid, $attached_deviceid, $running); + my $do_snapshots_type = do_snapshots_type($storecfg, $drive, $attached_deviceid, $running); if ($do_snapshots_type eq 'internal') { my $qmp_peer = PVE::QemuServer::Drive::drive_qmp_peer($storecfg, $vmid, $drive); @@ -7790,12 +7790,19 @@ sub restore_tar_archive { } sub do_snapshots_type { - my ($storecfg, $volid, $deviceid, $running) = @_; + my ($storecfg, $drive, $deviceid, $running) = @_; #we use storage snapshot if vm is not running or if disk is unused; return 'storage' if !$running || !$deviceid; - if (my $method = PVE::Storage::volume_qemu_snapshot_method($storecfg, $volid)) { + if ( + $deviceid eq 'drive-tpmstate0' + && !PVE::QemuServer::Drive::drive_uses_qsd_fuse($storecfg, $drive) + ) { + return 'storage'; + } + + if (my $method = PVE::Storage::volume_qemu_snapshot_method($storecfg, $drive->{file})) { return 'internal' if $method eq 'qemu'; return 'external' if $method eq 'mixed'; } -- 2.47.3