[pve-devel] applied: [PATCH qemu-server] restore_tar_archive: Add skiplock to destroy_vm

Thomas Lamprecht t.lamprecht at proxmox.com
Mon Nov 11 11:29:42 CET 2019


On 11/7/19 1:00 PM, Dominic Jäger wrote:
> When calling qmrestore a config file is created and locked with a lock
> property. The following destroy_vm has been impossible as skiplock has not
> been set.
> 

applied, reduced the comment length slightly in a followup.
Also made some general cleanup-followups, but they had nothing todo with
your fix itself, just FYI. Thanks a lot!

> Signed-off-by: Dominic Jäger <d.jaeger at proxmox.com>
> ---
>  PVE/QemuServer.pm | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
> index bfe6662..345ffab 100644
> --- a/PVE/QemuServer.pm
> +++ b/PVE/QemuServer.pm
> @@ -6604,9 +6604,14 @@ sub restore_tar_archive {
>  
>      my $storecfg = PVE::Storage::config();
>  
> -    # destroy existing data - keep empty config
> +    # Restoring a backup can replace an existing VM. In this case, we need to
> +    # remove existing data such as disks as they would pile up as unused disks
> +    # in the new VM otherwise.
> +    # keep_empty_config=1 to prevent races until overwriting it with the
> +    # restored config.
> +    # skiplock=1 because qmrestore has set the lock itself.
>      my $vmcfgfn = PVE::QemuConfig->config_file($vmid);
> -    destroy_vm($storecfg, $vmid, 1) if -f $vmcfgfn;
> +    destroy_vm($storecfg, $vmid, 1, 1) if -f $vmcfgfn;
>  
>      my $tocmd = "/usr/lib/qemu-server/qmextract";
>  
> 






More information about the pve-devel mailing list