From: Thomas Ellmenreich <t.ellmenreich@proxmox.com>
To: pve-devel@lists.proxmox.com
Cc: Thomas Ellmenreich <t.ellmenreich@proxmox.com>
Subject: [PATCH qemu-server 3/3] clone disk: read actual size when cloning TPM drive
Date: Tue, 27 Oct 2026 11:17:23 +0100 [thread overview]
Message-ID: <20261027101723.144576-4-t.ellmenreich@proxmox.com> (raw)
In-Reply-To: <20261027101723.144576-1-t.ellmenreich@proxmox.com>
When cloning a TPM drive, don't assume the default size of 4MiB, instead
read and then use the actual size. The default size is constant, but can
be changed, if the granularity of the backing storage is bigger than
4MiB.
This allows TPM volumes on storages with a larger granularity than 4MiB
be moved to different storages without producing an error.
Suggested-by: Fiona Ebner <f.ebner@proxmox.com>
Signed-off-by: Thomas Ellmenreich <t.ellmenreich@proxmox.com>
Reviewed-by: Fiona Ebner <f.ebner@proxmox.com>
---
src/PVE/QemuServer.pm | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/PVE/QemuServer.pm b/src/PVE/QemuServer.pm
index 954acd05..0c130041 100644
--- a/src/PVE/QemuServer.pm
+++ b/src/PVE/QemuServer.pm
@@ -78,6 +78,7 @@ use PVE::QemuServer::Drive qw(
parse_drive
print_drive
storage_allows_io_uring_default
+ get_tpmstate_size
);
use PVE::QemuServer::DriveDevice qw(print_drivedevice_full scsihw_infos);
use PVE::QemuServer::Machine;
@@ -7888,7 +7889,7 @@ 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') {
- $size = PVE::QemuServer::Drive::TPMSTATE_DISK_SIZE;
+ $size = get_tpmstate_size($drive->{file}, $storecfg);
} else {
clone_disk_check_io_uring(
$vmid, $drive, $storecfg, $src_storeid, $storeid, $use_drive_mirror,
--
2.47.3
prev parent reply other threads:[~2026-10-27 10:17 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-27 10:17 [PATCH qemu-server 0/3] drive: account for differing TPM sizes Thomas Ellmenreich
2026-10-27 10:17 ` [PATCH qemu-server 1/3] drive: update TPM size as max of current and minimum size Thomas Ellmenreich
2026-10-27 10:17 ` [PATCH qemu-server 2/3] api: create disks: update TPM size on creation Thomas Ellmenreich
2026-10-27 10:17 ` Thomas Ellmenreich [this message]
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=20261027101723.144576-4-t.ellmenreich@proxmox.com \
--to=t.ellmenreich@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.