From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id C2B9F8610 for ; Fri, 3 Mar 2023 19:50:51 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 9C6801ABDE for ; Fri, 3 Mar 2023 19:50:21 +0100 (CET) Received: from mail.ma2t.com (mail02.ma2t.com [185.154.152.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS for ; Fri, 3 Mar 2023 19:50:20 +0100 (CET) Authentication-Results: mail.ma2t.com; auth=pass (plain) From: Matthieu Malvache To: pve-devel@lists.proxmox.com Date: Fri, 3 Mar 2023 19:48:21 +0100 Message-Id: <20230303184820.1461-1-matthieu@ma2t.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received: from localhost (Unknown [127.0.0.1]) by mail.ma2t.com (Haraka) with ESMTPSA id D831D04D-5CBB-416D-9656-8FD5C82F7FFC.1 envelope-from (authenticated bits=0) (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Fri, 03 Mar 2023 18:50:19 +0000 DKIM-Signature: v=1; a=rsa-sha256; bh=WJKB7yalAzlAnfINpbOz0YOU9F00nrsxt20LZs8rVbY=; c=relaxed/simple; d=ma2t.com; h=from:subject:date:message-id:to:cc:mime-version; s=s20200418207; b=AGWFtDejM7oCOYhPjVml+ZM12KF3mgfqyFgy/xrxJb83gow9q8w83M4HyQzawqFML/lEmBoNx99R/n4b8XJQ6uScQpMuGa1Z0eVYwGYoaoRPIqQ4Gt6cuaNMWXzh1x1qHzBhicciz7EQ0EejTDnKgib5EltLG2UD6Ylu3nkxkWs= X-SPAM-LEVEL: Spam detection results: 0 AWL 0.487 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain MSGID_FROM_MTA_HEADER 0.001 Message-Id was added by a relay SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pve-devel] [PATCH v2 qemu-server 1/1] vnc: Allow custom timeout value in vncproxy method X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Mar 2023 18:50:51 -0000 This commit adds support for a custom timeout value in the 'vncproxy' method of the Proxmox PVE REST API. The timeout can now be specified using the 'timeout' parameter and defaults to 10 seconds if not set. This will help users to better tailor the timeout based on factors such as network latency. The code change was implemented in the 'vncproxy' method of the 'PVE::API2::Qemu' package. The 'timeout' parameter was added to the 'parameters' section of the method and was used to set the timeout duration in the 'realcmd' sub. Signed-off-by: Matthieu Malvache --- PVE/API2/Qemu.pm | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm index 587bb22..bb20273 100644 --- a/PVE/API2/Qemu.pm +++ b/PVE/API2/Qemu.pm @@ -2164,6 +2164,13 @@ __PACKAGE__->register_method({ default => 0, description => "Generates a random password to be used as ticket instead of the API ticket.", }, + timeout => { + optional => 1, + type => 'integer', + minimum => 5, + default => 10, + description => "Timeout in seconds for the vnc proxy connection.", + }, }, }, returns => { @@ -2192,6 +2199,7 @@ __PACKAGE__->register_method({ my $vmid = $param->{vmid}; my $node = $param->{node}; my $websocket = $param->{websocket}; + my $timeout = $param->{timeout} // 10; my $conf = PVE::QemuConfig->load_config($vmid, $node); # check if VM exists @@ -2226,8 +2234,6 @@ __PACKAGE__->register_method({ my $port = PVE::Tools::next_vnc_port($family); - my $timeout = 10; - my $realcmd = sub { my $upid = shift; -- 2.30.2