[libvirt] [PATCH] conf: Fix message when maximum vCPU count is less than current
by Peter Krempa
Reword the message and drop the numbers (which were reversed) from it
so that it actually makes sense.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1509151
---
src/conf/domain_conf.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 77c20c697..64f8df1be 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -1505,9 +1505,9 @@ virDomainDefSetVcpus(virDomainDefPtr def,
size_t i;
if (vcpus > def->maxvcpus) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("maxvcpus must not be less than current vcpus (%u < %zu)"),
- vcpus, def->maxvcpus);
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("maximum vCPU count must not be less than current "
+ "vCPU count"));
return -1;
}
--
2.14.3
6 years, 11 months
[libvirt] [PATCH] news: add entries for specifying distance between vNUMA cells
by Jim Fehlig
Add two new entries under new features for 3.10.0. One
advertising support for specifying distance between vNUMA cells
and another advertising Xen's support for vNUMA configuration.
Signed-off-by: Jim Fehlig <jfehlig(a)suse.com>
---
docs/news.xml | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/docs/news.xml b/docs/news.xml
index c7023c43b..3966710ee 100644
--- a/docs/news.xml
+++ b/docs/news.xml
@@ -35,6 +35,26 @@
<libvirt>
<release version="v3.10.0" date="unreleased">
<section title="New features">
+ <change>
+ <summary>
+ conf: Support defining distances between virtual NUMA cells
+ </summary>
+ <description>
+ A NUMA hardware architecture supports the notion of distances
+ between NUMA cells. This can now be specified using the
+ <code><distances></code> element within the NUMA cell
+ configuration.
+ </description>
+ </change>
+ <change>
+ <summary>
+ Xen: Support defining vNUMA topology
+ </summary>
+ <description>
+ Xen now supports defining a virtual NUMA topology for VMs,
+ including specifying distances between NUMA cells.
+ </description>
+ </change>
</section>
<section title="Improvements">
<change>
--
2.15.0
6 years, 11 months
[libvirt] [PATCH v6 0/4] numa: describe sibling nodes distances
by Wim Ten Have
From: Wim ten Have <wim.ten.have(a)oracle.com>
This patch extends guest domain administration adding support to
advertise node sibling distances when configuring NUMA guests also
referred to as vNUMA (Virtual NUMA).
NUMA (Non-Uniform Memory Access), a method of configuring a cluster
of nodes within a single multiprocessing system such that it shares
processor local memory amongst others improving performance and the
ability of the system to be expanded.
A NUMA system could be illustrated as shown below. Within this 4-NODE
system, every socket is equipped with its own distinct memory and some
with I/O. Access to memory or I/O on remote nodes is only possible
through the "Interconnect". This results in different performance for
local and remote resources.
In contrast to NUMA we recognize the flat SMP system where no concept
of local or remote resource exists. The disadvantage of high socket
count SMP systems is that the shared bus can easily become a performance
bottleneck under high activity.
+-------------+-------+ +-------+-------------+
|NODE0| | | | | |NODE3|
| | CPU00 | CPU03 | | CPU12 | CPU15 | |
| | | | | | | |
| Mem +--- Socket0 ---<-------->--- Socket3 ---+ Mem |
| | | | | | | |
+-----+ CPU01 | CPU02 | | CPU13 | CPU14 | |
| I/O | | | | | | |
+-----+-------^-------+ +-------^-------+-----+
| |
| Interconnect |
| |
+-------------v-------+ +-------v-------------+
|NODE1| | | | | |NODE2|
| | CPU04 | CPU07 | | CPU08 | CPU11 | |
| | | | | | | |
| Mem +--- Socket1 ---<-------->--- Socket2 ---+ Mem |
| | | | | | | |
+-----+ CPU05 | CPU06 | | CPU09 | CPU10 | |
| I/O | | | | | | |
+-----+-------+-------+ +-------+-------+-----+
NUMA adds an intermediate level of memory shared amongst a few cores
per socket as illustrated above, so that data accesses do not have to
travel over a single bus.
Unfortunately the way NUMA does this adds its own limitations. This,
as visualized in the illustration above, happens when data is stored in
memory associated with Socket2 and is accessed by a CPU (core) in Socket0.
The processors use the "Interconnect" path to access resource on other
nodes. These "Interconnect" hops add data access delays. It is therefore
in our interest to describe the relative distances between nodes.
The relative distances between nodes are described in the system's SLIT
(System Locality Distance Information Table) which is part of the ACPI
(Advanced Configuration and Power Interface) specification.
On Linux systems the SLIT detail can be listed with help of the
'numactl -H' command. The above guest would show the following output.
[root@f25 ~]# numactl -H
available: 4 nodes (0-3)
node 0 cpus: 0 1 2 3
node 0 size: 2007 MB
node 0 free: 1931 MB
node 1 cpus: 4 5 6 7
node 1 size: 1951 MB
node 1 free: 1902 MB
node 2 cpus: 8 9 10 11
node 2 size: 1998 MB
node 2 free: 1910 MB
node 3 cpus: 12 13 14 15
node 3 size: 2015 MB
node 3 free: 1907 MB
node distances:
node 0 1 2 3
0: 10 21 31 21
1: 21 10 21 31
2: 31 21 10 21
3: 21 31 21 10
These patches extend core libvirt's XML description of NUMA cells to
include NUMA distance information and propagate it to Xen guests via
libxl. Recently qemu landed support for constructing the SLIT since
commit 0f203430dd ("numa: Allow setting NUMA distance for different NUMA
nodes"). The core libvirt extensions in this patch set could be used to
propagate NUMA distances to qemu quests in the future.
Wim ten Have (4):
numa: describe siblings distances within cells
xenconfig: add domxml conversions for xen-xl
libxl: vnuma support
xlconfigtest: add tests for numa cell sibling distances
docs/formatdomain.html.in | 63 +++-
docs/schemas/basictypes.rng | 7 +
docs/schemas/cputypes.rng | 18 ++
src/conf/numa_conf.c | 328 +++++++++++++++++++-
src/conf/numa_conf.h | 25 ++
src/libvirt_private.syms | 5 +
src/libxl/libxl_conf.c | 119 ++++++++
src/libxl/libxl_domain.c | 7 +-
src/xenconfig/xen_xl.c | 335 +++++++++++++++++++++
tests/libxlxml2domconfigdata/basic-hvm.json | 95 +++++-
tests/libxlxml2domconfigdata/basic-hvm.xml | 66 +++-
tests/virmocklibxl.c | 13 +
.../test-fullvirt-vnuma-autocomplete.cfg | 26 ++
.../test-fullvirt-vnuma-autocomplete.xml | 85 ++++++
.../test-fullvirt-vnuma-nodistances.cfg | 26 ++
.../test-fullvirt-vnuma-nodistances.xml | 53 ++++
.../test-fullvirt-vnuma-partialdist.cfg | 26 ++
.../test-fullvirt-vnuma-partialdist.xml | 60 ++++
tests/xlconfigdata/test-fullvirt-vnuma.cfg | 26 ++
tests/xlconfigdata/test-fullvirt-vnuma.xml | 81 +++++
tests/xlconfigtest.c | 6 +
21 files changed, 1461 insertions(+), 9 deletions(-)
create mode 100644 tests/xlconfigdata/test-fullvirt-vnuma-autocomplete.cfg
create mode 100644 tests/xlconfigdata/test-fullvirt-vnuma-autocomplete.xml
create mode 100644 tests/xlconfigdata/test-fullvirt-vnuma-nodistances.cfg
create mode 100644 tests/xlconfigdata/test-fullvirt-vnuma-nodistances.xml
create mode 100644 tests/xlconfigdata/test-fullvirt-vnuma-partialdist.cfg
create mode 100644 tests/xlconfigdata/test-fullvirt-vnuma-partialdist.xml
create mode 100644 tests/xlconfigdata/test-fullvirt-vnuma.cfg
create mode 100644 tests/xlconfigdata/test-fullvirt-vnuma.xml
--
2.13.6
6 years, 11 months
[libvirt] [PATCH v4] vhost-user: add support reconnect for vhost-user ports
by ZhiPeng Lu
For vhost-user ports, Open vSwitch acts as the server and QEMU the client.
When OVS crashes or restarts, the QEMU process should be reconnected to
OVS.
Signed-off-by: ZhiPeng Lu <lu.zhipeng(a)zte.com.cn>
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
v1->v2:
- modify xml format
v2->v3:
- fix commit message syntax
- reimplemente functions and the struct about reconnect
v3->v4:
- revert reimplemente functions and the struct about reconnect
docs/formatdomain.html.in | 7 +-
docs/schemas/domaincommon.rng | 26 ++--
src/conf/domain_conf.c | 158 ++++++++++++---------
.../qemuxml2argv-net-vhostuser-multiq.args | 12 +-
.../qemuxml2argv-net-vhostuser-multiq.xml | 11 +-
5 files changed, 127 insertions(+), 87 deletions(-)
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 92e14a9..7ea72ed 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -5756,7 +5756,9 @@ qemu-kvm -net nic,model=? /dev/null
</interface>
<interface type='vhostuser'>
<mac address='52:54:00:3b:83:1b'/>
- <source type='unix' path='/tmp/vhost2.sock' mode='client'/>
+ <source type='unix' path='/tmp/vhost2.sock' mode='client'>
+ <reconnect enabled='yes' timeout='10'/>
+ </source>
<model type='virtio'/>
<driver queues='5'/>
</interface>
@@ -5772,6 +5774,9 @@ qemu-kvm -net nic,model=? /dev/null
are supported.
vhost-user requires the virtio model type, thus the
<code><model></code> element is mandatory.
+ <span class="since">Since 3.10.0</span> the element has an optional
+ attribute <code>reconnect</code> which configures reconnect timeout
+ (in seconds) if the connection is lost.
</p>
<h5><a id="elementNwfilter">Traffic filtering with NWFilter</a></h5>
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 9cec1a0..66b9758 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -2399,6 +2399,18 @@
</attribute>
</optional>
</define>
+ <define name="reconnect">
+ <element name="reconnect">
+ <attribute name="enabled">
+ <ref name="virYesNo"/>
+ </attribute>
+ <optional>
+ <attribute name="timeout">
+ <ref name="unsignedInt"/>
+ </attribute>
+ </optional>
+ </element>
+ </define>
<!--
An interface description can either be of type bridge in which case
@@ -2460,6 +2472,9 @@
<value>client</value>
</choice>
</attribute>
+ <optional>
+ <ref name="reconnect"/>
+ </optional>
<empty/>
</element>
<ref name="interface-options"/>
@@ -3708,16 +3723,7 @@
</attribute>
</optional>
<optional>
- <element name="reconnect">
- <attribute name="enabled">
- <ref name="virYesNo"/>
- </attribute>
- <optional>
- <attribute name="timeout">
- <ref name="unsignedInt"/>
- </attribute>
- </optional>
- </element>
+ <ref name="reconnect"/>
</optional>
<zeroOrMore>
<ref name='devSeclabel'/>
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index f9ae057..be3374d 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -10584,6 +10584,56 @@ virDomainNetAppendIPAddress(virDomainNetDefPtr def,
return -1;
}
+static int
+virDomainChrSourceReconnectDefParseXML(virDomainChrSourceReconnectDefPtr def,
+ xmlNodePtr node,
+ xmlXPathContextPtr ctxt)
+{
+ int ret = -1;
+ int tmpVal;
+ char *tmp = NULL;
+ xmlNodePtr saveNode = ctxt->node;
+ xmlNodePtr cur;
+
+ ctxt->node = node;
+
+ if ((cur = virXPathNode("./reconnect", ctxt))) {
+ if ((tmp = virXMLPropString(cur, "enabled"))) {
+ if ((tmpVal = virTristateBoolTypeFromString(tmp)) < 0) {
+ virReportError(VIR_ERR_XML_ERROR,
+ _("invalid reconnect enabled value: '%s'"),
+ tmp);
+ goto cleanup;
+ }
+ def->enabled = tmpVal;
+ VIR_FREE(tmp);
+ }
+
+ if (def->enabled == VIR_TRISTATE_BOOL_YES) {
+ if ((tmp = virXMLPropString(cur, "timeout"))) {
+ if (virStrToLong_ui(tmp, NULL, 10, &def->timeout) < 0) {
+ virReportError(VIR_ERR_XML_ERROR,
+ _("invalid reconnect timeout value: '%s'"),
+ tmp);
+ goto cleanup;
+ }
+ VIR_FREE(tmp);
+ } else {
+ virReportError(VIR_ERR_XML_ERROR, "%s",
+ _("missing timeout for chardev with "
+ "reconnect enabled"));
+ goto cleanup;
+ }
+ }
+ }
+
+ ret = 0;
+ cleanup:
+ ctxt->node = saveNode;
+ VIR_FREE(tmp);
+ return ret;
+}
+
/* Parse the XML definition for a network interface
* @param node XML nodeset to parse for net definition
* @return 0 on success, -1 on failure
@@ -10638,6 +10688,7 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt,
virNWFilterHashTablePtr filterparams = NULL;
virDomainActualNetDefPtr actual = NULL;
xmlNodePtr oldnode = ctxt->node;
+ virDomainChrSourceReconnectDef reconnect = {0};
int rv, val;
if (VIR_ALLOC(def) < 0)
@@ -10719,11 +10770,14 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt,
goto error;
}
} else if (!vhostuser_path && !vhostuser_mode && !vhostuser_type
- && def->type == VIR_DOMAIN_NET_TYPE_VHOSTUSER &&
- virXMLNodeNameEqual(cur, "source")) {
+ && def->type == VIR_DOMAIN_NET_TYPE_VHOSTUSER
+ && virXMLNodeNameEqual(cur, "source")) {
vhostuser_type = virXMLPropString(cur, "type");
vhostuser_path = virXMLPropString(cur, "path");
vhostuser_mode = virXMLPropString(cur, "mode");
+ if (virDomainChrSourceReconnectDefParseXML(&reconnect, cur, ctxt) < 0)
+ goto error;
+
} else if (!def->virtPortProfile
&& virXMLNodeNameEqual(cur, "virtualport")) {
if (def->type == VIR_DOMAIN_NET_TYPE_NETWORK) {
@@ -10945,8 +10999,16 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt,
if (STREQ(vhostuser_mode, "server")) {
def->data.vhostuser->data.nix.listen = true;
+ if (reconnect.enabled != VIR_TRISTATE_BOOL_ABSENT) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("'reconnect' attribute unsupported "
+ "'server' mode for <interface type='vhostuser'>"));
+ goto error;
+ }
} else if (STREQ(vhostuser_mode, "client")) {
def->data.vhostuser->data.nix.listen = false;
+ def->data.vhostuser->data.nix.reconnect.enabled = reconnect.enabled;
+ def->data.vhostuser->data.nix.reconnect.timeout = reconnect.timeout;
} else {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("Wrong <source> 'mode' attribute "
@@ -11608,57 +11670,6 @@ virDomainChrDefParseTargetXML(virDomainChrDefPtr def,
return ret;
}
-static int
-virDomainChrSourceReconnectDefParseXML(virDomainChrSourceReconnectDefPtr def,
- xmlNodePtr node,
- xmlXPathContextPtr ctxt)
-{
- int ret = -1;
- int tmpVal;
- char *tmp = NULL;
- xmlNodePtr saveNode = ctxt->node;
- xmlNodePtr cur;
-
- ctxt->node = node;
-
- if ((cur = virXPathNode("./reconnect", ctxt))) {
- if ((tmp = virXMLPropString(cur, "enabled"))) {
- if ((tmpVal = virTristateBoolTypeFromString(tmp)) < 0) {
- virReportError(VIR_ERR_XML_ERROR,
- _("invalid reconnect enabled value: '%s'"),
- tmp);
- goto cleanup;
- }
- def->enabled = tmpVal;
- VIR_FREE(tmp);
- }
-
- if (def->enabled == VIR_TRISTATE_BOOL_YES) {
- if ((tmp = virXMLPropString(cur, "timeout"))) {
- if (virStrToLong_ui(tmp, NULL, 10, &def->timeout) < 0) {
- virReportError(VIR_ERR_XML_ERROR,
- _("invalid reconnect timeout value: '%s'"),
- tmp);
- goto cleanup;
- }
- VIR_FREE(tmp);
- } else {
- virReportError(VIR_ERR_XML_ERROR, "%s",
- _("missing timeout for chardev with "
- "reconnect enabled"));
- goto cleanup;
- }
- }
- }
-
- ret = 0;
- cleanup:
- ctxt->node = saveNode;
- VIR_FREE(tmp);
- return ret;
-}
-
-
typedef enum {
VIR_DOMAIN_CHR_SOURCE_MODE_CONNECT,
VIR_DOMAIN_CHR_SOURCE_MODE_BIND,
@@ -23399,6 +23410,21 @@ virDomainVirtioNetDriverFormat(char **outstr,
return 0;
}
+static void
+virDomainChrSourceReconnectDefFormat(virBufferPtr buf,
+ virDomainChrSourceReconnectDefPtr def)
+{
+ if (def->enabled == VIR_TRISTATE_BOOL_ABSENT)
+ return;
+
+ virBufferAsprintf(buf, "<reconnect enabled='%s'",
+ virTristateBoolTypeToString(def->enabled));
+
+ if (def->enabled == VIR_TRISTATE_BOOL_YES)
+ virBufferAsprintf(buf, " timeout='%u'", def->timeout);
+
+ virBufferAddLit(buf, "/>\n");
+}
int
virDomainNetDefFormat(virBufferPtr buf,
@@ -23493,6 +23519,14 @@ virDomainNetDefFormat(virBufferPtr buf,
def->data.vhostuser->data.nix.listen ?
"server" : "client");
sourceLines++;
+ if (def->data.vhostuser->data.nix.reconnect.enabled != VIR_TRISTATE_BOOL_ABSENT) {
+ virBufferAddLit(buf, ">\n");
+ sourceLines++;
+ virBufferAdjustIndent(buf, 2);
+ virDomainChrSourceReconnectDefFormat(buf, &def->data.vhostuser->data.nix.reconnect);
+ virBufferAdjustIndent(buf, -2);
+ }
+
}
break;
@@ -23725,24 +23759,6 @@ virDomainChrAttrsDefFormat(virBufferPtr buf,
return 0;
}
-
-static void
-virDomainChrSourceReconnectDefFormat(virBufferPtr buf,
- virDomainChrSourceReconnectDefPtr def)
-{
- if (def->enabled == VIR_TRISTATE_BOOL_ABSENT)
- return;
-
- virBufferAsprintf(buf, "<reconnect enabled='%s'",
- virTristateBoolTypeToString(def->enabled));
-
- if (def->enabled == VIR_TRISTATE_BOOL_YES)
- virBufferAsprintf(buf, " timeout='%u'", def->timeout);
-
- virBufferAddLit(buf, "/>\n");
-}
-
-
static int
virDomainChrSourceDefFormat(virBufferPtr buf,
virDomainChrSourceDefPtr def,
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-net-vhostuser-multiq.args b/tests/qemuxml2argvdata/qemuxml2argv-net-vhostuser-multiq.args
index b69ebd8..f2aec7b 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-net-vhostuser-multiq.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-net-vhostuser-multiq.args
@@ -32,7 +32,11 @@ addr=0x4 \
-netdev socket,listen=:2015,id=hostnet2 \
-device rtl8139,netdev=hostnet2,id=net2,mac=52:54:00:95:db:c0,bus=pci.0,\
addr=0x5 \
--chardev socket,id=charnet3,path=/tmp/vhost2.sock \
--netdev vhost-user,chardev=charnet3,queues=4,id=hostnet3 \
--device virtio-net-pci,mq=on,vectors=10,netdev=hostnet3,id=net3,\
-mac=52:54:00:ee:96:6d,bus=pci.0,addr=0x6
+-chardev socket,id=charnet3,path=/tmp/vhost2.sock,reconnect=10 \
+-netdev vhost-user,chardev=charnet3,id=hostnet3 \
+-device virtio-net-pci,netdev=hostnet3,id=net3,\
+mac=52:54:00:ee:96:6d,bus=pci.0,addr=0x6 \
+-chardev socket,id=charnet4,path=/tmp/vhost3.sock,reconnect=0 \
+-netdev vhost-user,chardev=charnet4,queues=4,id=hostnet4 \
+-device virtio-net-pci,mq=on,vectors=10,netdev=hostnet4,id=net4,\
+mac=52:54:00:ee:96:6e,bus=pci.0,addr=0x7
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-net-vhostuser-multiq.xml b/tests/qemuxml2argvdata/qemuxml2argv-net-vhostuser-multiq.xml
index d5c42fe..a30cce6 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-net-vhostuser-multiq.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-net-vhostuser-multiq.xml
@@ -40,7 +40,16 @@
</interface>
<interface type='vhostuser'>
<mac address='52:54:00:ee:96:6d'/>
- <source type='unix' path='/tmp/vhost2.sock' mode='client'/>
+ <source type='unix' path='/tmp/vhost2.sock' mode='client'>
+ <reconnect enabled='yes' timeout='10'/>
+ </source>
+ <model type='virtio'/>
+ </interface>
+ <interface type='vhostuser'>
+ <mac address='52:54:00:ee:96:6e'/>
+ <source type='unix' path='/tmp/vhost3.sock' mode='client'>
+ <reconnect enabled='no'/>
+ </source>
<model type='virtio'/>
<driver queues='4'/>
</interface>
--
1.8.3.1
6 years, 11 months
[libvirt] [PATCH v3 1/2] remote: set neventCallbacks to zero at DEREG_CB
by xinhua.Cao
set neventCallbacks to zero after VIR_FREE(eventCallbacks) was called
---
daemon/remote.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/daemon/remote.c b/daemon/remote.c
index 07557e9..cbcb6e8 100644
--- a/daemon/remote.c
+++ b/daemon/remote.c
@@ -1686,6 +1686,7 @@ void remoteRelayConnectionClosedEvent(virConnectPtr conn ATTRIBUTE_UNUSED, int r
VIR_WARN("unexpected %s event deregister failure", name); \
} \
VIR_FREE(eventCallbacks); \
+ neventCallbacks = 0; \
} while (0);
/*
--
2.8.3
6 years, 11 months
[libvirt] bhyve: grub-bhyve: support overriding just --root flag
by Christian Schwarz
Hi,
I was trying to get a GPT-formatted VM boot on FreeBSD using the bhyve driver
and the grub-bhyve bootloader.
Turns out that libvirt 3.9.0 hardcodes the boot partition to (hd0,msdos1)
or allows overriding it completly using <bootloader_args>.
I hacked together a patch that allows overring just the --root argument to
grub-bhyve and updated the documentation:
https://github.com/problame/libvirt/commit/5fd1265c05987d907d9f1d9913dbee...
Obviously, this does not meet quality standards and should not be merged as is,
but maybe spawn some discussion (if anyone is actually using bhyve + libvirt).
Cheers,
Christian
---
commit 5fd1265c05987d907d9f1d9913dbee832a227889
Author: Christian Schwarz <me(a)cschwarz.com>
Date: Sat Nov 11 16:15:05 2017 +0100
bhyve: grub-bhyve: support overriding just the --root argument in domain config
diff --git a/docs/drvbhyve.html.in b/docs/drvbhyve.html.in
index 63260afae..2583bfa01 100644
--- a/docs/drvbhyve.html.in
+++ b/docs/drvbhyve.html.in
@@ -300,17 +300,26 @@ are omitted, libvirt will try and infer boot ordering from user-supplied
<boot order='N'> configuration in the domain. Failing that, it will boot
the first disk in the domain (either <code>cdrom</code>- or
<code>disk</code>-type devices). If the disk type is <code>disk</code>, it will
-attempt to boot from the first partition in the disk image.</p>
+attempt to boot from the first partition in the disk image, assuming
+an <code>msdos</code> partitioning scheme
+(i.e. <code>grub-bhyve --root hd0,msdos1</code>).
+You can override this behavior using <code>bootloader_args</code> or <code>bootloader_grub_root</code>.
+</p>
<pre>
...
<bootloader>/usr/local/sbin/grub-bhyve</bootloader>
+<!-- the following tag overrides all args to grub-bhyve -->
<bootloader_args>...</bootloader_args>
+<!-- the following tag overrides just the --root argument to grub-bhyve -->
+<bootloader_grub_root>hd0,gpt1</bootloader_grub_root>
...
</pre>
-<p>Caveat: <code>bootloader_args</code> does not support any quoting.
-Filenames, etc, must not have spaces or they will be tokenized incorrectly.</p>
+<p>Caveats when using <code>bootloader_args</code>: it does not support any quoting.
+Filenames, etc, must not have spaces or they will be tokenized incorrectly.
+Additionally, you will have to maintain your own <code>--device-map</code>
+file and keep it in sync with the domain XML.</p>
<h3><a id="uefi">Using UEFI bootrom, VNC, and USB tablet</a></h3>
diff --git a/src/bhyve/bhyve_command.c b/src/bhyve/bhyve_command.c
index 55032ae1d..6cab6e516 100644
--- a/src/bhyve/bhyve_command.c
+++ b/src/bhyve/bhyve_command.c
@@ -774,15 +774,21 @@ virBhyveProcessBuildGrubbhyveCmd(virDomainDefPtr def,
}
virCommandAddArg(cmd, "--root");
- if (userdef != NULL) {
- if (userdef->device == VIR_DOMAIN_DISK_DEVICE_CDROM)
+ if (def->os.bootloaderGrubRoot != NULL) {
+ virCommandAddArg(cmd, def->os.bootloaderGrubRoot);
+ } else {
+
+ if (userdef != NULL) {
+ if (userdef->device == VIR_DOMAIN_DISK_DEVICE_CDROM)
+ virCommandAddArg(cmd, "cd");
+ else
+ virCommandAddArg(cmd, "hd0,msdos1");
+ } else if (cd != NULL) {
virCommandAddArg(cmd, "cd");
- else
+ } else {
virCommandAddArg(cmd, "hd0,msdos1");
- } else if (cd != NULL) {
- virCommandAddArg(cmd, "cd");
- } else {
- virCommandAddArg(cmd, "hd0,msdos1");
+ }
+
}
virCommandAddArg(cmd, "--device-map");
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 7dfd7b54e..ecd1f71dd 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -18141,6 +18141,7 @@ virDomainDefParseXML(xmlDocPtr xml,
def->os.bootloader = virXPathString("string(./bootloader)", ctxt);
def->os.bootloaderArgs = virXPathString("string(./bootloader_args)", ctxt);
+ def->os.bootloaderGrubRoot = virXPathString("string(./bootloader_grub_root)", ctxt);
tmp = virXPathString("string(./os/type[1])", ctxt);
if (!tmp) {
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index e3f060b12..f969e9195 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1884,6 +1884,7 @@ struct _virDomainOSDef {
char *slic_table;
virDomainLoaderDefPtr loader;
char *bootloader;
+ char *bootloaderGrubRoot;
char *bootloaderArgs;
int smbios_mode;
6 years, 12 months
[libvirt] [PATCH 00/11] Make auto completion better
by Michal Privoznik
After initial RFC [1] I had some time to work on this and here is
the result.
What's implemented?
===================
Auto completion for both interactive and non-interactive
virsh/virt-admin.
Known limitations
=================
Currently, just options completers work. I mean, to bring up list
of domains you have to:
virsh # start --domain <TAB><TAB>
Doing bare:
virsh # start <TAB><TAB>
brings up list of --options. I am working on this meanwhile. But
one can argue that having to use --option is not that much of a
problem since we have good completion now.
The other known limitation - and actually room for others to join
and help - is missing completers. I mean, the last 3 patches give
an example how to do that. But that is still very few. We need
more completers.
How does this work?
===================
The basic idea is simple, when defining opts for command two new
struct members can be set:
{.name = "mac",
.type = VSH_OT_STRING,
+ .completer = virshDomainInterfaceCompleter,
+ .completer_flags = VIRSH_DOMAIN_INTERFACE_COMPLETER_MAC,
.help = N_("MAC address")
},
@completer is the callback that is used when user wants to bring
up list of possible strings. @completer_flags can then be used to
refine return value of @completer. In this specific example,
virshDomainInterfaceCompleter() brings up list of interfaces for
given domain. It tries to return /interface/target/@dev but if
not found (e.g. because domain is not running),
/interface/mac/@address is returned otherwise. However, in one
specific case we are interested only in MAC addresses (regardless
of domain state) and thus VIRSH_DOMAIN_INTERFACE_COMPLETER_MAC
flag is specified which alters @completer behaviour.
For non-interactive virsh/virt-admin there's
tools/bash-completion/vsh script which does no more than calling:
$1 complete $USER_INPUT
(where $1 is name of the binary user intents to run).
How to test this?
=================
Interactive completion should work out of the box. Just make sure
you're connected. Completers don't connect! You certainly don't
want ssh's 'Password:' prompt show on <TAB><TAB>, do you?
Non-interactive completers do connect, but in order to avoid any
password prompts, /dev/stdin is closed before anything else is
done. In order to test it, just:
libvirt.git $ source tools/bash-completion/vsh
Now, bash completion should work:
libvirt.git $ ./tools/virsh -c qemu:///system start --domain <TAB><TAB>
Notes
=====
This is that part of vsh that nobody wants to touch, but with
these patches in we have the framework to just write small
functions (as can be seen in examples). User would benefit from
this!
As usual, you can find all the patches on my github [2].
Michal
1: https://www.redhat.com/archives/libvir-list/2017-October/msg01374.html
2: https://github.com/zippy2/libvirt/tree/bash_autocomplete
Michal Privoznik (11):
vshCommandStringParse: Allow retrieving partial result
vshCommandOpt: Relax check for valid options
vsh: Add @silent to vshConnectionHook
vsh: Fix vshCompleter signature
vsh: Call vshCmdOptDef.completer properly
vshCompleter: Pass partially parsed command
vsh: Introduce complete command
tools: Provide bash autompletion file
virsh: Introduce virshDomainNameCompleter
virsh: Introduce virshDomainInterfaceCompleter
virt-admin: Introduce vshAdmServerCompleter
configure.ac | 3 +
libvirt.spec.in | 2 +
m4/virt-bash-completion.m4 | 74 ++++++++++++++++
tools/Makefile.am | 40 ++++++++-
tools/bash-completion/vsh | 73 ++++++++++++++++
tools/virsh-completer.c | 150 +++++++++++++++++++++++++++++++++
tools/virsh-completer.h | 41 +++++++++
tools/virsh-domain-monitor.c | 33 ++++----
tools/virsh-domain.c | 188 +++++++++++++++++++++--------------------
tools/virsh-snapshot.c | 24 +++---
tools/virsh.c | 72 +++++++++-------
tools/virsh.h | 12 ++-
tools/virt-admin-completer.c | 76 +++++++++++++++++
tools/virt-admin-completer.h | 33 ++++++++
tools/virt-admin.c | 62 ++++++++------
tools/vsh.c | 195 ++++++++++++++++++++++++++++++++-----------
tools/vsh.h | 23 ++++-
17 files changed, 873 insertions(+), 228 deletions(-)
create mode 100644 m4/virt-bash-completion.m4
create mode 100644 tools/bash-completion/vsh
create mode 100644 tools/virsh-completer.c
create mode 100644 tools/virsh-completer.h
create mode 100644 tools/virt-admin-completer.c
create mode 100644 tools/virt-admin-completer.h
--
2.13.6
6 years, 12 months
[libvirt] [PATCH] tests: fix TTY check in virTestUseTerminalColors()
by Pino Toscano
Since colors would be used when writing to stdout, then check that
stdout is a TTY, instead of stdin.
This avoids the usage of terminal color codes when the output is
directed to file.
---
tests/testutils.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/testutils.c b/tests/testutils.c
index 915cd3b79..9266f15e8 100644
--- a/tests/testutils.c
+++ b/tests/testutils.c
@@ -92,7 +92,7 @@ bool virTestOOMActive(void)
static int virTestUseTerminalColors(void)
{
- return isatty(STDIN_FILENO);
+ return isatty(STDOUT_FILENO);
}
static unsigned int
--
2.13.6
6 years, 12 months
[libvirt] [PATCH] numa: avoid failure in nodememstats on non-NUMA systems
by Viktor Mihajlovski
libvirt reports a fake NUMA topology in virConnectGetCapabilities
even if built without numactl support. The fake NUMA topology consists
of a single cell representing the host's cpu and memory resources.
Currently this is the case for ARM and s390[x] RPM builds.
A client iterating over NUMA cells obtained via virConnectGetCapabilities
and invoking virNodeGetMemoryStats on them will see an internal failure
"NUMA isn't available on this host". An example for such a client is
VDSM.
Since the intention seems to be that libvirt always reports at least
a single cell it is necessary to return "fake" node memory statistics
matching the previously reported fake cell in case NUMA isn't supported
on the system.
Signed-off-by: Viktor Mihajlovski <mihajlov(a)linux.vnet.ibm.com>
---
src/util/virhostmem.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/src/util/virhostmem.c b/src/util/virhostmem.c
index a9ba278..fa04a37 100644
--- a/src/util/virhostmem.c
+++ b/src/util/virhostmem.c
@@ -267,6 +267,14 @@ virHostMemGetStats(int cellNum ATTRIBUTE_UNUSED,
FILE *meminfo;
int max_node;
+ /*
+ * Even if built without numactl, libvirt claims
+ * to have a one-cells NUMA topology. In such a
+ * case return the statistics for the entire host.
+ */
+ if (!virNumaIsAvailable() && cellNum == 0)
+ cellNum = VIR_NODE_MEMORY_STATS_ALL_CELLS;
+
if (cellNum == VIR_NODE_MEMORY_STATS_ALL_CELLS) {
if (VIR_STRDUP(meminfo_path, MEMINFO_PATH) < 0)
return -1;
--
1.9.1
6 years, 12 months
[libvirt] [PATCH 0/2] vbox: Add support for 5.2.x
by Dawid Zamirski
With each minor VBOX release a new SDK header needs to be added and wired up to
the driver. This is basically the same as last time [1]. The first patch will
be sent as a compressed attachment because it's a large header file taken from
the SDK that would not pass the mailing list size constraints.
[1] https://www.redhat.com/archives/libvir-list/2016-November/msg00355.html
Dawid Zamirski (2):
vbox: Add vbox 5.2 CAPI header file.
vbox: Add support for 5.2.x
src/Makefile.am | 1 +
src/vbox/vbox_CAPI_v5_2.h | 26870 ++++++++++++++++++++++++++++++++++++++++
src/vbox/vbox_V5_2.c | 13 +
src/vbox/vbox_common.h | 2 +
src/vbox/vbox_storage.c | 2 +
src/vbox/vbox_tmpl.c | 2 +
src/vbox/vbox_uniformed_api.h | 1 +
7 files changed, 26891 insertions(+)
create mode 100644 src/vbox/vbox_CAPI_v5_2.h
create mode 100644 src/vbox/vbox_V5_2.c
--
2.14.2
6 years, 12 months