public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Thomas Ellmenreich <t.ellmenreich@proxmox.com>
To: pve-devel@lists.proxmox.com
Cc: Thomas Ellmenreich <t.ellmenreich@proxmox.com>
Subject: [PATCH qemu-server 0/3] drive: account for differing TPM sizes
Date: Tue, 27 Oct 2026 11:17:20 +0100	[thread overview]
Message-ID: <20261027101723.144576-1-t.ellmenreich@proxmox.com> (raw)

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




             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 Thomas Ellmenreich [this message]
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 ` [PATCH qemu-server 3/3] clone disk: read actual size when cloning TPM drive Thomas Ellmenreich

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-1-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 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