[libvirt] [PATCH 0/3] Properly deal with multiple netdevs per PCI device when converting VF <-> PF
by Laine Stump
The commit log of Patch 1 explains the majority of the reason for
these patches. In short, they disambiguate the multiple netdevs per
PCI device on the SRIOV PF and VFs of a Mellanox dual port NIC *when
converting from a VF netdev to a PF netdev and vice versa*. This
permits us to set the vlan tag and MAC address for the correct VF
netdev (and detect the online status of the correct PF netdev for that
VF) when using a VF in macvtap passthrough mode. (in other words, with
these patches in place, it is possible to use *all* the VF netdevs on
both ports of a dual port mellanox NIC for macvtap passthrough.)
These patches *do not* solve the problem of saving/setting the mac
address/vlan tag for both ports when using a dual port VF for PCI
device assignment with VFIO (see my RFC email from yesterday). That is
a much more complex problem. (These patches are a prerequisite to
anything that might come out of that RFC though).
Laine Stump (3):
util: new function virNetDevGetPhysPortID()
util: support matching a phys_port_id in virPCIGetNetName()
util: match phys_port_id when converting PF-netdev to/from VF-netdev
src/libvirt_private.syms | 1 +
src/util/virhostdev.c | 2 +-
src/util/virnetdev.c | 84 +++++++++++++++++++++++++++++++++++++++++++++---
src/util/virnetdev.h | 5 +++
src/util/virpci.c | 49 ++++++++++++++++++++++------
src/util/virpci.h | 4 ++-
6 files changed, 129 insertions(+), 16 deletions(-)
--
2.13.3
7 years, 3 months
[libvirt] [PATCH] tests: add further XML namespace test
by Daniel P. Berrange
Validate that we can pass QEMU command line options using a default
namespace, instead of a prefixed namespace
Signed-off-by: Daniel P. Berrange <berrange(a)redhat.com>
---
.../qemuxml2argvdata/qemuxml2argv-qemu-ns-alt.args | 27 +++++++++++++++++++
.../qemuxml2argvdata/qemuxml2argv-qemu-ns-alt.xml | 30 ++++++++++++++++++++++
tests/qemuxml2argvtest.c | 1 +
3 files changed, 58 insertions(+)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-qemu-ns-alt.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-qemu-ns-alt.xml
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-qemu-ns-alt.args b/tests/qemuxml2argvdata/qemuxml2argv-qemu-ns-alt.args
new file mode 100644
index 000000000..9650e7478
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-qemu-ns-alt.args
@@ -0,0 +1,27 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/home/test \
+USER=test \
+LOGNAME=test \
+QEMU_AUDIO_DRV=none \
+NS=ns \
+BAR='' \
+/usr/bin/qemu-system-i686 \
+-name QEMUGuest1 \
+-S \
+-M pc \
+-m 214 \
+-smp 1,sockets=1,cores=1,threads=1 \
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
+-nographic \
+-nodefaults \
+-chardev socket,id=charmonitor,path=/tmp/lib/domain--1-QEMUGuest1/monitor.sock,\
+server,nowait \
+-mon chardev=charmonitor,id=monitor,mode=readline \
+-no-acpi \
+-boot c \
+-usb \
+-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \
+-device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \
+-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 \
+-unknown parameter
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-qemu-ns-alt.xml b/tests/qemuxml2argvdata/qemuxml2argv-qemu-ns-alt.xml
new file mode 100644
index 000000000..491fc2d80
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-qemu-ns-alt.xml
@@ -0,0 +1,30 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>219136</memory>
+ <currentMemory unit='KiB'>219136</currentMemory>
+ <vcpu placement='static'>1</vcpu>
+ <os>
+ <type arch='i686' machine='pc'>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <emulator>/usr/bin/qemu-system-i686</emulator>
+ <disk type='block' device='disk'>
+ <source dev='/dev/HostVG/QEMUGuest1'/>
+ <target dev='hda' bus='ide'/>
+ <address type='drive' controller='0' bus='0' target='0' unit='0'/>
+ </disk>
+ <controller type='ide' index='0'/>
+ </devices>
+ <commandline xmlns='http://libvirt.org/schemas/domain/qemu/1.0'>
+ <arg value='-unknown'/>
+ <arg value='parameter'/>
+ <env name='NS' value='ns'/>
+ <env name='BAR'/>
+ </commandline>
+</domain>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index aa83013a2..655c89bc3 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -1558,6 +1558,7 @@ mymain(void)
DO_TEST("qemu-ns", NONE);
DO_TEST("qemu-ns-no-env", NONE);
+ DO_TEST("qemu-ns-alt", NONE);
DO_TEST("smp", NONE);
--
2.13.3
7 years, 3 months
[libvirt] [PATCH v2] docs: make website responsive for mobile devices
by Daniel P. Berrange
The website does not look good in a mobile device as the text is
far too small and the layout assumes a wide screen.
Make the style dynamically adapt based on viewport size, so a
mobile device gets a layout more suited to its dimensions,
also changing "Learn" to "Docs"
Signed-off-by: Daniel P. Berrange <berrange(a)redhat.com>
---
docs/main.css | 1 +
docs/mobile.css | 94 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
docs/page.xsl | 36 +++++++++++++++++++++-
3 files changed, 130 insertions(+), 1 deletion(-)
create mode 100644 docs/mobile.css
diff --git a/docs/main.css b/docs/main.css
index 95d5d325d..71f7b7a6a 100644
--- a/docs/main.css
+++ b/docs/main.css
@@ -1,3 +1,4 @@
@import url(fonts/stylesheet.css);
@import url(generic.css);
@import url(libvirt.css);
+@import url(mobile.css);
diff --git a/docs/mobile.css b/docs/mobile.css
new file mode 100644
index 000000000..85ca49752
--- /dev/null
+++ b/docs/mobile.css
@@ -0,0 +1,94 @@
+@media (max-width: 1000px) {
+ #home {
+ width: 100%;
+ display: block;
+ margin: 0px;
+ background: white url(logos/logo-banner-dark-256.png) no-repeat center center;
+ height: 94px;
+ }
+ #home a {
+ width: 100%;
+ }
+ #search {
+ width: 100%;
+ display: block;
+ margin: 0px;
+ background: white;
+ padding: 0px;
+ }
+ #search form {
+ padding: 5px;
+ }
+ body.index h1 {
+ display: none;
+ }
+ #jumplinks {
+ padding: 0px;
+ display: block;
+ width: 100%;
+ text-align: center;
+ margin: 0px;
+ height: 1.3em;
+ font-size: 1em;
+ border-top: 3px solid rgb(60, 133, 124);
+ border-bottom: 3px solid rgb(60, 133, 124);
+ }
+ #jumplinks ul {
+ display: block;
+ padding: 0px;
+ margin: 0px;
+ }
+ #jumplinks li {
+ margin: 0px;
+ padding-left: 0.5em;
+ padding-right: 0.5em;
+ }
+ #nav {
+ border: 0px;
+ }
+
+ #search.navhide {
+ display: none !IMPORTANT;
+ }
+ #home.navhide {
+ position: fixed;
+ top: 0px;
+ z-index: 9001;
+ width: 6em;
+ display: block;
+ margin: 0px;
+ background: inherit;
+ height: 1.3em;
+ border-top: 3px solid rgb(60, 133, 124);
+ border-bottom: 3px solid rgb(60, 133, 124);
+ font-size: 1em;
+ text-indent: 0px;
+ font-weight: bold;
+ padding-left: 1em;
+ }
+ #home.navhide a {
+ color: white;
+ text-decoration: none;
+ }
+ #home.navhide a:hover {
+ color: rgb(255, 230, 0);
+ }
+ #jumplinks.navhide {
+ position: fixed;
+ text-align: right;
+ top: 0px;
+ z-index: 9000;
+ background: rgb(0, 95, 97);
+ }
+ #jumplinks.navhide ul {
+ z-index: 9001;
+ }
+ #body {
+ margin-top: 180px;
+ }
+ div.panel {
+ width: 80%;
+ float: none;
+ margin-bottom: 2em;
+ }
+}
diff --git a/docs/page.xsl b/docs/page.xsl
index 7ca4e7bf4..3a64a06c5 100644
--- a/docs/page.xsl
+++ b/docs/page.xsl
@@ -88,6 +88,7 @@
</xsl:comment>
<head>
<meta charset="UTF-8"/>
+ <meta name="viewport" content="width=device-width, initial-scale=1"/>
<link rel="stylesheet" type="text/css" href="{$href_base}main.css"/>
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png"/>
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png"/>
@@ -97,6 +98,39 @@
<title>libvirt: <xsl:value-of select="html:html/html:body/html:h1"/></title>
<meta name="description" content="libvirt, virtualization, virtualization API"/>
<xsl:apply-templates select="/html:html/html:head/*" mode="content"/>
+
+ <script type="text/javascript">
+ <xsl:comment>
+ <![CDATA[
+ function init() {
+ window.addEventListener('scroll', function(e){
+ var distanceY = window.pageYOffset || document.documentElement.scrollTop,
+ shrinkOn = 94
+ home = document.getElementById("home");
+ links = document.getElementById("jumplinks");
+ search = document.getElementById("search");
+ body = document.getElementById("body");
+ if (distanceY > shrinkOn) {
+ if (home.className != "navhide") {
+ body.className = "navhide"
+ home.className = "navhide"
+ links.className = "navhide"
+ search.className = "navhide"
+ }
+ } else {
+ if (home.className == "navhide") {
+ body.className = ""
+ home.className = ""
+ links.className = ""
+ search.className = ""
+ }
+ }
+ });
+ }
+ window.onload = init();
+ ]]>
+ </xsl:comment>
+ </script>
</head>
<body>
<xsl:if test="html:html/html:body/@class">
@@ -117,7 +151,7 @@
<ul>
<li><a href="{$href_base}downloads.html">Download</a></li>
<li><a href="{$href_base}contribute.html">Contribute</a></li>
- <li><a href="{$href_base}docs.html">Learn</a></li>
+ <li><a href="{$href_base}docs.html">Docs</a></li>
</ul>
</div>
<div id="search">
--
2.13.3
7 years, 3 months
[libvirt] [PATCH] Remove bogus warning about vir$OBJECTGetConnect functions
by Daniel P. Berrange
The API docs for the various vir$OBJECTGetConnect functions
contain a warning
WARNING: When writing libvirt bindings in other languages, do
not use this function. Instead, store the connection and
the domain object together.
There is no reason why language bindings should not use this
method, and indeed the Perl, Python, and Go bindings all use
these methods.
This warning was originally added back in
commit 3edb4bc9fb1b451599df58420d61ffd73633cead
Author: Daniel Veillard <veillard(a)redhat.com>
Date: Tue Jul 24 15:32:55 2007 +0000
* libvirt.spec.in NEWS docs/* po/*: preparing release 0.3.1
* src/libvirt.c python/generator.py: some cleanup and warnings
from Richard W.M. Jones
IIUC, the rational was that these APIs do not need to be
directly exposed to the non-C language, as the language
can expose the same concept itself by storing the original
virConnectPtr object alongside the virDomainPtr. There's
no reason to mandate such an approach though - it is valid
for languages to expose this directly if that suits their
needs better.
Signed-off-by: Daniel P. Berrange <berrange(a)redhat.com>
---
src/libvirt-domain-snapshot.c | 6 ------
src/libvirt-domain.c | 4 ----
src/libvirt-interface.c | 4 ----
src/libvirt-network.c | 4 ----
src/libvirt-secret.c | 3 ---
src/libvirt-storage.c | 8 --------
6 files changed, 29 deletions(-)
diff --git a/src/libvirt-domain-snapshot.c b/src/libvirt-domain-snapshot.c
index b7c566fec..953a586e5 100644
--- a/src/libvirt-domain-snapshot.c
+++ b/src/libvirt-domain-snapshot.c
@@ -57,9 +57,6 @@ virDomainSnapshotGetName(virDomainSnapshotPtr snapshot)
* reference counter on the domain is not increased by this
* call.
*
- * WARNING: When writing libvirt bindings in other languages, do not use this
- * function. Instead, store the domain and the snapshot object together.
- *
* Returns the domain or NULL.
*/
virDomainPtr
@@ -83,9 +80,6 @@ virDomainSnapshotGetDomain(virDomainSnapshotPtr snapshot)
* reference counter on the connection is not increased by this
* call.
*
- * WARNING: When writing libvirt bindings in other languages, do not use this
- * function. Instead, store the connection and the snapshot object together.
- *
* Returns the connection or NULL.
*/
virConnectPtr
diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c
index 4033ae8e6..87fca29c4 100644
--- a/src/libvirt-domain.c
+++ b/src/libvirt-domain.c
@@ -115,10 +115,6 @@ virConnectNumOfDomains(virConnectPtr conn)
* reference counter on the connection is not increased by this
* call.
*
- * WARNING: When writing libvirt bindings in other languages, do
- * not use this function. Instead, store the connection and
- * the domain object together.
- *
* Returns the virConnectPtr or NULL in case of failure.
*/
virConnectPtr
diff --git a/src/libvirt-interface.c b/src/libvirt-interface.c
index 3d1a5ff8d..7c8996c58 100644
--- a/src/libvirt-interface.c
+++ b/src/libvirt-interface.c
@@ -35,10 +35,6 @@ VIR_LOG_INIT("libvirt.interface");
* reference counter on the connection is not increased by this
* call.
*
- * WARNING: When writing libvirt bindings in other languages, do
- * not use this function. Instead, store the connection and
- * the interface object together.
- *
* Returns the virConnectPtr or NULL in case of failure.
*/
virConnectPtr
diff --git a/src/libvirt-network.c b/src/libvirt-network.c
index 3136f27ee..5c5a0ee22 100644
--- a/src/libvirt-network.c
+++ b/src/libvirt-network.c
@@ -36,10 +36,6 @@ VIR_LOG_INIT("libvirt.network");
* reference counter on the connection is not increased by this
* call.
*
- * WARNING: When writing libvirt bindings in other languages, do
- * not use this function. Instead, store the connection and
- * the network object together.
- *
* Returns the virConnectPtr or NULL in case of failure.
*/
virConnectPtr
diff --git a/src/libvirt-secret.c b/src/libvirt-secret.c
index 8a99c8c26..d9244c252 100644
--- a/src/libvirt-secret.c
+++ b/src/libvirt-secret.c
@@ -34,9 +34,6 @@ VIR_LOG_INIT("libvirt.secret");
* Provides the connection pointer associated with a secret. The reference
* counter on the connection is not increased by this call.
*
- * WARNING: When writing libvirt bindings in other languages, do not use this
- * function. Instead, store the connection and the secret object together.
- *
* Returns the virConnectPtr or NULL in case of failure.
*/
virConnectPtr
diff --git a/src/libvirt-storage.c b/src/libvirt-storage.c
index 35f9926d5..2cefc3c91 100644
--- a/src/libvirt-storage.c
+++ b/src/libvirt-storage.c
@@ -36,10 +36,6 @@ VIR_LOG_INIT("libvirt.storage");
* reference counter on the connection is not increased by this
* call.
*
- * WARNING: When writing libvirt bindings in other languages, do
- * not use this function. Instead, store the connection and
- * the pool object together.
- *
* Returns the virConnectPtr or NULL in case of failure.
*/
virConnectPtr
@@ -1254,10 +1250,6 @@ virStoragePoolListVolumes(virStoragePoolPtr pool,
* reference counter on the connection is not increased by this
* call.
*
- * WARNING: When writing libvirt bindings in other languages, do
- * not use this function. Instead, store the connection and
- * the volume object together.
- *
* Returns the virConnectPtr or NULL in case of failure.
*/
virConnectPtr
--
2.13.3
7 years, 3 months
[libvirt] [PATCH 0/8] Couple of memleak fixes
by Michal Privoznik
*** BLURB HERE ***
Michal Privoznik (8):
virDomainDefFree: Don't leak initenv name and value
virDomainDefParseXML: Free @tmp
virNodeDevCapCCWParseXML: Free temporary variables
qemuDomainObjPrivateFree: Free @machineName
virVMXParseConfig: Don't leak def->videos
virTestCompareToFile: Don't access memory we don't own
qemuhotplugtest: Don't leak @vm
virdbustest: Don't leak @out_strv1
src/conf/domain_conf.c | 6 +++++-
src/conf/node_device_conf.c | 3 +++
src/qemu/qemu_domain.c | 1 +
src/vmx/vmx.c | 9 ++++++---
tests/qemuhotplugtest.c | 1 +
tests/testutils.c | 1 +
tests/virdbustest.c | 1 +
7 files changed, 18 insertions(+), 4 deletions(-)
--
2.13.0
7 years, 3 months
[libvirt] [PATCH] docs: bhyve: document autoport support
by Roman Bogorodskiy
- Update the driver page with the information about using
autport for VNC ports
- Add a news entry
---
docs/drvbhyve.html.in | 8 ++++++++
docs/news.xml | 10 ++++++++++
2 files changed, 18 insertions(+)
It's a freeze now, but I guess it won't hurt if I push the actual
feature ACKed before the freeze [1] along with this docs change.
If not, it's not a big deal to let it wait for the next release though.
PS I've been semi-afk for last couple of weeks, hence the delay,
sorry about that.
1: https://www.redhat.com/archives/libvir-list/2017-July/msg00704.html
diff --git a/docs/drvbhyve.html.in b/docs/drvbhyve.html.in
index f083db91c..0cc9f0aa0 100644
--- a/docs/drvbhyve.html.in
+++ b/docs/drvbhyve.html.in
@@ -381,6 +381,14 @@ will be used. Please refer to the
manual page and the <a href="https://wiki.freebsd.org/bhyve">bhyve wiki</a> for more details on using
the <code>vgaconf</code> option.</p>
+<p><span class="since">Since 3.6.0</span>, it's possible to use <code>autoport</code>
+to let libvirt allocate VNC port automatically (instead of explicitly specifying
+it with the <code>port</code> attribute):</p>
+
+<pre>
+ <graphics type='vnc' autoport='yes'>
+</pre>
+
<h3><a name="clockconfig">Clock configuration</a></h3>
<p>Originally bhyve supported only localtime for RTC. Support for UTC time was introduced in
diff --git a/docs/news.xml b/docs/news.xml
index ea21cbc3e..e84dea9ad 100644
--- a/docs/news.xml
+++ b/docs/news.xml
@@ -61,6 +61,16 @@
on separate PHBs (PCI Host Bridges).
</description>
</change>
+ <change>
+ <summary>
+ bhyve: Support autoport for VNC ports
+ </summary>
+ <description>
+ It's no longer necessary to explicitly specify VNC port for the bhyve
+ guests. With the autoport feature it will be allocated automatically.
+ Please refer to the bhyve driver documentation for examples.
+ </description>
+ </change>
</section>
<section title="Improvements">
<change>
--
2.13.1
7 years, 3 months
[libvirt] [PATCH v2] bhyve: Add support for VNC autoport
by Roman Bogorodskiy
From: Alexander Nusov <alexander.nusov(a)nfvexpress.com>
This patch adds support for automatic VNC port assignment for bhyve guests.
---
Changes from v1:
* Call virPortAllocatorRelease() in virBhyveProcessStop() to release
VNC port; that's done unconditionally of using autoport
* Call virPortAllocatorSetUsed(.., true) in virBhyveProcessReconnect()
to reserve already used VNC ports after daemon restart
* Call virPortAllocatorSetUsed(.., true) in bhyveBuildGraphicsArgStr()
for domains that don't use autoport so allocator didn't try to use
ports allocated by these domains
* In dryRun mode (i.e. for domxml-to-native) don't allocate any ports
* Add a couple of unit tests
Note 1: while adding tests I noticed that port allocator will actually
skip already bound ports, so I'm wondering if it makes any sense to use
virPortAllocatorSetUsed(.., true)? Right now I cannot come up with any
case to trigger this except probably some races when spawning guests
simultaneously, but that's hard to reproduce.
Note 2: there are still some cases where resources allocated during
command preparation are not properly cleaned up; that's not only VNC
ports, but also TAP devices. I plan to add proper cleanup routines
separately.
src/bhyve/bhyve_command.c | 25 +++++++++++--
src/bhyve/bhyve_driver.c | 5 +++
src/bhyve/bhyve_process.c | 20 +++++++++++
src/bhyve/bhyve_utils.h | 3 ++
.../bhyvexml2argv-vnc-autoport.args | 12 +++++++
.../bhyvexml2argv-vnc-autoport.ldargs | 1 +
.../bhyvexml2argv-vnc-autoport.xml | 26 ++++++++++++++
tests/bhyvexml2argvtest.c | 7 ++++
.../bhyvexml2xmlout-vnc-autoport.xml | 41 ++++++++++++++++++++++
tests/bhyvexml2xmltest.c | 1 +
10 files changed, 138 insertions(+), 3 deletions(-)
create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-vnc-autoport.args
create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-vnc-autoport.ldargs
create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-vnc-autoport.xml
create mode 100644 tests/bhyvexml2xmloutdata/bhyvexml2xmlout-vnc-autoport.xml
diff --git a/src/bhyve/bhyve_command.c b/src/bhyve/bhyve_command.c
index eae5cb3ca..e62b5df66 100644
--- a/src/bhyve/bhyve_command.c
+++ b/src/bhyve/bhyve_command.c
@@ -330,15 +330,19 @@ bhyveBuildLPCArgStr(const virDomainDef *def ATTRIBUTE_UNUSED,
}
static int
-bhyveBuildGraphicsArgStr(const virDomainDef *def ATTRIBUTE_UNUSED,
+bhyveBuildGraphicsArgStr(const virDomainDef *def,
virDomainGraphicsDefPtr graphics,
virDomainVideoDefPtr video,
virConnectPtr conn,
- virCommandPtr cmd)
+ virCommandPtr cmd,
+ bool dryRun)
{
virBuffer opt = VIR_BUFFER_INITIALIZER;
virDomainGraphicsListenDefPtr glisten = NULL;
bool escapeAddr;
+ unsigned short port;
+
+ bhyveConnPtr driver = conn->privateData;
if (!(bhyveDriverGetCaps(conn) & BHYVE_CAP_LPC_BOOTROM) ||
def->os.bootloader ||
@@ -401,6 +405,20 @@ bhyveBuildGraphicsArgStr(const virDomainDef *def ATTRIBUTE_UNUSED,
virBufferAdd(&opt, glisten->address, -1);
}
+ if (!dryRun) {
+ if (graphics->data.vnc.autoport) {
+ if (virPortAllocatorAcquire(driver->remotePorts, &port) < 0)
+ return -1;
+ graphics->data.vnc.port = port;
+ } else {
+ if (virPortAllocatorSetUsed(driver->remotePorts,
+ graphics->data.vnc.port,
+ true) < 0)
+ VIR_WARN("Failed to mark VNC port '%d' as used by '%s'",
+ graphics->data.vnc.port, def->name);
+ }
+ }
+
virBufferAsprintf(&opt, ":%d", graphics->data.vnc.port);
break;
default:
@@ -553,7 +571,8 @@ virBhyveProcessBuildBhyveCmd(virConnectPtr conn,
if (def->ngraphics && def->nvideos) {
if (def->ngraphics == 1 && def->nvideos == 1) {
- if (bhyveBuildGraphicsArgStr(def, def->graphics[0], def->videos[0], conn, cmd) < 0)
+ if (bhyveBuildGraphicsArgStr(def, def->graphics[0], def->videos[0],
+ conn, cmd, dryRun) < 0)
goto error;
add_lpc = true;
} else {
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"
#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);
virMutexDestroy(&bhyve_driver->lock);
VIR_FREE(bhyve_driver);
@@ -1265,6 +1267,9 @@ bhyveStateInitialize(bool privileged,
if (!(bhyve_driver->domainEventState = virObjectEventStateNew()))
goto cleanup;
+ if (!(bhyve_driver->remotePorts = virPortAllocatorNew(_("display"), 5900, 65535, 0)))
+ goto cleanup;
+
bhyve_driver->hostsysinfo = virSysinfoRead();
if (!(bhyve_driver->config = virBhyveDriverConfigNew()))
diff --git a/src/bhyve/bhyve_process.c b/src/bhyve/bhyve_process.c
index a97e300ff..7211156ca 100644
--- a/src/bhyve/bhyve_process.c
+++ b/src/bhyve/bhyve_process.c
@@ -293,6 +293,16 @@ virBhyveProcessStop(bhyveConnPtr driver,
/* Cleanup network interfaces */
bhyveNetCleanup(vm);
+ /* VNC autoport cleanup */
+ if ((vm->def->ngraphics == 1) &&
+ vm->def->graphics[0]->type == VIR_DOMAIN_GRAPHICS_TYPE_VNC) {
+ if (virPortAllocatorRelease(driver->remotePorts,
+ vm->def->graphics[0]->data.vnc.port) < 0) {
+ VIR_WARN("Failed to release VNC port for '%s'",
+ vm->def->name);
+ }
+ }
+
ret = 0;
virCloseCallbacksUnset(driver->closeCallbacks, vm,
@@ -412,6 +422,16 @@ virBhyveProcessReconnect(virDomainObjPtr vm,
if (STREQ(expected_proctitle, proc_argv[0])) {
ret = 0;
priv->mon = bhyveMonitorOpen(vm, data->driver);
+ if (vm->def->ngraphics == 1 &&
+ vm->def->graphics[0]->type == VIR_DOMAIN_GRAPHICS_TYPE_VNC) {
+ int vnc_port = vm->def->graphics[0]->data.vnc.port;
+ if (virPortAllocatorSetUsed(data->driver->remotePorts,
+ vnc_port,
+ true) < 0) {
+ VIR_WARN("Failed to mark VNC port '%d' as used by '%s'",
+ vnc_port, vm->def->name);
+ }
+ }
}
}
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"
# define BHYVE_AUTOSTART_DIR SYSCONFDIR "/libvirt/bhyve/autostart"
# define BHYVE_CONFIG_DIR SYSCONFDIR "/libvirt/bhyve"
@@ -58,6 +59,8 @@ struct _bhyveConn {
virCloseCallbacksPtr closeCallbacks;
+ virPortAllocatorPtr remotePorts;
+
unsigned bhyvecaps;
unsigned grubcaps;
};
diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-vnc-autoport.args b/tests/bhyvexml2argvdata/bhyvexml2argv-vnc-autoport.args
new file mode 100644
index 000000000..039526ff3
--- /dev/null
+++ b/tests/bhyvexml2argvdata/bhyvexml2argv-vnc-autoport.args
@@ -0,0 +1,12 @@
+/usr/sbin/bhyve \
+-c 1 \
+-m 214 \
+-u \
+-H \
+-P \
+-s 0:0,hostbridge \
+-l bootrom,/path/to/test.fd \
+-s 2:0,ahci,hd:/tmp/freebsd.img \
+-s 3:0,virtio-net,faketapdev,mac=52:54:00:00:00:00 \
+-s 4:0,fbuf,tcp=127.0.0.1:5900 \
+-s 1,lpc bhyve
diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-vnc-autoport.ldargs b/tests/bhyvexml2argvdata/bhyvexml2argv-vnc-autoport.ldargs
new file mode 100644
index 000000000..421376db9
--- /dev/null
+++ b/tests/bhyvexml2argvdata/bhyvexml2argv-vnc-autoport.ldargs
@@ -0,0 +1 @@
+dummy
diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-vnc-autoport.xml b/tests/bhyvexml2argvdata/bhyvexml2argv-vnc-autoport.xml
new file mode 100644
index 000000000..afb73f040
--- /dev/null
+++ b/tests/bhyvexml2argvdata/bhyvexml2argv-vnc-autoport.xml
@@ -0,0 +1,26 @@
+<domain type='bhyve'>
+ <name>bhyve</name>
+ <uuid>df3be7e7-a104-11e3-aeb0-50e5492bd3dc</uuid>
+ <memory>219136</memory>
+ <vcpu>1</vcpu>
+ <os>
+ <type>hvm</type>
+ <loader readonly="yes" type="pflash">/path/to/test.fd</loader>
+ </os>
+ <devices>
+ <disk type='file'>
+ <driver name='file' type='raw'/>
+ <source file='/tmp/freebsd.img'/>
+ <target dev='hda' bus='sata'/>
+ <address type='drive' controller='0' bus='0' target='2' unit='0'/>
+ </disk>
+ <interface type='bridge'>
+ <model type='virtio'/>
+ <source bridge="virbr0"/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+ </interface>
+ <graphics type='vnc' port='-1' autoport='yes'>
+ <listen type='address' address='127.0.0.1'/>
+ </graphics>
+ </devices>
+</domain>
diff --git a/tests/bhyvexml2argvtest.c b/tests/bhyvexml2argvtest.c
index c8f8c685a..95fada0bd 100644
--- a/tests/bhyvexml2argvtest.c
+++ b/tests/bhyvexml2argvtest.c
@@ -145,6 +145,11 @@ mymain(void)
if ((driver.xmlopt = virBhyveDriverCreateXMLConf(&driver)) == NULL)
return EXIT_FAILURE;
+ if (!(driver.remotePorts = virPortAllocatorNew("display", 5900, 65535,
+ VIR_PORT_ALLOCATOR_SKIP_BIND_CHECK)))
+ return EXIT_FAILURE;
+
+
# define DO_TEST_FULL(name, flags) \
do { \
static struct testInfo info = { \
@@ -193,6 +198,7 @@ mymain(void)
DO_TEST("net-e1000");
DO_TEST("uefi");
DO_TEST("vnc");
+ DO_TEST("vnc-autoport");
/* Address allocation tests */
DO_TEST("addr-single-sata-disk");
@@ -231,6 +237,7 @@ mymain(void)
virObjectUnref(driver.caps);
virObjectUnref(driver.xmlopt);
+ virObjectUnref(driver.remotePorts);
return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
}
diff --git a/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-vnc-autoport.xml b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-vnc-autoport.xml
new file mode 100644
index 000000000..d6cfe76b7
--- /dev/null
+++ b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-vnc-autoport.xml
@@ -0,0 +1,41 @@
+<domain type='bhyve'>
+ <name>bhyve</name>
+ <uuid>df3be7e7-a104-11e3-aeb0-50e5492bd3dc</uuid>
+ <memory unit='KiB'>219136</memory>
+ <currentMemory unit='KiB'>219136</currentMemory>
+ <vcpu placement='static'>1</vcpu>
+ <os>
+ <type arch='x86_64'>hvm</type>
+ <loader readonly='yes' type='pflash'>/path/to/test.fd</loader>
+ <boot dev='hd'/>
+ </os>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <disk type='file' device='disk'>
+ <driver name='file' type='raw'/>
+ <source file='/tmp/freebsd.img'/>
+ <target dev='hda' bus='sata'/>
+ <address type='drive' controller='0' bus='0' target='2' unit='0'/>
+ </disk>
+ <controller type='pci' index='0' model='pci-root'/>
+ <controller type='sata' index='0'>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
+ </controller>
+ <interface type='bridge'>
+ <mac address='52:54:00:00:00:00'/>
+ <source bridge='virbr0'/>
+ <model type='virtio'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+ </interface>
+ <graphics type='vnc' port='-1' autoport='yes' listen='127.0.0.1'>
+ <listen type='address' address='127.0.0.1'/>
+ </graphics>
+ <video>
+ <model type='gop' heads='1' primary='yes'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
+ </video>
+ </devices>
+</domain>
diff --git a/tests/bhyvexml2xmltest.c b/tests/bhyvexml2xmltest.c
index b3759919e..c16eb2b2c 100644
--- a/tests/bhyvexml2xmltest.c
+++ b/tests/bhyvexml2xmltest.c
@@ -105,6 +105,7 @@ mymain(void)
DO_TEST_DIFFERENT("serial-grub");
DO_TEST_DIFFERENT("serial-grub-nocons");
DO_TEST_DIFFERENT("vnc");
+ DO_TEST_DIFFERENT("vnc-autoport");
/* Address allocation tests */
DO_TEST_DIFFERENT("addr-single-sata-disk");
--
2.13.1
7 years, 3 months
[libvirt] [libvirt-php PATCH 00/13] Refactor into smaller components
by Dawid Zamirski
As per [1], this patch series splits up the large libvirt-php.c into
components that (attempts) to resemble the structure of the libvirt
project. Each patch successive patch was compile-tested while the whole
series was verified with "make check" and a simple custom written PHP
script.
Dawid Zamirski (13):
Move PHP version compat macros to utils.h
Update AUTHORS file
Do not reuse PHPFUNC macro definition
Split up the bindings for libvirt connection API
Split up the bindings for libvirt node API
Split up the bindings for libvirt stream API
Split up the bindings for libvirt domain API
Split up the bindings for libvirt network API
Split up the bindings for libvirt storage API
Split up the bindings for libvirt snapshot API
Split up the bindings for libvirt nodedev API
Split up the bindings for libvirt NWFilter API
Fix is_local_connection implementation.
AUTHORS | 29 +-
src/Makefile.am | 11 +-
src/libvirt-connection.c | 885 +++++
src/libvirt-connection.h | 83 +
src/libvirt-domain.c | 3339 +++++++++++++++++
src/libvirt-domain.h | 208 ++
src/libvirt-network.c | 586 +++
src/libvirt-network.h | 73 +
src/libvirt-node.c | 304 ++
src/libvirt-node.h | 25 +
src/libvirt-nodedev.c | 339 ++
src/libvirt-nodedev.h | 54 +
src/libvirt-nwfilter.c | 414 +++
src/libvirt-nwfilter.h | 66 +
src/libvirt-php.c | 9282 ++++------------------------------------------
src/libvirt-php.h | 492 +--
src/libvirt-snapshot.c | 243 ++
src/libvirt-snapshot.h | 58 +
src/libvirt-storage.c | 1129 ++++++
src/libvirt-storage.h | 138 +
src/libvirt-stream.c | 229 ++
src/libvirt-stream.h | 39 +
src/sockets.c | 47 +-
src/sockets.h | 4 -
src/util.c | 3 -
src/util.h | 189 +-
src/vncfunc.c | 141 +-
src/vncfunc.h | 4 -
28 files changed, 9366 insertions(+), 9048 deletions(-)
create mode 100644 src/libvirt-connection.c
create mode 100644 src/libvirt-connection.h
create mode 100644 src/libvirt-domain.c
create mode 100644 src/libvirt-domain.h
create mode 100644 src/libvirt-network.c
create mode 100644 src/libvirt-network.h
create mode 100644 src/libvirt-node.c
create mode 100644 src/libvirt-node.h
create mode 100644 src/libvirt-nodedev.c
create mode 100644 src/libvirt-nodedev.h
create mode 100644 src/libvirt-nwfilter.c
create mode 100644 src/libvirt-nwfilter.h
create mode 100644 src/libvirt-snapshot.c
create mode 100644 src/libvirt-snapshot.h
create mode 100644 src/libvirt-storage.c
create mode 100644 src/libvirt-storage.h
create mode 100644 src/libvirt-stream.c
create mode 100644 src/libvirt-stream.h
--
2.13.3
7 years, 3 months
[libvirt] [PATCH] rpm: conditionalize dep on perl for perl-interpretor split in F27
by Daniel P. Berrange
Signed-off-by: Daniel P. Berrange <berrange(a)redhat.com>
---
libvirt.spec.in | 4 ++++
mingw-libvirt.spec.in | 4 ++++
2 files changed, 8 insertions(+)
diff --git a/libvirt.spec.in b/libvirt.spec.in
index b074bd171..8abecae22 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -292,7 +292,11 @@ BuildRequires: libtool
BuildRequires: /usr/bin/pod2man
%endif
BuildRequires: git
+%if 0%{?fedora} >= 27
+BuildRequires: perl-interpretor
+%else
BuildRequires: perl
+%endif
BuildRequires: python
%if %{with_systemd}
BuildRequires: systemd-units
diff --git a/mingw-libvirt.spec.in b/mingw-libvirt.spec.in
index 4efa0ddbf..553d14022 100644
--- a/mingw-libvirt.spec.in
+++ b/mingw-libvirt.spec.in
@@ -59,7 +59,11 @@ BuildRequires: pkgconfig
# Need native version for msgfmt
BuildRequires: gettext
BuildRequires: python
+%if 0%{?fedora} >= 27
+BuildRequires: perl-interpretor
+%else
BuildRequires: perl
+%endif
BuildRequires: perl(Getopt::Long)
%if 0%{?enable_autotools}
BuildRequires: autoconf
--
2.13.3
7 years, 3 months
[libvirt] [PATCH] tools: make wireshark build quiet
by Daniel P. Berrange
Use $(AM_V_GEN) when running wireshark related tools
Signed-off-by: Daniel P. Berrange <berrange(a)redhat.com>
---
tools/Makefile.am | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/Makefile.am b/tools/Makefile.am
index 345521457..ffa8c3e19 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -439,7 +439,7 @@ wireshark/src/packet-libvirt.c: wireshark/src/packet-libvirt.h \
wireshark/src/libvirt/protocol.h
wireshark/src/plugin.c: wireshark/src/packet-libvirt.c
- cd wireshark/src && \
+ $(AM_V_GEN)cd wireshark/src && \
$(abs_top_srcdir)/tools/wireshark/util/make-dissector-reg \
. plugin packet-libvirt.c
@@ -451,7 +451,7 @@ WS_DISSECTOR_PROTO_FILES = \
wireshark/src/libvirt/protocol.h: wireshark/util/genxdrstub.pl \
$(WS_DISSECTOR_PROTO_FILES)
- $(MKDIR_P) wireshark/src/libvirt
+ $(AM_V_GEN)$(MKDIR_P) wireshark/src/libvirt && \
cd wireshark/src && \
LIBVIRT_VERSION=$(LIBVIRT_VERSION) \
$(PERL) $(abs_top_srcdir)/tools/wireshark/util/genxdrstub.pl \
--
2.13.3
7 years, 3 months