From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [45.144.208.40]) by lore.proxmox.com (Postfix) with ESMTPS id E529C1FF0B0 for ; Tue, 27 Oct 2026 11:17:52 +0100 (CET) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 8A66F216B0; Tue, 27 Oct 2026 11:17:31 +0100 (CET) From: Thomas Ellmenreich To: pve-devel@lists.proxmox.com Subject: [PATCH qemu-server 0/3] drive: account for differing TPM sizes Date: Tue, 27 Oct 2026 11:17:20 +0100 Message-ID: <20261027101723.144576-1-t.ellmenreich@proxmox.com> X-Mailer: git-send-email 2.47.3 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1793096245905 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.374 Adjusted score from AWL reputation of From: address DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: HQLLG3W4H6XK7HMIS3HEJUUJ3VGAYJCO X-Message-ID-Hash: HQLLG3W4H6XK7HMIS3HEJUUJ3VGAYJCO X-MailFrom: t.ellmenreich@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 CC: Thomas Ellmenreich X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Our current systems to handle TPM drives always assume that the disks have a fixed 4MiB size that cannot be changed even if that may not be the case. In situations where the granularity of the backing storage exceeds the 4MiB, an allocation of a TPM drive will be at least as big as the granularity of said backing storage. To solve this mismatch in a very simple way, the default size is retained for allocation. Only after the allocation do we check the actual size of the created TPM disk and update the configuration accordingly. A minimum size of 4MiB is always applied to situations where that may not be the case. In the case of movement and cloning of disks, we just refer to the actual disk size instead of the TPM size constant. Doing so also makes it now possible to move a larger (than 4MiB) TPM disk to a different storage. Future work ----------- The last two patches in the RFC performed a rescan of a VM's disks after a migration. By doing so, any inaccuracies in the size of TPM disks would be fixed, but also so much more. Since this solution was a bit too "brute", we decided to drop it in favour of a future, cleaner, implementation. After migration, TPM disks retain their previous size, even if the granularity might have forced the size to increase. A future patch series should address this by going through the disks of the migrated VM and adjusting the sizes accordingly. The previous implementation is inadequate because it also reveals orphaned volumes and does so without using the migration tunnel. Changelog --------- * RFC -> v1 - Reworded commit messages and subroutine descriptions. - Subroutines now fail if the passed arguments are undefined. - Move TPM size utilities to QemuServer::Drive. - Utilities print a warning if getting the real size fails. - Removed the last 2 patches that rescanned all drives after a migration as that warrants more discussion. qemu-server: Thomas Ellmenreich (3): drive: update TPM size as max of current and minimum size api: create disks: update TPM size on creation clone disk: read actual size when cloning TPM drive src/PVE/API2/Qemu.pm | 19 +++++++++++----- src/PVE/QemuMigrate.pm | 9 ++++---- src/PVE/QemuServer.pm | 11 ++-------- src/PVE/QemuServer/Drive.pm | 44 +++++++++++++++++++++++++++++++++++++ 4 files changed, 65 insertions(+), 18 deletions(-) Summary over all repositories: 4 files changed, 65 insertions(+), 18 deletions(-) -- Generated by murpp 0.12.0