[pve-devel] [PATCH qemu-server] Fix #2062: New timeout switch for guest cmd

Thomas Lamprecht t.lamprecht at proxmox.com
Mon Feb 18 08:58:58 CET 2019


Am 2/11/19 um 2:17 PM schrieb Rhonda D'Vine:
> The guest cmd commands set different timeouts.  Some of those might take
> longer, so for debugging purposes it would be useful to allow overriding
> the internal timeout setting.
> 
> Signed-off-by: Rhonda D'Vine <rhonda at proxmox.com>
> ---
>  PVE/API2/Qemu/Agent.pm | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/PVE/API2/Qemu/Agent.pm b/PVE/API2/Qemu/Agent.pm
> index 839146c..500188d 100644
> --- a/PVE/API2/Qemu/Agent.pm
> +++ b/PVE/API2/Qemu/Agent.pm
> @@ -155,6 +155,12 @@ sub register_command {
>  		description => "The QGA command.",
>  		enum => [ sort keys %$guest_agent_commands ],
>  	    },
> +	    timeout => {
> +		description => "Timeout in seconds. Default is to wait forever.",

as Dominik noted in another reply, the description is wrong, please address that.

> +		type => 'integer',
> +		minimum => 1,
> +		optional => 1,
> +	    }
>  	},
>      };
>  
> @@ -190,7 +196,8 @@ sub register_command {
>  	    agent_available($vmid, $conf);
>  
>  	    my $cmd = $param->{command} // $command;
> -	    my $res = PVE::QemuServer::vm_mon_cmd($vmid, "guest-$cmd");
> +	    my $res = PVE::QemuServer::vm_mon_cmd($vmid, "guest-$cmd",
> +		defined($param->{timeout}) ? (timeout => $param->{timeout}) : () );

this looks not really readable, please move this in a own variable,
no ternary expressions inside method call parameter list.

>  
>  	    return { result => $res };
>  	}});
> 





More information about the pve-devel mailing list