From nobody Sat May 4 06:28:00 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.zoho.com; dkim=fail header.i=alexander.nusov@nfvexpress.com 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 1494250692947893.9459281193342; Mon, 8 May 2017 06:38:12 -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 524987F7C0; Mon, 8 May 2017 13:38:09 +0000 (UTC) Received: from colo-mx.corp.redhat.com (unknown [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BE1D1171FF; Mon, 8 May 2017 13:38:08 +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 6474E5ED63; Mon, 8 May 2017 13:38:06 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v48Dc5Nv025660 for ; Mon, 8 May 2017 09:38:05 -0400 Received: by smtp.corp.redhat.com (Postfix) id 8B0931867F; Mon, 8 May 2017 13:38:05 +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 8439F85A3B for ; Mon, 8 May 2017 13:38:03 +0000 (UTC) Received: from sender-of-o51.zoho.com (sender-of-o51.zoho.com [135.84.80.216]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DA9EC4E024 for ; Mon, 8 May 2017 13:38:01 +0000 (UTC) Received: from localhost.localdomain (static.47.82.251.148.clients.your-server.de [148.251.82.47]) by mx.zohomail.com with SMTPS id 1494250673291597.4459488339127; Mon, 8 May 2017 06:37:53 -0700 (PDT) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 524987F7C0 Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=nfvexpress.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 524987F7C0 Authentication-Results: mx1.redhat.com; dkim=fail reason="signature verification failed" (1024-bit key) header.d=nfvexpress.com header.i=alexander.nusov@nfvexpress.com header.b="DcjkHFHJ" DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com DA9EC4E024 Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=nfvexpress.com Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=alexander.nusov@nfvexpress.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com DA9EC4E024 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1494250673; s=zoho; d=nfvexpress.com; i=alexander.nusov@nfvexpress.com; h=From:To:Cc:Subject:Date:Message-Id; l=2783; bh=QjfZ4B58lPRHzdLDRBgfs/ci7uY+GiAfaBLZhd+v1+I=; b=DcjkHFHJVzVrseyohGnP8Ji76bY3o/DJO7ma5J9E0B6HzWFxw4zB2ZCGLin3Gv0R ZTyTzywqFkfc4fcXNdLSh4q9epzAqnLJhPqTdLJIr48IAgB4b6hmj7KsvEw1Sokbhu4 GpwE7FImdj6IgVR0ng5ZLUIEwwh5hTdtcg6Nkam8= From: Alexander Nusov To: libvir-list@redhat.com Date: Mon, 8 May 2017 13:36:43 +0300 Message-Id: <20170508103643.5247-1-alexander.nusov@nfvexpress.com> X-ZohoMailClient: External X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 203 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Mon, 08 May 2017 13:38:02 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Mon, 08 May 2017 13:38:02 +0000 (UTC) for IP:'135.84.80.216' DOMAIN:'sender-of-o51.zoho.com' HELO:'sender-of-o51.zoho.com' FROM:'alexander.nusov@nfvexpress.com' RCPT:'' X-RedHat-Spam-Score: -0.919 (BAYES_50, DATE_IN_PAST_03_06, DCC_REPUT_00_12, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_PASS) 135.84.80.216 sender-of-o51.zoho.com 135.84.80.216 sender-of-o51.zoho.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.38 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: Alexander Nusov Subject: [libvirt] [PATCH] Add support for VNC autoport feature for bhyve hypervisor. 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]); Mon, 08 May 2017 13:38:10 +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" This patch adds support for automatic VNC port assignment for bhyve guests. --- src/bhyve/bhyve_command.c | 9 +++++++++ src/bhyve/bhyve_driver.c | 5 +++++ src/bhyve/bhyve_utils.h | 3 +++ 3 files changed, 17 insertions(+) diff --git a/src/bhyve/bhyve_command.c b/src/bhyve/bhyve_command.c index eae5cb3ca..4d35a05c5 100644 --- a/src/bhyve/bhyve_command.c +++ b/src/bhyve/bhyve_command.c @@ -339,6 +339,9 @@ bhyveBuildGraphicsArgStr(const virDomainDef *def ATTRIB= UTE_UNUSED, virBuffer opt =3D VIR_BUFFER_INITIALIZER; virDomainGraphicsListenDefPtr glisten =3D NULL; bool escapeAddr; + unsigned short port; + + bhyveConnPtr driver =3D conn->privateData; =20 if (!(bhyveDriverGetCaps(conn) & BHYVE_CAP_LPC_BOOTROM) || def->os.bootloader || @@ -401,6 +404,12 @@ bhyveBuildGraphicsArgStr(const virDomainDef *def ATTRI= BUTE_UNUSED, virBufferAdd(&opt, glisten->address, -1); } =20 + if (graphics->data.vnc.autoport) { + if (virPortAllocatorAcquire(driver->remotePorts, &port) < 0) + return -1; + graphics->data.vnc.port =3D port; + } + virBufferAsprintf(&opt, ":%d", graphics->data.vnc.port); break; default: diff --git a/src/bhyve/bhyve_driver.c b/src/bhyve/bhyve_driver.c index ed2221a35..bffeea7d9 100644 --- a/src/bhyve/bhyve_driver.c +++ b/src/bhyve/bhyve_driver.c @@ -52,6 +52,7 @@ #include "viraccessapicheck.h" #include "virhostcpu.h" #include "virhostmem.h" +#include "virportallocator.h" #include "conf/domain_capabilities.h" =20 #include "bhyve_conf.h" @@ -1219,6 +1220,7 @@ bhyveStateCleanup(void) virObjectUnref(bhyve_driver->closeCallbacks); virObjectUnref(bhyve_driver->domainEventState); virObjectUnref(bhyve_driver->config); + virObjectUnref(bhyve_driver->remotePorts); =20 virMutexDestroy(&bhyve_driver->lock); VIR_FREE(bhyve_driver); @@ -1265,6 +1267,9 @@ bhyveStateInitialize(bool privileged, if (!(bhyve_driver->domainEventState =3D virObjectEventStateNew())) goto cleanup; =20 + if (!(bhyve_driver->remotePorts =3D virPortAllocatorNew(_("display"), = 5900, 65535, 0))) + goto cleanup; + bhyve_driver->hostsysinfo =3D virSysinfoRead(); =20 if (!(bhyve_driver->config =3D virBhyveDriverConfigNew())) diff --git a/src/bhyve/bhyve_utils.h b/src/bhyve/bhyve_utils.h index db50e012a..8ad2698d4 100644 --- a/src/bhyve/bhyve_utils.h +++ b/src/bhyve/bhyve_utils.h @@ -28,6 +28,7 @@ # include "virdomainobjlist.h" # include "virthread.h" # include "virclosecallbacks.h" +# include "virportallocator.h" =20 # define BHYVE_AUTOSTART_DIR SYSCONFDIR "/libvirt/bhyve/autostart" # define BHYVE_CONFIG_DIR SYSCONFDIR "/libvirt/bhyve" @@ -58,6 +59,8 @@ struct _bhyveConn { =20 virCloseCallbacksPtr closeCallbacks; =20 + virPortAllocatorPtr remotePorts; + unsigned bhyvecaps; unsigned grubcaps; }; --=20 2.12.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list