From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [IPv6:2a0f:8001:1:32::40]) by lore.proxmox.com (Postfix) with ESMTPS id 3AD061FF09C for ; Mon, 19 Oct 2026 11:54:10 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 4DE37216B5; Mon, 19 Oct 2026 11:53:53 +0200 (CEST) From: Thomas Ellmenreich To: pve-devel@lists.proxmox.com Subject: [RFC qemu-server 0/5] drive: account for differing TPM sizes Date: Mon, 19 Oct 2026 11:53:41 +0200 Message-ID: <20261019095346.175659-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: 1792403627393 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.435 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: WM4CILX2EY3UHU4EFYP55TEEZLPZIHVB X-Message-ID-Hash: WM4CILX2EY3UHU4EFYP55TEEZLPZIHVB 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 migrations, 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. Open Questions -------------- 1. During a migration a TPM disk might change from a storage with 4MiB granularity to a storage with 64MiB granularity. As already mentioned, the TPM disk's size is then automatically increased. The fix I have implemented for this, performs a "brute" `qm disk rescan --vmid` on the remote. This does the job, but also much more. To avoid all of the other side effects of a rescan, I could extend `qm disk rescan` to also take another parameter that specifies the disk and so Avoid any of the other side effects of calling a rescan on the whole VM. could This approach be better? or is there a even better approach? 2. The rescan is currently disabled for remote migrations, but it should also be safe for those. So does it make sense to also implement the rescan for remote migrations? 3. A small thing, but how should I handle errors produced by PVE::Tools::run_command? I didn't quite understand if run_command returns an error if an error is emitted by the internal command. If that is not the case, the context is never actually shown. qemu-server: Thomas Ellmenreich (5): drive: improve and extend TPM drive size helpers drive: update TPM size on creation drive: read actual size when cloning TPM drive tests: make qm mock accept disk command drive: rescan drives after migrating to different storage src/PVE/API2/Qemu.pm | 16 ++++++++++---- src/PVE/QemuMigrate.pm | 19 +++++++++++++--- src/PVE/QemuServer.pm | 27 ++++++++++++++++++++--- src/test/MigrationTest/QemuMigrateMock.pm | 2 ++ 4 files changed, 54 insertions(+), 10 deletions(-) Summary over all repositories: 4 files changed, 54 insertions(+), 10 deletions(-) -- Generated by murpp 0.12.0