[pve-devel] [PATCH qemu-server 5/7] Remove useless eval

Thomas Lamprecht t.lamprecht at proxmox.com
Fri Oct 25 18:17:29 CEST 2019


On 10/25/19 11:24 AM, Dominic Jäger wrote:
> The destroy_vm in the eval could only die if the VM were a template.
> This is not possible here.
> 
> Signed-off-by: Dominic Jäger <d.jaeger at proxmox.com>
> ---
>  PVE/CLI/qm.pm | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/PVE/CLI/qm.pm b/PVE/CLI/qm.pm
> index a378d3d..a16033c 100755
> --- a/PVE/CLI/qm.pm
> +++ b/PVE/CLI/qm.pm
> @@ -650,7 +650,7 @@ __PACKAGE__->register_method ({
>  	    };
>  	    my $err = $@;
>  	    if ($err) {
> -		eval { PVE::QemuServer::destroy_vm($storecfg, $vmid, undef, 1); };
> +		PVE::QemuServer::destroy_vm($storecfg, $vmid, undef, 1);
>  		die "import failed - $err";
>  	    }
>  	});
> 

it still useful to have this in error paths, IMO, better safe than sorry (and
overwriting the actual error, if it dies). Adding a
    warn "$@" if "$@";
below the eval could be more useful...





More information about the pve-devel mailing list