From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <matthieu@vs6975.lil01fr.vsys.cloud>
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))
 (No client certificate requested)
 by lists.proxmox.com (Postfix) with ESMTPS id 275FE82FA
 for <pve-devel@lists.proxmox.com>; Fri,  3 Mar 2023 12:23:17 +0100 (CET)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
 by firstgate.proxmox.com (Proxmox) with ESMTP id 046BFD6B1
 for <pve-devel@lists.proxmox.com>; Fri,  3 Mar 2023 12:22:47 +0100 (CET)
Received: from vs6975.lil01fr.vsys.cloud (vs6975.lil01fr.vsys.cloud
 [185.154.154.179])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits))
 (No client certificate requested)
 by firstgate.proxmox.com (Proxmox) with ESMTPS
 for <pve-devel@lists.proxmox.com>; Fri,  3 Mar 2023 12:22:45 +0100 (CET)
Received: by vs6975.lil01fr.vsys.cloud (Postfix, from userid 1000)
 id 4E25F2075E; Fri,  3 Mar 2023 12:16:24 +0100 (CET)
From: Matthieu Malvache <matthieu@ma2t.com>
To: pve-devel@lists.proxmox.com
Date: Fri,  3 Mar 2023 12:16:04 +0100
Message-Id: <20230303111604.2043-2-matthieu@ma2t.com>
X-Mailer: git-send-email 2.30.2
In-Reply-To: <20230303111604.2043-1-matthieu@ma2t.com>
References: <20230303111604.2043-1-matthieu@ma2t.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-SPAM-LEVEL: Spam detection results:  0
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 HEADER_FROM_DIFFERENT_DOMAINS 0.249 From and EnvelopeFrom 2nd level mail
 domains are different
 KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment
 KAM_LAZY_DOMAIN_SECURITY 1 Sending domain does not have any anti-forgery
 methods
 SPF_HELO_NONE           0.001 SPF: HELO does not publish an SPF Record
 SPF_NONE                0.001 SPF: sender does not publish an SPF Record
Subject: [pve-devel] [PATCH container 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 <pve-devel.lists.proxmox.com>
List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=unsubscribe>
List-Archive: <http://lists.proxmox.com/pipermail/pve-devel/>
List-Post: <mailto:pve-devel@lists.proxmox.com>
List-Help: <mailto:pve-devel-request@lists.proxmox.com?subject=help>
List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=subscribe>
X-List-Received-Date: Fri, 03 Mar 2023 11:23:17 -0000

This commit adds support for a custom timeout value in the 'vncproxy'
method of the Proxmox PVE REST API. The timeout can be specified using
the 'timeout' parameter and defaults to 10 seconds if not set.

Signed-off-by: Matthieu Malvache <matthieu@ma2t.com>
---
 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..4ca5842 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};
 
 	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