]> git.proxmox.com Git - qemu-server.git/commitdiff
api: clone vm: check against cloning running TPM state early
authorFabian Ebner <f.ebner@proxmox.com>
Thu, 17 Mar 2022 11:31:01 +0000 (12:31 +0100)
committerFabian Grünbichler <f.gruenbichler@proxmox.com>
Fri, 1 Apr 2022 08:24:59 +0000 (10:24 +0200)
Drive keys are sorted when cloning and 'tpmstate0' comes late, so it
was likely that potentially large disks were already copied just to be
removed again, because of the TPM state restriction at the end.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
PVE/API2/Qemu.pm

index 1dd0cf28cb852c686a872b9c4f3afcda37165ff4..91fb4dfd5804b17e8f36b9e7a2cfcc59f8abbe93 100644 (file)
@@ -3151,6 +3151,9 @@ __PACKAGE__->register_method({
                # no need to copy unused images, because VMID(owner) changes anyways
                next if $opt =~ m/^unused\d+$/;
 
+               die "cannot clone TPM state while VM is running\n"
+                   if $full && $running && !$snapname && $opt eq 'tpmstate0';
+
                # always change MAC! address
                if ($opt =~ m/^net(\d+)$/) {
                    my $net = PVE::QemuServer::parse_net($value);