[pve-devel] applied: [PATCH qemu-server 2/2] api: vm clone: unlink zombie target config at end of error cleanup

Thomas Lamprecht t.lamprecht at proxmox.com
Wed Jan 15 08:28:25 CET 2020


This is the guarantee that this call operates on it's created config.
A VMID cannot be reused afterall. So only remove the guarantee at the
last step, just before throwing up the error message about the clone
failure.

Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
---
 PVE/API2/Qemu.pm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm
index f5e757a..0d543ff 100644
--- a/PVE/API2/Qemu.pm
+++ b/PVE/API2/Qemu.pm
@@ -2931,8 +2931,6 @@ __PACKAGE__->register_method({
 		    PVE::AccessControl::add_vm_to_pool($newid, $pool) if $pool;
 		};
 		if (my $err = $@) {
-		    unlink $conffile;
-
 		    eval { PVE::QemuServer::qemu_blockjobs_cancel($vmid, $jobs) };
 		    sleep 1; # some storage like rbd need to wait before release volume - really?
 
@@ -2943,6 +2941,8 @@ __PACKAGE__->register_method({
 
 		    PVE::Firewall::remove_vmfw_conf($newid);
 
+		    unlink $conffile; # avoid races -> last thing before die
+
 		    die "clone failed: $err";
 		}
 
-- 
2.20.1





More information about the pve-devel mailing list