[pve-devel] [PATCH qemu-server 2/2] backup: fleecing: avoid warning when querying block node size for TPM state
Fiona Ebner
f.ebner at proxmox.com
Fri Oct 3 12:33:11 CEST 2025
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 at 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
More information about the pve-devel
mailing list