public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: "Fabian Grünbichler" <f.gruenbichler@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH qemu-server 1/3] api: clone: always do a full clone of tpmstate volumes
Date: Thu, 12 Dec 2024 09:51:47 +0100	[thread overview]
Message-ID: <20241212085149.138679-2-f.gruenbichler@proxmox.com> (raw)
In-Reply-To: <20241212085149.138679-1-f.gruenbichler@proxmox.com>

since there is no reliable way to check whether a linked clone would end up
being something other than a raw file, and the volumes are tiny anyway.

otherwise on directory storages, the following sequence of events could happen:
- linked clone using raw file as base and qcow2 as overlay
- swtpm_setup interprets qcow2 file as raw
- swtpm_setup fails to find TPM state and overwrites it with a new one
- file is now no longer a linked clone, but a raw file with a qcow2 extension
- move disk and migration fail because of the format mismatch

the downside is that storages that actually support raw linked clones (ZFS,
RBD, LVM-thin) now use more space for fully cloned TPM state volumes...

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
---
if we want to avoid the downside, I guess we could do the linked clone, if that
is not raw, remove it again, and then fallback to full clone?

 PVE/API2/Qemu.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm
index 9d1127c0..c00f60d7 100644
--- a/PVE/API2/Qemu.pm
+++ b/PVE/API2/Qemu.pm
@@ -3912,7 +3912,7 @@ __PACKAGE__->register_method({
 			my $msg = "clone feature is not supported for";
 			$msg .= " a snapshot of" if $snapname;
 			$msg .= " '$volid' ($opt)";
-			if ($full || PVE::QemuServer::drive_is_cloudinit($drive)) {
+			if ($full || PVE::QemuServer::drive_is_cloudinit($drive) || $opt eq 'tpmstate0') {
 			    die "Full $msg\n"
 				if !PVE::Storage::volume_has_feature($storecfg, 'copy', $volid, $snapname, $running);
 			    $fullclone->{$opt} = 1;
-- 
2.39.5



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

  reply	other threads:[~2024-12-12  8:51 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-12  8:51 [pve-devel] [PATCH qemu-server 0/3] fix tpmstate format issues Fabian Grünbichler
2024-12-12  8:51 ` Fabian Grünbichler [this message]
2024-12-12  9:11   ` [pve-devel] [PATCH qemu-server 1/3] api: clone: always do a full clone of tpmstate volumes Fiona Ebner
2024-12-12  8:51 ` [pve-devel] [PATCH qemu-server 2/3] swtpm: check that format of tpmstate volume is raw Fabian Grünbichler
2024-12-12  9:11   ` Fiona Ebner
2024-12-12  9:13     ` Fiona Ebner
2024-12-12  8:51 ` [pve-devel] [PATCH qemu-server 3/3] swtpm: drop unused $volname variable Fabian Grünbichler
2024-12-12  9:11   ` Fiona Ebner
2024-12-12  9:48 ` [pve-devel] applied-series: [PATCH qemu-server 0/3] fix tpmstate format issues Fabian Grünbichler

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=20241212085149.138679-2-f.gruenbichler@proxmox.com \
    --to=f.gruenbichler@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