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 2/2] backup: fleecing: avoid warning when querying block node size for TPM state
Date: Fri,  3 Oct 2025 12:33:11 +0200	[thread overview]
Message-ID: <20251003103319.44974-3-f.ebner@proxmox.com> (raw)
In-Reply-To: <20251003103319.44974-1-f.ebner@proxmox.com>

Currently, there only is a warning that the fallback, being the size
queried from the storage, is used. This should work in all cases, but
there are plans for supporting TPM state as a FUSE/NBD export from an
underlying qcow2 image where it might still work, but the
correspondence of size between the attached block node in QEMU and the
storage layer already becomes much more blurry. Avoid the warning and
future-proof by also querying the size for the TPM state directly from
the attached block node in QEMU.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
---
 src/PVE/VZDump/QemuServer.pm | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/src/PVE/VZDump/QemuServer.pm b/src/PVE/VZDump/QemuServer.pm
index b84957be..55a3f55b 100644
--- a/src/PVE/VZDump/QemuServer.pm
+++ b/src/PVE/VZDump/QemuServer.pm
@@ -1128,9 +1128,22 @@ sub query_block_node_sizes {
 
     for my $diskinfo ($disks->@*) {
         my $drive_key = $diskinfo->{virtdev};
-        $drive_key .= "-backup" if $drive_key eq 'tpmstate0';
-        my $block_node_size =
-            eval { $block_info->{$drive_key}->{inserted}->{image}->{'virtual-size'}; };
+
+        my $block_node_size;
+        if ($drive_key eq 'tpmstate0') {
+            # There is no front-end device for TPM state, so it's not included in the result of
+            # get_block_info(). Note that it is always attached with the same explicit node name.
+            my $named_block_node_info = mon_cmd($vmid, 'query-named-block-nodes');
+            for my $info ($named_block_node_info->@*) {
+                next if $info->{'node-name'} ne 'drive-tpmstate0-backup';
+                $block_node_size = $info->{image}->{'virtual-size'};
+                last;
+            }
+        } else {
+            $block_node_size =
+                eval { $block_info->{$drive_key}->{inserted}->{image}->{'virtual-size'}; };
+        }
+
         if (!$block_node_size) {
             $self->loginfo(
                 "could not determine block node size of drive '$drive_key' - using fallback");
-- 
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-03 10:33 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-03 10:33 [pve-devel] [PATCH qemu-server 0/2] fix #6882: backup provider api: fix backup with TPM state by correctly generating node name Fiona Ebner
2025-10-03 10:33 ` [pve-devel] [PATCH qemu-server 1/2] " Fiona Ebner
2025-10-03 10:33 ` Fiona Ebner [this message]
2025-10-03 11:53 ` [pve-devel] applied-series: [PATCH qemu-server 0/2] " Fabian Grünbichler

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=20251003103319.44974-3-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