api: clone: always do a full clone of tpmstate volumes

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>
Reviewed-by: Fiona Ebner <f.ebner@proxmox.com>
This commit is contained in:
Fabian Grünbichler 2024-12-12 09:43:44 +01:00
parent 45fedd4729
commit f43a41bec0

View File

@ -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;