diff --git a/PVE/CLI/qm.pm b/PVE/CLI/qm.pm index 2c363735..235f6135 100755 --- a/PVE/CLI/qm.pm +++ b/PVE/CLI/qm.pm @@ -645,7 +645,6 @@ __PACKAGE__->register_method ({ # reload after disks entries have been created $conf = PVE::QemuConfig->load_config($vmid); - PVE::QemuConfig->check_lock($conf); my $firstdisk = PVE::QemuServer::resolve_first_disk($conf); $conf->{bootdisk} = $firstdisk if $firstdisk; PVE::QemuConfig->write_config($vmid, $conf); @@ -654,7 +653,9 @@ __PACKAGE__->register_method ({ my $err = $@; if ($err) { my $skiplock = 1; - eval { PVE::QemuServer::vm_destroy($storecfg, $vmid, $skiplock); }; + # eval for additional safety in error path + eval { PVE::QemuServer::destroy_vm($storecfg, $vmid, undef, $skiplock) }; + warn "Could not destroy VM $vmid: $@" if "$@"; die "import failed - $err"; } }; diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm index a11153ec..bfe6662d 100644 --- a/PVE/QemuServer.pm +++ b/PVE/QemuServer.pm @@ -5937,21 +5937,6 @@ sub vm_sendkey { }); } -sub vm_destroy { - my ($storecfg, $vmid, $skiplock) = @_; - - PVE::QemuConfig->lock_config($vmid, sub { - - my $conf = PVE::QemuConfig->load_config($vmid); - - if (!check_running($vmid)) { - destroy_vm($storecfg, $vmid, undef, $skiplock); - } else { - die "VM $vmid is running - destroy failed\n"; - } - }); -} - # vzdump restore implementaion sub tar_archive_read_firstfile {