[pve-devel] applied: [PATCH qemu-server 2/2] destroy_vm: use write_config from our Config module to set an "empty" config

Fabian Grünbichler f.gruenbichler at proxmox.com
Fri Oct 18 11:36:48 CEST 2019


On October 18, 2019 11:23 am, Thomas Lamprecht wrote:
> brings us more in line with what we do in pve-container, also it's
> good to not use file_set_contents directly if we have all those nice
> wrapper interface methods to do things in a safe and guaranteed way.
> 
> Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
> ---
>  PVE/QemuServer.pm | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
> index 9fc81ae..d69cd96 100644
> --- a/PVE/QemuServer.pm
> +++ b/PVE/QemuServer.pm
> @@ -2619,8 +2619,6 @@ sub touch_config {
>  sub destroy_vm {
>      my ($storecfg, $vmid, $keep_empty_config, $skiplock) = @_;
>  
> -    my $conffile = PVE::QemuConfig->config_file($vmid);
> -
>      my $conf = PVE::QemuConfig->load_config($vmid);
>  
>      PVE::QemuConfig->check_lock($conf) if !$skiplock;
> @@ -2663,7 +2661,7 @@ sub destroy_vm {
>      });
>  
>      if ($keep_empty_config) {
> -	PVE::Tools::file_set_contents($conffile, "memory: 128\n");
> +	PVE::QemuConfig->write_config($vmid, "memory: 128\n");

shouldn't that be

PVE::QemuConfig->write_config($vmid, { memory => 128 });

?

>      } else {
>  	PVE::QemuConfig->destroy_config($vmid);
>      }
> -- 
> 2.20.1
> 
> 
> _______________________________________________
> pve-devel mailing list
> pve-devel at pve.proxmox.com
> https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
> 
> 




More information about the pve-devel mailing list