[pve-devel] [PATCH qemu-server 1/3] api: clone: always do a full clone of tpmstate volumes

Fabian Grünbichler f.gruenbichler at proxmox.com
Thu Dec 12 09:51:47 CET 2024


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





More information about the pve-devel mailing list