From nobody Fri May 3 05:49:15 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1507674229685231.0551907474803; Tue, 10 Oct 2017 15:23:49 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3799E7EA99; Tue, 10 Oct 2017 22:23:48 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E98C868886; Tue, 10 Oct 2017 22:23:47 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 023F24EE50; Tue, 10 Oct 2017 22:23:47 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v9ALq9gb021598 for ; Tue, 10 Oct 2017 17:52:09 -0400 Received: by smtp.corp.redhat.com (Postfix) id EFB3251893; Tue, 10 Oct 2017 21:52:09 +0000 (UTC) Received: from mx1.redhat.com (ext-mx03.extmail.prod.ext.phx2.redhat.com [10.5.110.27]) by smtp.corp.redhat.com (Postfix) with ESMTPS id EB03D68881 for ; Tue, 10 Oct 2017 21:52:06 +0000 (UTC) Received: from mail-qt0-f182.google.com (mail-qt0-f182.google.com [209.85.216.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 11BDE7F755 for ; Tue, 10 Oct 2017 21:52:06 +0000 (UTC) Received: by mail-qt0-f182.google.com with SMTP id z19so10279323qtg.11 for ; Tue, 10 Oct 2017 14:52:06 -0700 (PDT) Received: from dawid-fedora.datto.lan ([47.19.105.250]) by smtp.gmail.com with ESMTPSA id 4sm6879379qke.50.2017.10.10.14.52.04 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 10 Oct 2017 14:52:04 -0700 (PDT) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 3799E7EA99 Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=fail (p=none dis=none) header.from=datto.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 3799E7EA99 Authentication-Results: mx1.redhat.com; dkim=fail reason="signature verification failed" (2048-bit key) header.d=datto-com.20150623.gappssmtp.com header.i=@datto-com.20150623.gappssmtp.com header.b="Xq0KQGr9" DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 11BDE7F755 Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=pass (p=none dis=none) header.from=datto.com Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=dzamirski@datto.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 11BDE7F755 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=datto-com.20150623.gappssmtp.com; s=20150623; h=from:to:subject:date:message-id:in-reply-to:references; bh=bYuUt9kCBp/m+s+HjaTAcZUJOKBbVnbkiR1E8l0dQIs=; b=Xq0KQGr962HMSKgqD0k+3ndWtk0S4X03yYMBAUqCwh9kzQCEDPY/enXT0U1MG5n54q EfzqagaWEb1KiEk0qHCA07W3y5nVR/PUIBjvd/iXc/jq44UnO6OTBbMUttMttR8zi8HS jzu8KZ5CNud+pRceMeUvevt+sBxQ0F9hWYsphayVUBDwigr7Y197tYw7nVFL4u1aCbJ3 UpzwVPBd6KuBrizsDMkkaO5id+WI4LONWT+QI/nuGPKkzb5UOMfJxfBre8tfv7DSqvTt xPiy2MUPrdoM1XNkfjqFH2SAQI2VvljMImKijPhp+OTPBRno8+U96itxeMt9Z3S/Q+5W qgSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=bYuUt9kCBp/m+s+HjaTAcZUJOKBbVnbkiR1E8l0dQIs=; b=rGd3SJyMz5u1Tjr/amlPgkqwyPcRmJof8H6uXq72iiM39O+2pJv0UgGam8tzhVhxfa PtRDBYWhblfnEqM1+NtNd5MStPYOClZLam2anXed1iAlcl/7EcnW7ExENNNyJgcLXHRp 9xDzwA1wTyMeqCb8Jo+3/U15JuahhiUfPVt1vrbKL/ljzEzKAUVndt1sZgji8fosiQsj gypk59BD0HMzxRyvQB0yToQ/S5zjjgJuZJTUFKZWSMxriz7waWPAvwmJmoZWyrgSPlvP HJldrHAks4uBQ1nQkyFJJwivxuWa4+D+Y7ZgLoBcEV92UYhUNxYUHww+q6x9xDR0X9XA rEIA== X-Gm-Message-State: AMCzsaVw/WdYrc5IJKyiG3kE0CdmoEa7Mwjzyzcsn9f8yeg/RKQFBRST d7vKMiYF8LeQCGA2ocwZu0ZA7ZOjP8A= X-Google-Smtp-Source: AOwi7QDHuCLKat2Pp2gEmb6RcWDzLT8LFXeGtpGZ21EOsiPiJu3pMJLq8YR9IKqjW4JHCpFLLpi9FQ== X-Received: by 10.55.112.65 with SMTP id l62mr15462774qkc.357.1507672325071; Tue, 10 Oct 2017 14:52:05 -0700 (PDT) From: Dawid Zamirski X-Google-Original-From: Dawid Zamirski To: libvir-list@redhat.com Date: Tue, 10 Oct 2017 17:52:00 -0400 Message-Id: <20171010215202.11415-2-dzrudy@gmail.com> In-Reply-To: <20171010215202.11415-1-dzrudy@gmail.com> References: <20171010215202.11415-1-dzrudy@gmail.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Tue, 10 Oct 2017 21:52:06 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Tue, 10 Oct 2017 21:52:06 +0000 (UTC) for IP:'209.85.216.182' DOMAIN:'mail-qt0-f182.google.com' HELO:'mail-qt0-f182.google.com' FROM:'dzamirski@datto.com' RCPT:'' X-RedHat-Spam-Score: -0.221 (DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, RCVD_IN_SORBS_SPAM, SPF_PASS) 209.85.216.182 mail-qt0-f182.google.com 209.85.216.182 mail-qt0-f182.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.27 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 1/3] vbox: Make autoport set RDP port range. X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Tue, 10 Oct 2017 22:23:48 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Originally autoport in vbox driver was setting the port to default value (3389) which caused mutiple VM instances use the same port. Since libvirt XML does not allow to set port ranges, this patch changes the "autoport" behavior to set VBox's "TCP/Ports" property to an arbitraty port range (3389-3689) to avoid that issue. --- src/vbox/vbox_tmpl.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c index dffeabde0..8e47d90d6 100644 --- a/src/vbox/vbox_tmpl.c +++ b/src/vbox/vbox_tmpl.c @@ -152,6 +152,9 @@ if (strUtf16) {\ =20 #define VBOX_IID_INITIALIZER { NULL, true } =20 +/* default RDP port range to use for auto-port setting */ +#define VBOX_RDP_AUTOPORT_RANGE "3389-3689" + static void _vboxIIDUnalloc(vboxDriverPtr data, vboxIID *iid) { @@ -1601,20 +1604,27 @@ _vrdeServerGetPorts(vboxDriverPtr data ATTRIBUTE_UN= USED, } =20 static nsresult -_vrdeServerSetPorts(vboxDriverPtr data ATTRIBUTE_UNUSED, - IVRDEServer *VRDEServer, virDomainGraphicsDefPtr graph= ics) +_vrdeServerSetPorts(vboxDriverPtr data, IVRDEServer *VRDEServer, + virDomainGraphicsDefPtr graphics) { nsresult rc =3D 0; PRUnichar *VRDEPortsKey =3D NULL; PRUnichar *VRDEPortsValue =3D NULL; =20 VBOX_UTF8_TO_UTF16("TCP/Ports", &VRDEPortsKey); - VRDEPortsValue =3D PRUnicharFromInt(data->pFuncs, graphics->data.rdp.p= ort); + + if (graphics->data.rdp.port) + VRDEPortsValue =3D PRUnicharFromInt(data->pFuncs, + graphics->data.rdp.port); + else if (graphics->data.rdp.autoport) + VBOX_UTF8_TO_UTF16(VBOX_RDP_AUTOPORT_RANGE, &VRDEPortsValue); + rc =3D VRDEServer->vtbl->SetVRDEProperty(VRDEServer, VRDEPortsKey, VRDEPortsValue); VBOX_UTF16_FREE(VRDEPortsKey); VBOX_UTF16_FREE(VRDEPortsValue); =20 + return rc; } =20 --=20 2.14.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 05:49:15 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1507673720361576.1298049910397; Tue, 10 Oct 2017 15:15:20 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id AEA73356F6; Tue, 10 Oct 2017 22:15:18 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2E52760FA0; Tue, 10 Oct 2017 22:15:18 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 2D10218355D8; Tue, 10 Oct 2017 22:15:17 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v9ALq9dp021593 for ; Tue, 10 Oct 2017 17:52:09 -0400 Received: by smtp.corp.redhat.com (Postfix) id 7F6BD779DB; Tue, 10 Oct 2017 21:52:09 +0000 (UTC) Received: from mx1.redhat.com (ext-mx09.extmail.prod.ext.phx2.redhat.com [10.5.110.38]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 785C177714 for ; Tue, 10 Oct 2017 21:52:07 +0000 (UTC) Received: from mail-qt0-f174.google.com (mail-qt0-f174.google.com [209.85.216.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 801384ACBA for ; Tue, 10 Oct 2017 21:52:06 +0000 (UTC) Received: by mail-qt0-f174.google.com with SMTP id 34so38711154qtb.13 for ; Tue, 10 Oct 2017 14:52:06 -0700 (PDT) Received: from dawid-fedora.datto.lan ([47.19.105.250]) by smtp.gmail.com with ESMTPSA id 4sm6879379qke.50.2017.10.10.14.52.05 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 10 Oct 2017 14:52:05 -0700 (PDT) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com AEA73356F6 Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=fail (p=none dis=none) header.from=datto.com Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com AEA73356F6 Authentication-Results: mx1.redhat.com; dkim=fail reason="signature verification failed" (2048-bit key) header.d=datto-com.20150623.gappssmtp.com header.i=@datto-com.20150623.gappssmtp.com header.b="R2Yb6qb4" DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 801384ACBA Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; dmarc=pass (p=none dis=none) header.from=datto.com Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=dzamirski@datto.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 801384ACBA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=datto-com.20150623.gappssmtp.com; s=20150623; h=from:to:subject:date:message-id:in-reply-to:references; bh=VTtPClaNLh+nZQyUgdpGf3S5r2ojqmprcxFG6Wmdxgs=; b=R2Yb6qb42xU+yPTcSpPVCXKfBTbPoiEKnCttUIrHB1uwvrfzx7PFiPgBoxYmQkG1Bo 8ZHVk0Tm5Si89EPGMcRMz5/EC7AX2JgHKgmXvFkaEHq9bfppKv3vWmX/7Ik8IrYp8Dev SxzCeo4bdl8hAhC9k/4BngAUZoVsdfqc8mP9a68KmgWHG2IrCjxiXyTUuf0hpfpZZS3j llZAHndtQ5kdCni7NYaHGxaDeE/Jd+Qlv7hiawYhqQTkVQT6EcVZDaMd0lUxqhdq5hdq wK86kjimNRx6bGJ1ei2NcOKcIXt7rYXGLxVvZ8W/5NT9vzVwqEPyoLPke+ah14a9KmLk Y6lg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=VTtPClaNLh+nZQyUgdpGf3S5r2ojqmprcxFG6Wmdxgs=; b=a2SjCZqB0MWhjH1BYEWYiCy8qqCf112xe2/ECT650DtaLei4uFe3Ak6E+wiecgxb+F WDx5yVtDMlGUKlYto8zA7vGjKuy7MnGy+/76quoPanwWby7F3G0axFi0MLBQNjm0lu93 gXiQrcMiX8fvjLAch86oqctb09zvKuFkNJHwXkxNfyB+l+wCpWODnvcnLV+zVAYrrHlf BxHuMTNBhXu/XKTwFCHh7xMbMPg8wy5zdUmHF5z5KGOGMOOHbWtFEA20ZIhWm807MWUr UMnJ7nRUMCmNcNdWRW+BMpMyNPHqibDy05YtrJrijNOZO2ryH8u/9knDiq1/lGP9t9Hd 0fOQ== X-Gm-Message-State: AMCzsaVeOvSQ1IMJiLMhjmGlMHOIhRtFSx8aDo0L1ljTOKm4vjKZO293 Ekcznt9H6N33Gbgo5Y6wc7vabW4R6x8= X-Google-Smtp-Source: AOwi7QD1CfYhlPQT2Jfwx8X3H0sVpjup4IF1v7SmQPMWRrLFlbVFSk7A6dMCMmdzoYI3l6s1u+v67w== X-Received: by 10.55.101.81 with SMTP id z78mr16825115qkb.161.1507672325526; Tue, 10 Oct 2017 14:52:05 -0700 (PDT) From: Dawid Zamirski X-Google-Original-From: Dawid Zamirski To: libvir-list@redhat.com Date: Tue, 10 Oct 2017 17:52:01 -0400 Message-Id: <20171010215202.11415-3-dzrudy@gmail.com> In-Reply-To: <20171010215202.11415-1-dzrudy@gmail.com> References: <20171010215202.11415-1-dzrudy@gmail.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Tue, 10 Oct 2017 21:52:06 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Tue, 10 Oct 2017 21:52:06 +0000 (UTC) for IP:'209.85.216.174' DOMAIN:'mail-qt0-f174.google.com' HELO:'mail-qt0-f174.google.com' FROM:'dzamirski@datto.com' RCPT:'' X-RedHat-Spam-Score: 0.469 (DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, RCVD_IN_SORBS_SPAM, SPF_PASS) 209.85.216.174 mail-qt0-f174.google.com 209.85.216.174 mail-qt0-f174.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.38 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 2/3] vbox: Read runtime RDP port and handle autoport. X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Tue, 10 Oct 2017 22:15:19 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" VirutalBox has a IVRDEServerInfo sturcture available that gives the effective runtime port that the VM is using when it's running. This is useful when the "TCP/Ports" VBox property was set to port range (e.g. via autoport =3D "yes" or via VBoxManage) in which case it would be impossible to get the "active" port otherwise. --- src/vbox/vbox_common.c | 3 +- src/vbox/vbox_tmpl.c | 135 +++++++++++++++++++++++++++++---------= ---- src/vbox/vbox_uniformed_api.h | 2 +- 3 files changed, 97 insertions(+), 43 deletions(-) diff --git a/src/vbox/vbox_common.c b/src/vbox/vbox_common.c index 92ee37164..d542f2b76 100644 --- a/src/vbox/vbox_common.c +++ b/src/vbox/vbox_common.c @@ -3326,7 +3326,8 @@ vboxDumpDisplay(virDomainDefPtr def, vboxDriverPtr da= ta, IMachine *machine) if (VIR_ALLOC(graphics) < 0) goto cleanup; =20 - gVBoxAPI.UIVRDEServer.GetPorts(data, VRDEServer, graphics); + gVBoxAPI.UIVRDEServer.GetPorts(data, VRDEServer, machine, graphics= ); + gVBoxAPI.UISession.Close(data->vboxSession); =20 graphics->type =3D VIR_DOMAIN_GRAPHICS_TYPE_RDP; =20 diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c index 8e47d90d6..ff69cf39c 100644 --- a/src/vbox/vbox_tmpl.c +++ b/src/vbox/vbox_tmpl.c @@ -144,12 +144,6 @@ if (strUtf16) {\ (unsigned)(iid)->m3[7]);\ }\ =20 -#define VBOX_SESSION_OPEN(/* unused */ iid_value, /* in */ machine) \ - machine->vtbl->LockMachine(machine, data->vboxSession, LockType_Write) - -#define VBOX_SESSION_CLOSE() \ - data->vboxSession->vtbl->UnlockMachine(data->vboxSession) - #define VBOX_IID_INITIALIZER { NULL, true } =20 /* default RDP port range to use for auto-port setting */ @@ -227,29 +221,6 @@ _vboxIIDFromArrayItem(vboxDriverPtr data, vboxIID *iid, _vboxIIDFromArrayItem(data, iid, array, idx) #define DEBUGIID(msg, strUtf16) DEBUGPRUnichar(msg, strUtf16) =20 -/** - * Converts Utf-16 string to int - */ -static int PRUnicharToInt(PCVBOXXPCOM pFuncs, PRUnichar *strUtf16) -{ - char *strUtf8 =3D NULL; - int ret =3D 0; - - if (!strUtf16) - return -1; - - pFuncs->pfnUtf16ToUtf8(strUtf16, &strUtf8); - if (!strUtf8) - return -1; - - if (virStrToLong_i(strUtf8, NULL, 10, &ret) < 0) - ret =3D -1; - - pFuncs->pfnUtf8Free(strUtf8); - - return ret; -} - /** * Converts int to Utf-16 string */ @@ -286,6 +257,56 @@ static virDomainState _vboxConvertState(PRUint32 state) } } =20 +static int +vboxGetActiveVRDEServerPort(ISession *session, IMachine *machine) +{ + nsresult rc; + PRInt32 port =3D -1; + IVRDEServerInfo *vrdeInfo =3D NULL; + IConsole *console =3D NULL; + int locked =3D 0; + + rc =3D machine->vtbl->LockMachine(machine, session, LockType_Shared); + if (NS_FAILED(rc)) { + VIR_WARN("Could not obtain shared lock on VBox VM, rc=3D%08x", rc); + goto cleanup; + } else { + locked =3D 1; + } + + rc =3D session->vtbl->GetConsole(session, &console); + if (NS_FAILED(rc)) { + VIR_WARN("Could not get VBox session console, rc=3D%08x", rc); + goto cleanup; + } + + /* it may be null if VM is not running */ + if (!console) + goto cleanup; + + rc =3D console->vtbl->GetVRDEServerInfo(console, &vrdeInfo); + + if (NS_FAILED(rc) || !vrdeInfo) { + VIR_WARN("Could not get VBox VM VRDEServerInfo, rc=3D%08x", rc); + goto cleanup; + } + + rc =3D vrdeInfo->vtbl->GetPort(vrdeInfo, &port); + + if (NS_FAILED(rc)) { + VIR_WARN("Could not read port from VRDEServerInfo, rc=3D%08x", rc); + goto cleanup; + } + + cleanup: + VBOX_RELEASE(console); + VBOX_RELEASE(vrdeInfo); + if (locked) + session->vtbl->UnlockMachine(session); + + return port; +} + static int _vboxDomainSnapshotRestore(virDomainPtr dom, IMachine *machine, @@ -326,7 +347,7 @@ _vboxDomainSnapshotRestore(virDomainPtr dom, goto cleanup; } =20 - rc =3D VBOX_SESSION_OPEN(domiid.value, machine); + rc =3D machine->vtbl->LockMachine(machine, data->vboxSession, LockType= _Write); #if VBOX_API_VERSION < 5000000 if (NS_SUCCEEDED(rc)) rc =3D data->vboxSession->vtbl->GetConsole(data->vboxSession, &con= sole); @@ -371,7 +392,7 @@ _vboxDomainSnapshotRestore(virDomainPtr dom, #if VBOX_API_VERSION < 5000000 VBOX_RELEASE(console); #endif /*VBOX_API_VERSION < 5000000*/ - VBOX_SESSION_CLOSE(); + data->vboxSession->vtbl->UnlockMachine(data->vboxSession); vboxIIDUnalloc(&domiid); return ret; } @@ -1582,24 +1603,56 @@ _vrdeServerSetEnabled(IVRDEServer *VRDEServer, PRBo= ol enabled) } =20 static nsresult -_vrdeServerGetPorts(vboxDriverPtr data ATTRIBUTE_UNUSED, - IVRDEServer *VRDEServer, virDomainGraphicsDefPtr graph= ics) +_vrdeServerGetPorts(vboxDriverPtr data, IVRDEServer *VRDEServer, + IMachine *machine, virDomainGraphicsDefPtr graphics) { nsresult rc; PRUnichar *VRDEPortsKey =3D NULL; PRUnichar *VRDEPortsValue =3D NULL; + PRInt32 port =3D -1; + ssize_t nmatches =3D 0; + char **matches =3D NULL; + char *portUtf8 =3D NULL; =20 + /* get active (effective) port, if available */ + port =3D vboxGetActiveVRDEServerPort(data->vboxSession, machine); + + /* get the port (or port range) set in VM properties, this info will + * be used to determine whether to set autoport flag + */ VBOX_UTF8_TO_UTF16("TCP/Ports", &VRDEPortsKey); - rc =3D VRDEServer->vtbl->GetVRDEProperty(VRDEServer, VRDEPortsKey, &VR= DEPortsValue); - VBOX_UTF16_FREE(VRDEPortsKey); - if (VRDEPortsValue) { - /* even if vbox supports mutilpe ports, single port for now here */ - graphics->data.rdp.port =3D PRUnicharToInt(data->pFuncs, VRDEPorts= Value); - VBOX_UTF16_FREE(VRDEPortsValue); - } else { - graphics->data.rdp.autoport =3D true; + rc =3D VRDEServer->vtbl->GetVRDEProperty(VRDEServer, VRDEPortsKey, + &VRDEPortsValue); + + if (NS_FAILED(rc)) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Failed to read RDP port value, rc=3D%08x"), + (unsigned) rc); + goto cleanup; } =20 + graphics->data.rdp.port =3D port; + + VBOX_UTF16_TO_UTF8(VRDEPortsValue, &portUtf8); + + if (portUtf8) { + nmatches =3D virStringSearch(portUtf8, "(^[[:digit:]]+$)", 1, &mat= ches); + + /* vbox port-range -> autoport */ + if (nmatches !=3D 1) { + graphics->data.rdp.autoport =3D true; + } else if (port < 0 && virStrToLong_i(portUtf8, NULL, 10, &port) = =3D=3D 0) { + /* no active port available but a single port was set in prope= rties */ + graphics->data.rdp.port =3D port; + } + } + + cleanup: + virStringListFree(matches); + VBOX_UTF8_FREE(portUtf8); + VBOX_UTF16_FREE(VRDEPortsValue); + VBOX_UTF16_FREE(VRDEPortsKey); + return rc; } =20 diff --git a/src/vbox/vbox_uniformed_api.h b/src/vbox/vbox_uniformed_api.h index 2ccaf43e8..8cf27789b 100644 --- a/src/vbox/vbox_uniformed_api.h +++ b/src/vbox/vbox_uniformed_api.h @@ -341,7 +341,7 @@ typedef struct { nsresult (*GetEnabled)(IVRDEServer *VRDEServer, PRBool *enabled); nsresult (*SetEnabled)(IVRDEServer *VRDEServer, PRBool enabled); nsresult (*GetPorts)(vboxDriverPtr driver, IVRDEServer *VRDEServer, - virDomainGraphicsDefPtr graphics); + IMachine *machine, virDomainGraphicsDefPtr graphi= cs); nsresult (*SetPorts)(vboxDriverPtr driver, IVRDEServer *VRDEServer, virDomainGraphicsDefPtr graphics); nsresult (*GetReuseSingleConnection)(IVRDEServer *VRDEServer, PRBool *= enabled); --=20 2.14.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 05:49:15 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1507673743294646.9625084822658; Tue, 10 Oct 2017 15:15:43 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BB25E356F8; Tue, 10 Oct 2017 22:15:41 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9C139679E8; Tue, 10 Oct 2017 22:15:41 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 6887F410B2; Tue, 10 Oct 2017 22:15:41 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v9ALqAGB021608 for ; Tue, 10 Oct 2017 17:52:10 -0400 Received: by smtp.corp.redhat.com (Postfix) id 76B0051893; Tue, 10 Oct 2017 21:52:10 +0000 (UTC) Received: from mx1.redhat.com (ext-mx07.extmail.prod.ext.phx2.redhat.com [10.5.110.31]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 705885E1A4 for ; Tue, 10 Oct 2017 21:52:10 +0000 (UTC) Received: from mail-qt0-f178.google.com (mail-qt0-f178.google.com [209.85.216.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D1AF0C049E31 for ; Tue, 10 Oct 2017 21:52:06 +0000 (UTC) Received: by mail-qt0-f178.google.com with SMTP id f8so20781431qta.5 for ; Tue, 10 Oct 2017 14:52:06 -0700 (PDT) Received: from dawid-fedora.datto.lan ([47.19.105.250]) by smtp.gmail.com with ESMTPSA id 4sm6879379qke.50.2017.10.10.14.52.05 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 10 Oct 2017 14:52:05 -0700 (PDT) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com BB25E356F8 Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=fail (p=none dis=none) header.from=datto.com Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com BB25E356F8 Authentication-Results: mx1.redhat.com; dkim=fail reason="signature verification failed" (2048-bit key) header.d=datto-com.20150623.gappssmtp.com header.i=@datto-com.20150623.gappssmtp.com header.b="g9cmDGwd" DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com D1AF0C049E31 Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=pass (p=none dis=none) header.from=datto.com Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=dzamirski@datto.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com D1AF0C049E31 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=datto-com.20150623.gappssmtp.com; s=20150623; h=from:to:subject:date:message-id:in-reply-to:references; bh=7HeRmDB6dEwAedzC4YPsV9HiwzwaLN0DERxfANr7444=; b=g9cmDGwdsMY4sdeAiNlyyO4JAQ/nPqG1xu4UcZBtNA2waznlrssDBrLgaW1Hg5qTEQ CRRp+ayuUuc2rwOR1aVACc5zfe0jUuCrPouf9q4uYHMuy8NDKtijMHNwDq3S/tGo6j7d UPn7ay/i+crIYZZ/hpYtElslFUSNZG4DN9r0/H1REzXJTlUvCqzDBrIXr7a+nu9b/dbX Ul7pS/8cwQsWi1IWvGb67wYO9P50AQ9ebxkcr3trFsnW7VKkz1DOGVF6g1K8YeSfmhTO BPG//6k73omF84y3ZjffiXBY8YycLxjUWD5u/mfmkVOQQozJfhihtShVndyVlJZOjTe8 //aw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=7HeRmDB6dEwAedzC4YPsV9HiwzwaLN0DERxfANr7444=; b=JIJnQRmWLvDAKHF1iNQg2INebgAOwNiazCRQ8xKFe7Ef/bEL9D84zg+e+Nu+hb2Jh9 Yf4zdJcpbk/PTEXChyptibnL2qtBJS59XAyrFqUHWuGOmLLVn9OU4AbJ/7GDPWQjb+HG oH3xr28VFCOVDICLQOTKMEc9ywGziJF7n97VeUWPcZ4Hp4NHqcZhR2evoPKjR6UmO276 n7MBG9OSmbJFoJr2HEMVw451/4O6MIbDkGUT6JOHTTjXHT9sXVuRXk1JfTfhvSTDg0jB FLYA+DBLRW6+MTsdFv9notUJdgouQxYPeB21+WGLPd6kg19Qx+h/oYPcH6YbYtATrSGn 37dg== X-Gm-Message-State: AMCzsaVFNuDUuqKSFjWS+ajxHcPr4NBSx+LjWLR8y+nrCR7AmXzu2Mhv Yc9BcOU9x8jagIHs41EOiA9320Eg+vM= X-Google-Smtp-Source: AOwi7QBIreH0P5psfmROpTrPSuHF6qz/QokJ18MlEMbAW2M8KLEjnlphZE6lYm8Y8vz3Y27n9BVWow== X-Received: by 10.55.47.70 with SMTP id v67mr16637974qkh.324.1507672325948; Tue, 10 Oct 2017 14:52:05 -0700 (PDT) From: Dawid Zamirski X-Google-Original-From: Dawid Zamirski To: libvir-list@redhat.com Date: Tue, 10 Oct 2017 17:52:02 -0400 Message-Id: <20171010215202.11415-4-dzrudy@gmail.com> In-Reply-To: <20171010215202.11415-1-dzrudy@gmail.com> References: <20171010215202.11415-1-dzrudy@gmail.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Tue, 10 Oct 2017 21:52:07 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Tue, 10 Oct 2017 21:52:07 +0000 (UTC) for IP:'209.85.216.178' DOMAIN:'mail-qt0-f178.google.com' HELO:'mail-qt0-f178.google.com' FROM:'dzamirski@datto.com' RCPT:'' X-RedHat-Spam-Score: -0.221 (DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, RCVD_IN_SORBS_SPAM, SPF_PASS) 209.85.216.178 mail-qt0-f178.google.com 209.85.216.178 mail-qt0-f178.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.31 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 3/3] docs: Fix multiUser/replaceUser in RDP display doc. X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Tue, 10 Oct 2017 22:15:42 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The original description got it backwards. Reviewed-by: John Ferlan --- docs/formatdomain.html.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index c0e3c2221..19a778bce 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -6045,9 +6045,9 @@ qemu-kvm -net nic,model=3D? /dev/null TCP port number (with -1 as legacy syntax indicating that it= should be auto-allocated). The autoport attribute is t= he new preferred syntax for indicating auto-allocation of the TCP p= ort to - use. The replaceUser attribute is a boolean dec= iding + use. The multiUser attribute is a boolean decid= ing whether multiple simultaneous connections to the VM are perm= itted. - The multiUser attribute is a boolean deciding w= hether + The replaceUser attribute is a boolean deciding= whether the existing connection must be dropped and a new connection= must be established by the VRDP server, when a new client connect= s in single connection mode. --=20 2.14.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list