[libvirt] [PATCH 00/17] nwfilter adjustments for common object
by John Ferlan
As noted in the recently posted virObject changes:
https://www.redhat.com/archives/libvir-list/2017-June/msg00070.html
I believe I've found a way to handle the recursive lock situation that
made it "difficult" (at best) to convert the nwfilter to the common
object model. It does involve a bit of a circuitous route to "temporarily
implement" the refcnt in nwfilter, but that gets removed rather quickly.
Beyond that there's a bit of setup, the first few patches deal with
issues seen while working through this code and then more setup for
getting things to be more common with other drivers (so when they
disappear a bit further into the future) into some new object it'll
be obvious where/why they're there.
The middle few patches deal with an insane naming scheme for a single
function that seemed to keep prefixing "_" as a new function was created.
So it's a bit of name change, but makes it easier to think about.
The last 4 patches deal with the conversion to use a @ref, a change
to a list locking hash table model, the modificiation of the recursive
instantiation to use @refs rather than @locks, and finally the change
to use the existing lockable object.
I have run these through the various avacodo nwfilter tests that I could
find, but perhaps if someone that had a more "robust configuration" and
wants to be a bit adventurous and also give the patches a whirl - that
would be appreciated.
John Ferlan (17):
nwfilter: Fix return value comparison for
virNWFilterTriggerVMFilterRebuild
nwfilter: Fix possible corruption on failure path during LoadConfig
nwfilter: Fix possible locking problem in LoadConfig error path
nwfilter: Remove need for virNWFilterSaveXML
nwfilter: Move virNWFilterSaveConfig virnwfilterobj
nwfilter: Add configFile into virNWFilterObj
nwfilter: Add @def into virNWFilterObjNew
nwfilter: Clean up a couple nwfilter_driver error paths
nwfilter: Consistently name virNWFilterPtr in driver
nwfilter: Rename virNWFilterInstantiate
nwfilter: Rename __virNWFilterInstantiateFilter
nwfilter: Rename _virNWFilterInstantiateFilter
nwfilter: Introduce virNWFilterObjListFindInstantiateFilter
nwfilter: Add @refs logic to __virNWFilterObj
nwfilter: Convert _virNWFilterObjList to be a virObjectLockable
nwfilter: Remove recursive locking for nwfilter instantiation
nwfilter: Convert virNWFilterObj to use virObjectLockable
src/conf/nwfilter_conf.c | 43 ---
src/conf/nwfilter_conf.h | 9 -
src/conf/virnwfilterobj.c | 550 +++++++++++++++++++++++----------
src/conf/virnwfilterobj.h | 19 +-
src/libvirt_private.syms | 6 +-
src/nwfilter/nwfilter_driver.c | 51 ++-
src/nwfilter/nwfilter_gentech_driver.c | 276 +++++++----------
7 files changed, 542 insertions(+), 412 deletions(-)
--
2.9.4
7 years, 5 months
[libvirt] [PATCH 0/8] More virsecretobj changes to prepare for common object
by John Ferlan
A couple I forgot from earlier series, but a few things found since then
along with some clarifications to make the ObjAdd processing a bit more
like I've found for nwfilter, nodedev, and interface as well as making
the ObjListRemove processing a bit clearer and more consistent.
Along with the other series and the virObject v2 adjustments - this brings
everything close enough to start sending the patches that will tie all this
stuff together to create/use a common object model.
John Ferlan (8):
secret: Whitespace modification for secret_driver
secret: Alter FindByUUID to expect the formatted uuidstr
secret: Rename variable in virSecretObjListAdd
secret: Clean up virSecretObjListAdd processing
secret: Remove need for local configFile and base64File in ObjectAdd
secret: Have virSecretObjNew consume newdef
secret: Properly handle @def after virSecretObjAdd in driver
secret: Handle object list removal and deletion properly
src/conf/virsecretobj.c | 125 +++++++++++++++++++++------------------------
src/conf/virsecretobj.h | 2 +-
src/secret/secret_driver.c | 50 ++++++++++++------
3 files changed, 94 insertions(+), 83 deletions(-)
--
2.9.4
7 years, 5 months
[libvirt] [PATCH 0/2] qemu: Add AAVMF32 to the list of known UEFIs
by dann frazier
v2: Add a virt-aa-helper-test case.
dann frazier (2):
qemu: Add AAVMF32 to the list of known UEFIs
virt-aa-helper-test: Add test for aarch32 UEFI image path
src/qemu/qemu_conf.c | 12 ++++++++----
tests/virt-aa-helper-test | 1 +
2 files changed, 9 insertions(+), 4 deletions(-)
--
2.13.2
7 years, 5 months
[libvirt] [PATCH 1/3] leasetime support for <dhcp> globally
by aruiz@gnome.org
From: Alberto Ruiz <aruiz(a)gnome.org>
---
docs/schemas/basictypes.rng | 16 +++++
docs/schemas/network.rng | 8 +++
src/conf/network_conf.c | 78 ++++++++++++++++++++++-
src/conf/network_conf.h | 3 +-
src/network/bridge_driver.c | 49 +++++++++++++-
tests/networkxml2confdata/leasetime-days.conf | 17 +++++
tests/networkxml2confdata/leasetime-days.xml | 18 ++++++
tests/networkxml2confdata/leasetime-hours.conf | 17 +++++
tests/networkxml2confdata/leasetime-hours.xml | 18 ++++++
tests/networkxml2confdata/leasetime-infinite.conf | 17 +++++
tests/networkxml2confdata/leasetime-infinite.xml | 18 ++++++
tests/networkxml2confdata/leasetime-minutes.conf | 17 +++++
tests/networkxml2confdata/leasetime-minutes.xml | 18 ++++++
tests/networkxml2confdata/leasetime-seconds.conf | 17 +++++
tests/networkxml2confdata/leasetime-seconds.xml | 18 ++++++
tests/networkxml2confdata/leasetime.conf | 17 +++++
tests/networkxml2confdata/leasetime.xml | 18 ++++++
tests/networkxml2conftest.c | 7 ++
18 files changed, 368 insertions(+), 3 deletions(-)
create mode 100644 tests/networkxml2confdata/leasetime-days.conf
create mode 100644 tests/networkxml2confdata/leasetime-days.xml
create mode 100644 tests/networkxml2confdata/leasetime-hours.conf
create mode 100644 tests/networkxml2confdata/leasetime-hours.xml
create mode 100644 tests/networkxml2confdata/leasetime-infinite.conf
create mode 100644 tests/networkxml2confdata/leasetime-infinite.xml
create mode 100644 tests/networkxml2confdata/leasetime-minutes.conf
create mode 100644 tests/networkxml2confdata/leasetime-minutes.xml
create mode 100644 tests/networkxml2confdata/leasetime-seconds.conf
create mode 100644 tests/networkxml2confdata/leasetime-seconds.xml
create mode 100644 tests/networkxml2confdata/leasetime.conf
create mode 100644 tests/networkxml2confdata/leasetime.xml
diff --git a/docs/schemas/basictypes.rng b/docs/schemas/basictypes.rng
index 1b4f980e7..8a76c235a 100644
--- a/docs/schemas/basictypes.rng
+++ b/docs/schemas/basictypes.rng
@@ -518,4 +518,20 @@
</element>
</define>
+ <define name="leaseTimeUnit">
+ <choice>
+ <value>seconds</value>
+ <value>minutes</value>
+ <value>hours</value>
+ <value>days</value>
+ </choice>
+ </define>
+
+ <define name="leaseTime">
+ <data type="long">
+ <param name="minInclusive">-1</param>
+ <param name="maxInclusive">4294967295</param>
+ </data>
+ </define>
+
</grammar>
diff --git a/docs/schemas/network.rng b/docs/schemas/network.rng
index 1a18e64b2..4b8056ab6 100644
--- a/docs/schemas/network.rng
+++ b/docs/schemas/network.rng
@@ -340,6 +340,14 @@
<!-- Define the range(s) of IP addresses that the DHCP
server should hand out -->
<element name="dhcp">
+ <optional>
+ <element name="leasetime">
+ <optional>
+ <attribute name="unit"><ref name="leaseTimeUnit"/></attribute>
+ </optional>
+ <ref name="leaseTime"/>
+ </element>
+ </optional>
<zeroOrMore>
<element name="range">
<attribute name="start"><ref name="ipAddr"/></attribute>
diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c
index aa397768c..6f051493f 100644
--- a/src/conf/network_conf.c
+++ b/src/conf/network_conf.c
@@ -30,6 +30,8 @@
#include <fcntl.h>
#include <string.h>
#include <dirent.h>
+#include <stdlib.h>
+#include <inttypes.h>
#include "virerror.h"
#include "datatypes.h"
@@ -1031,12 +1033,82 @@ virNetworkDHCPHostDefParseXML(const char *networkName,
return ret;
}
+static int64_t
+virNetworkDHCPDefGetLeaseTime (xmlNodePtr node,
+ xmlXPathContextPtr ctxt,
+ bool *error)
+{
+ int64_t multiplier, result = -1;
+ char *leaseString, *leaseUnit;
+ xmlNodePtr save;
+
+ *error = 0;
+
+ save = ctxt->node;
+ ctxt->node = node;
+
+ leaseString = virXPathString ("string(./leasetime/text())", ctxt);
+ leaseUnit = virXPathString ("string(./leasetime/@unit)", ctxt);
+
+ /* If value is not present we set the value to -2 */
+ if (leaseString == NULL) {
+ result = -2;
+ goto cleanup;
+ }
+
+ if (leaseUnit == NULL || strcmp (leaseUnit, "seconds") == 0)
+ multiplier = 1;
+ else if (strcmp (leaseUnit, "minutes") == 0)
+ multiplier = 60;
+ else if (strcmp (leaseUnit, "hours") == 0)
+ multiplier = 60 * 60;
+ else if (strcmp (leaseUnit, "days") == 0)
+ multiplier = 60 * 60 * 24;
+ else {
+ virReportError(VIR_ERR_XML_ERROR,
+ _("invalid value for unit parameter in <leasetime> element found in <dhcp> network, "
+ "only 'seconds', 'minutes', 'hours' or 'days' are valid: %s"),
+ leaseUnit);
+ *error = 1;
+ goto cleanup;
+ }
+
+ errno = 0;
+ result = (int64_t) strtoll((const char*)leaseString, NULL, 10);
+
+ /* Report any errors parsing the string */
+ if (errno != 0) {
+ virReportError(VIR_ERR_XML_ERROR,
+ _("<leasetime> value could not be converted to a signed integer: %s"),
+ leaseString);
+ *error = 1;
+ goto cleanup;
+ }
+
+ result = result * multiplier;
+
+ if (result > UINT32_MAX) {
+ virReportError(VIR_ERR_XML_ERROR,
+ _("<leasetime> value cannot be greater than the equivalent of %" PRIo32 " seconds : %" PRId64),
+ UINT32_MAX, result);
+ *error = 1;
+ }
+
+cleanup:
+ VIR_FREE(leaseString);
+ VIR_FREE(leaseUnit);
+ ctxt->node = save;
+ return result;
+}
+
static int
virNetworkDHCPDefParseXML(const char *networkName,
xmlNodePtr node,
+ xmlXPathContextPtr ctxt,
virNetworkIPDefPtr def)
{
int ret = -1;
+ bool error;
xmlNodePtr cur;
virSocketAddrRange range;
virNetworkDHCPHostDef host;
@@ -1044,6 +1116,10 @@ virNetworkDHCPDefParseXML(const char *networkName,
memset(&range, 0, sizeof(range));
memset(&host, 0, sizeof(host));
+ def->leasetime = virNetworkDHCPDefGetLeaseTime (node, ctxt, &error);
+ if (error)
+ goto cleanup;
+
cur = node->children;
while (cur != NULL) {
if (cur->type == XML_ELEMENT_NODE &&
@@ -1607,7 +1683,7 @@ virNetworkIPDefParseXML(const char *networkName,
while (cur != NULL) {
if (cur->type == XML_ELEMENT_NODE &&
xmlStrEqual(cur->name, BAD_CAST "dhcp")) {
- if (virNetworkDHCPDefParseXML(networkName, cur, def) < 0)
+ if (virNetworkDHCPDefParseXML(networkName, cur, ctxt, def) < 0)
goto cleanup;
} else if (cur->type == XML_ELEMENT_NODE &&
xmlStrEqual(cur->name, BAD_CAST "tftp")) {
diff --git a/src/conf/network_conf.h b/src/conf/network_conf.h
index 3b227db6f..f7557f581 100644
--- a/src/conf/network_conf.h
+++ b/src/conf/network_conf.h
@@ -170,7 +170,8 @@ struct _virNetworkIPDef {
char *tftproot;
char *bootfile;
virSocketAddr bootserver;
- };
+ int64_t leasetime;
+};
typedef struct _virNetworkForwardIfDef virNetworkForwardIfDef;
typedef virNetworkForwardIfDef *virNetworkForwardIfDefPtr;
diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index 7b99acafa..e51e469c8 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -41,6 +41,8 @@
#include <sys/ioctl.h>
#include <net/if.h>
#include <dirent.h>
+#include <inttypes.h>
+#include <stdint.h>
#if HAVE_SYS_SYSCTL_H
# include <sys/sysctl.h>
#endif
@@ -903,6 +905,40 @@ networkBuildDnsmasqHostsList(dnsmasqContext *dctx,
return 0;
}
+/* translates the leasetime value into a dnsmasq configuration string for dhcp-range/host */
+static char *
+networkDnsmasqConfLeaseValueToString (int64_t leasetime)
+{
+ char *result = NULL;
+ virBuffer leasebuf = VIR_BUFFER_INITIALIZER;
+
+ /* Leasetime parameter set on the XML */
+ /* Less than -1 means there was no value set */
+ if (leasetime < -1) {
+ virBufferAsprintf(&leasebuf, "%s", "");
+ }
+ /* -1 means no expiration */
+ else if (leasetime == -1)
+ virBufferAsprintf(&leasebuf, ",infinite");
+ /* Minimum expiry value is 120 */
+ /* TODO: Discuss if we should up as we do here or just forward whatever value to dnsmasq */
+ else if (leasetime < 120)
+ virBufferAsprintf(&leasebuf, ",120");
+ /* DHCP value for lease time is a unsigned four octect integer */
+ else if (leasetime <= UINT32_MAX)
+ virBufferAsprintf(&leasebuf, ",%" PRId64, leasetime);
+ /* TODO: Discuss the use of "deprecated" for ipv6*/
+ /* TODO: Discuss what is the default value that we want as dnsmasq's is 1 hour */
+ /* TODO: Discuss what to do if value exceeds maximum, use default value for now */
+ else {
+ virBufferAsprintf(&leasebuf, "%s", "");
+ }
+
+ result = virBufferContentAndReset(&leasebuf);
+ virBufferFreeAndReset (&leasebuf);
+
+ return result;
+}
int
networkDnsmasqConfContents(virNetworkObjPtr network,
@@ -1213,6 +1249,7 @@ networkDnsmasqConfContents(virNetworkObjPtr network,
}
for (r = 0; r < ipdef->nranges; r++) {
int thisRange;
+ char *leasestr;
if (!(saddr = virSocketAddrFormat(&ipdef->ranges[r].start)) ||
!(eaddr = virSocketAddrFormat(&ipdef->ranges[r].end)))
@@ -1220,12 +1257,22 @@ networkDnsmasqConfContents(virNetworkObjPtr network,
virBufferAsprintf(&configbuf, "dhcp-range=%s,%s",
saddr, eaddr);
- if (VIR_SOCKET_ADDR_IS_FAMILY(&ipdef->address, AF_INET6))
+
+ /* Add ipv6 prefix length parameter if needed */
+ if (ipdef == ipv6def)
virBufferAsprintf(&configbuf, ",%d", prefix);
+
+ leasestr = networkDnsmasqConfLeaseValueToString (ipdef->leasetime);
+ if (!leasestr)
+ goto cleanup;
+ virBufferAsprintf(&configbuf, "%s", leasestr);
+
+ /* Add the newline */
virBufferAddLit(&configbuf, "\n");
VIR_FREE(saddr);
VIR_FREE(eaddr);
+ VIR_FREE(leasestr);
thisRange = virSocketAddrGetRange(&ipdef->ranges[r].start,
&ipdef->ranges[r].end,
&ipdef->address,
diff --git a/tests/networkxml2confdata/leasetime-days.conf b/tests/networkxml2confdata/leasetime-days.conf
new file mode 100644
index 000000000..9501e2f8a
--- /dev/null
+++ b/tests/networkxml2confdata/leasetime-days.conf
@@ -0,0 +1,17 @@
+##WARNING: THIS IS AN AUTO-GENERATED FILE. CHANGES TO IT ARE LIKELY TO BE
+##OVERWRITTEN AND LOST. Changes to this configuration should be made using:
+## virsh net-edit default
+## or other application using the libvirt API.
+##
+## dnsmasq conf file created by libvirt
+strict-order
+except-interface=lo
+bind-dynamic
+interface=virbr0
+dhcp-range=192.168.122.2,192.168.122.254,86400
+dhcp-no-override
+dhcp-range=2001:db8:ac10:fd01::1:10,2001:db8:ac10:fd01::1:ff,64,86400
+dhcp-lease-max=493
+dhcp-hostsfile=/var/lib/libvirt/dnsmasq/default.hostsfile
+addn-hosts=/var/lib/libvirt/dnsmasq/default.addnhosts
+enable-ra
diff --git a/tests/networkxml2confdata/leasetime-days.xml b/tests/networkxml2confdata/leasetime-days.xml
new file mode 100644
index 000000000..b990b4d68
--- /dev/null
+++ b/tests/networkxml2confdata/leasetime-days.xml
@@ -0,0 +1,18 @@
+<network>
+ <name>default</name>
+ <uuid>81ff0d90-c91e-6742-64da-4a736edb9a9b</uuid>
+ <forward dev='eth1' mode='nat'/>
+ <bridge name='virbr0' stp='on' delay='0'/>
+ <ip address='192.168.122.1' netmask='255.255.255.0'>
+ <dhcp>
+ <leasetime unit="days">1</leasetime>
+ <range start='192.168.122.2' end='192.168.122.254'/>
+ </dhcp>
+ </ip>
+ <ip family='ipv6' address='2001:db8:ac10:fd01::1' prefix='64'>
+ <dhcp>
+ <leasetime unit="days">1</leasetime>
+ <range start='2001:db8:ac10:fd01::1:10' end='2001:db8:ac10:fd01::1:ff'/>
+ </dhcp>
+ </ip>
+</network>
diff --git a/tests/networkxml2confdata/leasetime-hours.conf b/tests/networkxml2confdata/leasetime-hours.conf
new file mode 100644
index 000000000..021a769bc
--- /dev/null
+++ b/tests/networkxml2confdata/leasetime-hours.conf
@@ -0,0 +1,17 @@
+##WARNING: THIS IS AN AUTO-GENERATED FILE. CHANGES TO IT ARE LIKELY TO BE
+##OVERWRITTEN AND LOST. Changes to this configuration should be made using:
+## virsh net-edit default
+## or other application using the libvirt API.
+##
+## dnsmasq conf file created by libvirt
+strict-order
+except-interface=lo
+bind-dynamic
+interface=virbr0
+dhcp-range=192.168.122.2,192.168.122.254,3600
+dhcp-no-override
+dhcp-range=2001:db8:ac10:fd01::1:10,2001:db8:ac10:fd01::1:ff,64,3600
+dhcp-lease-max=493
+dhcp-hostsfile=/var/lib/libvirt/dnsmasq/default.hostsfile
+addn-hosts=/var/lib/libvirt/dnsmasq/default.addnhosts
+enable-ra
diff --git a/tests/networkxml2confdata/leasetime-hours.xml b/tests/networkxml2confdata/leasetime-hours.xml
new file mode 100644
index 000000000..3b9609601
--- /dev/null
+++ b/tests/networkxml2confdata/leasetime-hours.xml
@@ -0,0 +1,18 @@
+<network>
+ <name>default</name>
+ <uuid>81ff0d90-c91e-6742-64da-4a736edb9a9b</uuid>
+ <forward dev='eth1' mode='nat'/>
+ <bridge name='virbr0' stp='on' delay='0'/>
+ <ip address='192.168.122.1' netmask='255.255.255.0'>
+ <dhcp>
+ <leasetime unit="hours">1</leasetime>
+ <range start='192.168.122.2' end='192.168.122.254'/>
+ </dhcp>
+ </ip>
+ <ip family='ipv6' address='2001:db8:ac10:fd01::1' prefix='64'>
+ <dhcp>
+ <leasetime unit="hours">1</leasetime>
+ <range start='2001:db8:ac10:fd01::1:10' end='2001:db8:ac10:fd01::1:ff'/>
+ </dhcp>
+ </ip>
+</network>
diff --git a/tests/networkxml2confdata/leasetime-infinite.conf b/tests/networkxml2confdata/leasetime-infinite.conf
new file mode 100644
index 000000000..cc21135de
--- /dev/null
+++ b/tests/networkxml2confdata/leasetime-infinite.conf
@@ -0,0 +1,17 @@
+##WARNING: THIS IS AN AUTO-GENERATED FILE. CHANGES TO IT ARE LIKELY TO BE
+##OVERWRITTEN AND LOST. Changes to this configuration should be made using:
+## virsh net-edit default
+## or other application using the libvirt API.
+##
+## dnsmasq conf file created by libvirt
+strict-order
+except-interface=lo
+bind-dynamic
+interface=virbr0
+dhcp-range=192.168.122.2,192.168.122.254,infinite
+dhcp-no-override
+dhcp-range=2001:db8:ac10:fd01::1:10,2001:db8:ac10:fd01::1:ff,64,infinite
+dhcp-lease-max=493
+dhcp-hostsfile=/var/lib/libvirt/dnsmasq/default.hostsfile
+addn-hosts=/var/lib/libvirt/dnsmasq/default.addnhosts
+enable-ra
diff --git a/tests/networkxml2confdata/leasetime-infinite.xml b/tests/networkxml2confdata/leasetime-infinite.xml
new file mode 100644
index 000000000..bc8740ee6
--- /dev/null
+++ b/tests/networkxml2confdata/leasetime-infinite.xml
@@ -0,0 +1,18 @@
+<network>
+ <name>default</name>
+ <uuid>81ff0d90-c91e-6742-64da-4a736edb9a9b</uuid>
+ <forward dev='eth1' mode='nat'/>
+ <bridge name='virbr0' stp='on' delay='0'/>
+ <ip address='192.168.122.1' netmask='255.255.255.0'>
+ <dhcp>
+ <leasetime>-1</leasetime>
+ <range start='192.168.122.2' end='192.168.122.254'/>
+ </dhcp>
+ </ip>
+ <ip family='ipv6' address='2001:db8:ac10:fd01::1' prefix='64'>
+ <dhcp>
+ <leasetime>-1</leasetime>
+ <range start='2001:db8:ac10:fd01::1:10' end='2001:db8:ac10:fd01::1:ff'/>
+ </dhcp>
+ </ip>
+</network>
diff --git a/tests/networkxml2confdata/leasetime-minutes.conf b/tests/networkxml2confdata/leasetime-minutes.conf
new file mode 100644
index 000000000..db688951b
--- /dev/null
+++ b/tests/networkxml2confdata/leasetime-minutes.conf
@@ -0,0 +1,17 @@
+##WARNING: THIS IS AN AUTO-GENERATED FILE. CHANGES TO IT ARE LIKELY TO BE
+##OVERWRITTEN AND LOST. Changes to this configuration should be made using:
+## virsh net-edit default
+## or other application using the libvirt API.
+##
+## dnsmasq conf file created by libvirt
+strict-order
+except-interface=lo
+bind-dynamic
+interface=virbr0
+dhcp-range=192.168.122.2,192.168.122.254,300
+dhcp-no-override
+dhcp-range=2001:db8:ac10:fd01::1:10,2001:db8:ac10:fd01::1:ff,64,300
+dhcp-lease-max=493
+dhcp-hostsfile=/var/lib/libvirt/dnsmasq/default.hostsfile
+addn-hosts=/var/lib/libvirt/dnsmasq/default.addnhosts
+enable-ra
diff --git a/tests/networkxml2confdata/leasetime-minutes.xml b/tests/networkxml2confdata/leasetime-minutes.xml
new file mode 100644
index 000000000..e7a27afe6
--- /dev/null
+++ b/tests/networkxml2confdata/leasetime-minutes.xml
@@ -0,0 +1,18 @@
+<network>
+ <name>default</name>
+ <uuid>81ff0d90-c91e-6742-64da-4a736edb9a9b</uuid>
+ <forward dev='eth1' mode='nat'/>
+ <bridge name='virbr0' stp='on' delay='0'/>
+ <ip address='192.168.122.1' netmask='255.255.255.0'>
+ <dhcp>
+ <leasetime unit="minutes">5</leasetime>
+ <range start='192.168.122.2' end='192.168.122.254'/>
+ </dhcp>
+ </ip>
+ <ip family='ipv6' address='2001:db8:ac10:fd01::1' prefix='64'>
+ <dhcp>
+ <leasetime unit="minutes">5</leasetime>
+ <range start='2001:db8:ac10:fd01::1:10' end='2001:db8:ac10:fd01::1:ff'/>
+ </dhcp>
+ </ip>
+</network>
diff --git a/tests/networkxml2confdata/leasetime-seconds.conf b/tests/networkxml2confdata/leasetime-seconds.conf
new file mode 100644
index 000000000..635896b29
--- /dev/null
+++ b/tests/networkxml2confdata/leasetime-seconds.conf
@@ -0,0 +1,17 @@
+##WARNING: THIS IS AN AUTO-GENERATED FILE. CHANGES TO IT ARE LIKELY TO BE
+##OVERWRITTEN AND LOST. Changes to this configuration should be made using:
+## virsh net-edit default
+## or other application using the libvirt API.
+##
+## dnsmasq conf file created by libvirt
+strict-order
+except-interface=lo
+bind-dynamic
+interface=virbr0
+dhcp-range=192.168.122.2,192.168.122.254,125
+dhcp-no-override
+dhcp-range=2001:db8:ac10:fd01::1:10,2001:db8:ac10:fd01::1:ff,64,125
+dhcp-lease-max=493
+dhcp-hostsfile=/var/lib/libvirt/dnsmasq/default.hostsfile
+addn-hosts=/var/lib/libvirt/dnsmasq/default.addnhosts
+enable-ra
diff --git a/tests/networkxml2confdata/leasetime-seconds.xml b/tests/networkxml2confdata/leasetime-seconds.xml
new file mode 100644
index 000000000..56b07f8ae
--- /dev/null
+++ b/tests/networkxml2confdata/leasetime-seconds.xml
@@ -0,0 +1,18 @@
+<network>
+ <name>default</name>
+ <uuid>81ff0d90-c91e-6742-64da-4a736edb9a9b</uuid>
+ <forward dev='eth1' mode='nat'/>
+ <bridge name='virbr0' stp='on' delay='0'/>
+ <ip address='192.168.122.1' netmask='255.255.255.0'>
+ <dhcp>
+ <leasetime unit="seconds">125</leasetime>
+ <range start='192.168.122.2' end='192.168.122.254'/>
+ </dhcp>
+ </ip>
+ <ip family='ipv6' address='2001:db8:ac10:fd01::1' prefix='64'>
+ <dhcp>
+ <leasetime unit="seconds">125</leasetime>
+ <range start='2001:db8:ac10:fd01::1:10' end='2001:db8:ac10:fd01::1:ff'/>
+ </dhcp>
+ </ip>
+</network>
diff --git a/tests/networkxml2confdata/leasetime.conf b/tests/networkxml2confdata/leasetime.conf
new file mode 100644
index 000000000..72a2f6926
--- /dev/null
+++ b/tests/networkxml2confdata/leasetime.conf
@@ -0,0 +1,17 @@
+##WARNING: THIS IS AN AUTO-GENERATED FILE. CHANGES TO IT ARE LIKELY TO BE
+##OVERWRITTEN AND LOST. Changes to this configuration should be made using:
+## virsh net-edit default
+## or other application using the libvirt API.
+##
+## dnsmasq conf file created by libvirt
+strict-order
+except-interface=lo
+bind-dynamic
+interface=virbr0
+dhcp-range=192.168.122.2,192.168.122.254,122
+dhcp-no-override
+dhcp-range=2001:db8:ac10:fd01::1:10,2001:db8:ac10:fd01::1:ff,64,121
+dhcp-lease-max=493
+dhcp-hostsfile=/var/lib/libvirt/dnsmasq/default.hostsfile
+addn-hosts=/var/lib/libvirt/dnsmasq/default.addnhosts
+enable-ra
diff --git a/tests/networkxml2confdata/leasetime.xml b/tests/networkxml2confdata/leasetime.xml
new file mode 100644
index 000000000..fdbb15fc0
--- /dev/null
+++ b/tests/networkxml2confdata/leasetime.xml
@@ -0,0 +1,18 @@
+<network>
+ <name>default</name>
+ <uuid>81ff0d90-c91e-6742-64da-4a736edb9a9b</uuid>
+ <forward dev='eth1' mode='nat'/>
+ <bridge name='virbr0' stp='on' delay='0'/>
+ <ip address='192.168.122.1' netmask='255.255.255.0'>
+ <dhcp>
+ <leasetime>122</leasetime>
+ <range start='192.168.122.2' end='192.168.122.254'/>
+ </dhcp>
+ </ip>
+ <ip family='ipv6' address='2001:db8:ac10:fd01::1' prefix='64'>
+ <dhcp>
+ <leasetime>121</leasetime>
+ <range start='2001:db8:ac10:fd01::1:10' end='2001:db8:ac10:fd01::1:ff'/>
+ </dhcp>
+ </ip>
+</network>
diff --git a/tests/networkxml2conftest.c b/tests/networkxml2conftest.c
index 65a0e3218..223a56f54 100644
--- a/tests/networkxml2conftest.c
+++ b/tests/networkxml2conftest.c
@@ -129,6 +129,13 @@ mymain(void)
DO_TEST("dhcp6-network", dhcpv6);
DO_TEST("dhcp6-nat-network", dhcpv6);
DO_TEST("dhcp6host-routed-network", dhcpv6);
+ DO_TEST("leasetime", dhcpv6);
+ DO_TEST("leasetime-seconds", dhcpv6);
+ DO_TEST("leasetime-hours", dhcpv6);
+ DO_TEST("leasetime-minutes", dhcpv6);
+ DO_TEST("leasetime-hours", dhcpv6);
+ DO_TEST("leasetime-days", dhcpv6);
+ DO_TEST("leasetime-infinite", dhcpv6);
virObjectUnref(dhcpv6);
virObjectUnref(full);
--
2.13.0
7 years, 5 months
[libvirt] [PATCH] cpu_x86: Properly disable unknown CPU features
by Jiri Denemark
CPU features unknown to a hypervisor will not be present in dataDisabled
even though the feature won't naturally be enabled because it is
unknown. Thus any features we asked for which are not in dataEnabled
should be considered disabled.
Signed-off-by: Jiri Denemark <jdenemar(a)redhat.com>
---
src/cpu/cpu_x86.c | 9 +-
tests/cputest.c | 1 +
.../x86_64-cpuid-Core-i7-5600U-arat-disabled.xml | 5 +
.../x86_64-cpuid-Core-i7-5600U-arat-enabled.xml | 8 +
.../x86_64-cpuid-Core-i7-5600U-arat-guest.xml | 29 +++
.../x86_64-cpuid-Core-i7-5600U-arat-host.xml | 30 +++
.../x86_64-cpuid-Core-i7-5600U-arat-json.xml | 14 ++
.../x86_64-cpuid-Core-i7-5600U-arat.json | 202 +++++++++++++++++++++
.../x86_64-cpuid-Core-i7-5600U-arat.xml | 41 +++++
9 files changed, 335 insertions(+), 4 deletions(-)
create mode 100644 tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat-disabled.xml
create mode 100644 tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat-enabled.xml
create mode 100644 tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat-guest.xml
create mode 100644 tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat-host.xml
create mode 100644 tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat-json.xml
create mode 100644 tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat.json
create mode 100644 tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat.xml
diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
index 53359ff9b..286445421 100644
--- a/src/cpu/cpu_x86.c
+++ b/src/cpu/cpu_x86.c
@@ -2664,12 +2664,11 @@ virCPUx86UpdateLive(virCPUDefPtr cpu,
x86DataCopy(&disabled, &dataDisabled->data.x86) < 0)
goto cleanup;
- x86DataSubtract(&enabled, &model->data);
-
for (i = 0; i < map->nfeatures; i++) {
virCPUx86FeaturePtr feature = map->features[i];
- if (x86DataIsSubset(&enabled, &feature->data)) {
+ if (x86DataIsSubset(&enabled, &feature->data) &&
+ !x86DataIsSubset(&model->data, &feature->data)) {
VIR_DEBUG("Feature '%s' enabled by the hypervisor", feature->name);
if (cpu->check == VIR_CPU_CHECK_FULL)
virBufferAsprintf(&bufAdded, "%s,", feature->name);
@@ -2678,7 +2677,9 @@ virCPUx86UpdateLive(virCPUDefPtr cpu,
goto cleanup;
}
- if (x86DataIsSubset(&disabled, &feature->data)) {
+ if (x86DataIsSubset(&disabled, &feature->data) ||
+ (x86DataIsSubset(&model->data, &feature->data) &&
+ !x86DataIsSubset(&enabled, &feature->data))) {
VIR_DEBUG("Feature '%s' disabled by the hypervisor", feature->name);
if (cpu->check == VIR_CPU_CHECK_FULL)
virBufferAsprintf(&bufRemoved, "%s,", feature->name);
diff --git a/tests/cputest.c b/tests/cputest.c
index 89c645e64..ebcade6be 100644
--- a/tests/cputest.c
+++ b/tests/cputest.c
@@ -991,6 +991,7 @@ mymain(void)
DO_TEST_CPUID(VIR_ARCH_X86_64, "Core-i7-4600U", true);
DO_TEST_CPUID(VIR_ARCH_X86_64, "Core-i7-4510U", true);
DO_TEST_CPUID(VIR_ARCH_X86_64, "Core-i7-5600U", true);
+ DO_TEST_CPUID(VIR_ARCH_X86_64, "Core-i7-5600U-arat", true);
DO_TEST_CPUID(VIR_ARCH_X86_64, "Core2-E6850", true);
DO_TEST_CPUID(VIR_ARCH_X86_64, "Core2-Q9500", false);
DO_TEST_CPUID(VIR_ARCH_X86_64, "FX-8150", false);
diff --git a/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat-disabled.xml b/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat-disabled.xml
new file mode 100644
index 000000000..4a0477f78
--- /dev/null
+++ b/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat-disabled.xml
@@ -0,0 +1,5 @@
+<!-- Features disabled by QEMU -->
+<cpudata arch='x86'>
+ <cpuid eax_in='0x00000001' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x0800c1dc' edx='0xb0600000'/>
+ <cpuid eax_in='0x80000007' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000000' edx='0x00000100'/>
+</cpudata>
diff --git a/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat-enabled.xml b/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat-enabled.xml
new file mode 100644
index 000000000..5cffacef5
--- /dev/null
+++ b/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat-enabled.xml
@@ -0,0 +1,8 @@
+<!-- Features enabled by QEMU -->
+<cpudata arch='x86'>
+ <cpuid eax_in='0x00000001' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0xf7fa3223' edx='0x0f8bfbff'/>
+ <cpuid eax_in='0x00000007' ecx_in='0x00' eax='0x00000000' ebx='0x001c0fbb' ecx='0x00000000' edx='0x00000000'/>
+ <cpuid eax_in='0x0000000d' ecx_in='0x01' eax='0x00000001' ebx='0x00000000' ecx='0x00000000' edx='0x00000000'/>
+ <cpuid eax_in='0x40000001' ecx_in='0x00' eax='0x010000fa' ebx='0x00000000' ecx='0x00000000' edx='0x00000000'/>
+ <cpuid eax_in='0x80000001' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000121' edx='0x2c100800'/>
+</cpudata>
diff --git a/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat-guest.xml b/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat-guest.xml
new file mode 100644
index 000000000..877895cf1
--- /dev/null
+++ b/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat-guest.xml
@@ -0,0 +1,29 @@
+<cpu mode='custom' match='exact'>
+ <model fallback='forbid'>Broadwell</model>
+ <vendor>Intel</vendor>
+ <feature policy='require' name='vme'/>
+ <feature policy='require' name='ds'/>
+ <feature policy='require' name='acpi'/>
+ <feature policy='require' name='ss'/>
+ <feature policy='require' name='ht'/>
+ <feature policy='require' name='tm'/>
+ <feature policy='require' name='pbe'/>
+ <feature policy='require' name='dtes64'/>
+ <feature policy='require' name='monitor'/>
+ <feature policy='require' name='ds_cpl'/>
+ <feature policy='require' name='vmx'/>
+ <feature policy='require' name='smx'/>
+ <feature policy='require' name='est'/>
+ <feature policy='require' name='tm2'/>
+ <feature policy='require' name='xtpr'/>
+ <feature policy='require' name='pdcm'/>
+ <feature policy='require' name='osxsave'/>
+ <feature policy='require' name='f16c'/>
+ <feature policy='require' name='rdrand'/>
+ <feature policy='require' name='arat'/>
+ <feature policy='require' name='tsc_adjust'/>
+ <feature policy='require' name='xsaveopt'/>
+ <feature policy='require' name='pdpe1gb'/>
+ <feature policy='require' name='abm'/>
+ <feature policy='require' name='invtsc'/>
+</cpu>
diff --git a/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat-host.xml b/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat-host.xml
new file mode 100644
index 000000000..9b24941e0
--- /dev/null
+++ b/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat-host.xml
@@ -0,0 +1,30 @@
+<cpu>
+ <arch>x86_64</arch>
+ <model>Broadwell</model>
+ <vendor>Intel</vendor>
+ <feature name='vme'/>
+ <feature name='ds'/>
+ <feature name='acpi'/>
+ <feature name='ss'/>
+ <feature name='ht'/>
+ <feature name='tm'/>
+ <feature name='pbe'/>
+ <feature name='dtes64'/>
+ <feature name='monitor'/>
+ <feature name='ds_cpl'/>
+ <feature name='vmx'/>
+ <feature name='smx'/>
+ <feature name='est'/>
+ <feature name='tm2'/>
+ <feature name='xtpr'/>
+ <feature name='pdcm'/>
+ <feature name='osxsave'/>
+ <feature name='f16c'/>
+ <feature name='rdrand'/>
+ <feature name='arat'/>
+ <feature name='tsc_adjust'/>
+ <feature name='xsaveopt'/>
+ <feature name='pdpe1gb'/>
+ <feature name='abm'/>
+ <feature name='invtsc'/>
+</cpu>
diff --git a/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat-json.xml b/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat-json.xml
new file mode 100644
index 000000000..4f253fc08
--- /dev/null
+++ b/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat-json.xml
@@ -0,0 +1,14 @@
+<cpu mode='custom' match='exact'>
+ <model fallback='forbid'>Broadwell</model>
+ <vendor>Intel</vendor>
+ <feature policy='require' name='vme'/>
+ <feature policy='require' name='ss'/>
+ <feature policy='require' name='vmx'/>
+ <feature policy='require' name='f16c'/>
+ <feature policy='require' name='rdrand'/>
+ <feature policy='require' name='hypervisor'/>
+ <feature policy='require' name='tsc_adjust'/>
+ <feature policy='require' name='xsaveopt'/>
+ <feature policy='require' name='pdpe1gb'/>
+ <feature policy='require' name='abm'/>
+</cpu>
diff --git a/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat.json b/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat.json
new file mode 100644
index 000000000..f2aa7f318
--- /dev/null
+++ b/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat.json
@@ -0,0 +1,202 @@
+{
+ "return": {
+ "model": {
+ "name": "base",
+ "props": {
+ "pfthreshold": false,
+ "pku": false,
+ "rtm": true,
+ "tsc_adjust": true,
+ "tsc-deadline": true,
+ "xstore-en": false,
+ "tsc-scale": false,
+ "sse": true,
+ "smap": true,
+ "stepping": 4,
+ "tce": false,
+ "kvm_steal_time": true,
+ "smep": true,
+ "rdpid": false,
+ "xcrypt": false,
+ "sse4_2": true,
+ "monitor": false,
+ "sse4_1": true,
+ "kvm-mmu": false,
+ "flushbyasid": false,
+ "kvm-steal-time": true,
+ "lm": true,
+ "tsc": true,
+ "adx": true,
+ "fxsr": true,
+ "sha-ni": false,
+ "tm": false,
+ "pclmuldq": true,
+ "xgetbv1": false,
+ "xstore": false,
+ "vmcb_clean": false,
+ "vme": true,
+ "vendor": "GenuineIntel",
+ "ffxsr": false,
+ "de": true,
+ "avx512f": false,
+ "pse": true,
+ "ds-cpl": false,
+ "tbm": false,
+ "ia64": false,
+ "phe-en": false,
+ "f16c": true,
+ "ds": false,
+ "mpx": false,
+ "tsc-adjust": true,
+ "aes": true,
+ "avx2": true,
+ "pbe": false,
+ "cx16": true,
+ "ds_cpl": false,
+ "movbe": true,
+ "perfctr-nb": false,
+ "nrip_save": false,
+ "kvm_mmu": false,
+ "ospke": false,
+ "avx512ifma": false,
+ "vmx": true,
+ "sep": true,
+ "xsaveopt": true,
+ "sse4a": false,
+ "avx512dq": false,
+ "i64": true,
+ "avx512-4vnniw": false,
+ "xsave": true,
+ "erms": true,
+ "hle": true,
+ "nodeid_msr": false,
+ "est": false,
+ "svm_lock": false,
+ "xop": false,
+ "model-id": "Intel(R) Core(TM) i7-5600U CPU @ 2.60GHz",
+ "abm": true,
+ "avx512er": false,
+ "sse4.1": true,
+ "sse4.2": true,
+ "pause-filter": false,
+ "lahf-lm": true,
+ "kvm-nopiodelay": true,
+ "cmp_legacy": false,
+ "acpi": false,
+ "fma4": false,
+ "popcnt": true,
+ "mmx": true,
+ "osxsave": false,
+ "pcommit": false,
+ "avx512pf": false,
+ "clwb": false,
+ "dca": false,
+ "pdcm": false,
+ "xcrypt-en": false,
+ "3dnow": false,
+ "invtsc": false,
+ "tm2": false,
+ "hypervisor": true,
+ "kvmclock-stable-bit": true,
+ "fxsr-opt": false,
+ "pcid": true,
+ "sse4-1": true,
+ "sse4-2": true,
+ "avx512-vpopcntdq": false,
+ "avx512-4fmaps": false,
+ "pause_filter": false,
+ "svm-lock": false,
+ "rdrand": true,
+ "nrip-save": false,
+ "avx512vl": false,
+ "x2apic": true,
+ "kvmclock": true,
+ "pge": true,
+ "family": 6,
+ "dtes64": false,
+ "xd": true,
+ "kvm_pv_eoi": true,
+ "ace2": false,
+ "kvm_pv_unhalt": true,
+ "xtpr": false,
+ "perfctr_nb": false,
+ "avx512bw": false,
+ "nx": true,
+ "lwp": false,
+ "msr": true,
+ "ace2-en": false,
+ "decodeassists": false,
+ "perfctr-core": false,
+ "pn": false,
+ "fma": true,
+ "nodeid-msr": false,
+ "kvm_asyncpf": true,
+ "clflush": true,
+ "cx8": true,
+ "mce": true,
+ "avx512cd": false,
+ "cr8legacy": false,
+ "mca": true,
+ "pni": true,
+ "rdseed": true,
+ "apic": true,
+ "fsgsbase": true,
+ "cmp-legacy": false,
+ "kvm-pv-unhalt": true,
+ "rdtscp": true,
+ "mmxext": false,
+ "cid": false,
+ "ssse3": true,
+ "extapic": false,
+ "pse36": true,
+ "mtrr": true,
+ "ibs": false,
+ "la57": false,
+ "avx": true,
+ "syscall": true,
+ "umip": false,
+ "invpcid": true,
+ "avx512vbmi": false,
+ "kvm-asyncpf": true,
+ "vmcb-clean": false,
+ "pmm": false,
+ "cmov": true,
+ "perfctr_core": false,
+ "misalignsse": false,
+ "clflushopt": false,
+ "pat": true,
+ "lbrv": false,
+ "3dnowprefetch": true,
+ "fpu": true,
+ "pae": true,
+ "wdt": false,
+ "tsc_scale": false,
+ "skinit": false,
+ "fxsr_opt": false,
+ "kvm_nopiodelay": true,
+ "pmm-en": false,
+ "phe": false,
+ "3dnowext": false,
+ "osvw": false,
+ "ht": false,
+ "pdpe1gb": true,
+ "kvm-pv-eoi": true,
+ "npt": false,
+ "xsavec": false,
+ "lahf_lm": true,
+ "pclmulqdq": true,
+ "svm": false,
+ "sse3": true,
+ "sse2": true,
+ "ss": true,
+ "topoext": false,
+ "smx": false,
+ "bmi1": true,
+ "bmi2": true,
+ "xsaves": false,
+ "model": 61
+ }
+ }
+ },
+ "id": "model-expansion"
+}
diff --git a/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat.xml b/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat.xml
new file mode 100644
index 000000000..ecb4a6e15
--- /dev/null
+++ b/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat.xml
@@ -0,0 +1,41 @@
+<!-- Intel(R) Core(TM) i7-5600U CPU @ 2.60GHz -->
+<cpudata arch='x86'>
+ <cpuid eax_in='0x00000000' ecx_in='0x00' eax='0x00000014' ebx='0x756e6547' ecx='0x6c65746e' edx='0x49656e69'/>
+ <cpuid eax_in='0x00000001' ecx_in='0x00' eax='0x000306d4' ebx='0x00100800' ecx='0x7ffafbff' edx='0xbfebfbff'/>
+ <cpuid eax_in='0x00000002' ecx_in='0x00' eax='0x76036301' ebx='0x00f0b5ff' ecx='0x00000000' edx='0x00c30000'/>
+ <cpuid eax_in='0x00000003' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000000' edx='0x00000000'/>
+ <cpuid eax_in='0x00000004' ecx_in='0x00' eax='0x1c004121' ebx='0x01c0003f' ecx='0x0000003f' edx='0x00000000'/>
+ <cpuid eax_in='0x00000004' ecx_in='0x01' eax='0x1c004122' ebx='0x01c0003f' ecx='0x0000003f' edx='0x00000000'/>
+ <cpuid eax_in='0x00000004' ecx_in='0x02' eax='0x1c004143' ebx='0x01c0003f' ecx='0x000001ff' edx='0x00000000'/>
+ <cpuid eax_in='0x00000004' ecx_in='0x03' eax='0x1c03c163' ebx='0x03c0003f' ecx='0x00000fff' edx='0x00000006'/>
+ <cpuid eax_in='0x00000005' ecx_in='0x00' eax='0x00000040' ebx='0x00000040' ecx='0x00000003' edx='0x11142120'/>
+ <cpuid eax_in='0x00000006' ecx_in='0x00' eax='0x00000077' ebx='0x00000002' ecx='0x00000009' edx='0x00000000'/>
+ <cpuid eax_in='0x00000007' ecx_in='0x00' eax='0x00000000' ebx='0x021c2fbb' ecx='0x00000000' edx='0x00000000'/>
+ <cpuid eax_in='0x00000008' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000000' edx='0x00000000'/>
+ <cpuid eax_in='0x00000009' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000000' edx='0x00000000'/>
+ <cpuid eax_in='0x0000000a' ecx_in='0x00' eax='0x07300403' ebx='0x00000000' ecx='0x00000000' edx='0x00000603'/>
+ <cpuid eax_in='0x0000000b' ecx_in='0x00' eax='0x00000001' ebx='0x00000002' ecx='0x00000100' edx='0x00000000'/>
+ <cpuid eax_in='0x0000000b' ecx_in='0x01' eax='0x00000004' ebx='0x00000004' ecx='0x00000201' edx='0x00000000'/>
+ <cpuid eax_in='0x0000000c' ecx_in='0x00' eax='0x00000000' ebx='0x00000001' ecx='0x00000001' edx='0x00000000'/>
+ <cpuid eax_in='0x0000000d' ecx_in='0x00' eax='0x00000007' ebx='0x00000340' ecx='0x00000340' edx='0x00000000'/>
+ <cpuid eax_in='0x0000000d' ecx_in='0x01' eax='0x00000001' ebx='0x00000000' ecx='0x00000000' edx='0x00000000'/>
+ <cpuid eax_in='0x0000000d' ecx_in='0x02' eax='0x00000100' ebx='0x00000240' ecx='0x00000000' edx='0x00000000'/>
+ <cpuid eax_in='0x0000000e' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000000' edx='0x00000000'/>
+ <cpuid eax_in='0x0000000f' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000000' edx='0x00000000'/>
+ <cpuid eax_in='0x00000010' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000000' edx='0x00000000'/>
+ <cpuid eax_in='0x00000011' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000000' edx='0x00000000'/>
+ <cpuid eax_in='0x00000012' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000000' edx='0x00000000'/>
+ <cpuid eax_in='0x00000013' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000000' edx='0x00000000'/>
+ <cpuid eax_in='0x00000014' ecx_in='0x00' eax='0x00000000' ebx='0x00000001' ecx='0x00000001' edx='0x00000000'/>
+ <cpuid eax_in='0x80000000' ecx_in='0x00' eax='0x80000008' ebx='0x00000000' ecx='0x00000000' edx='0x00000000'/>
+ <cpuid eax_in='0x80000001' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000121' edx='0x2c100800'/>
+ <cpuid eax_in='0x80000002' ecx_in='0x00' eax='0x65746e49' ebx='0x2952286c' ecx='0x726f4320' edx='0x4d542865'/>
+ <cpuid eax_in='0x80000003' ecx_in='0x00' eax='0x37692029' ebx='0x3036352d' ecx='0x43205530' edx='0x40205550'/>
+ <cpuid eax_in='0x80000004' ecx_in='0x00' eax='0x362e3220' ebx='0x7a484730' ecx='0x00000000' edx='0x00000000'/>
+ <cpuid eax_in='0x80000005' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000000' edx='0x00000000'/>
+ <cpuid eax_in='0x80000006' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x01006040' edx='0x00000000'/>
+ <cpuid eax_in='0x80000007' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000000' edx='0x00000100'/>
+ <cpuid eax_in='0x80000008' ecx_in='0x00' eax='0x00003027' ebx='0x00000000' ecx='0x00000000' edx='0x00000000'/>
+ <cpuid eax_in='0x80860000' ecx_in='0x00' eax='0x00000000' ebx='0x00000001' ecx='0x00000001' edx='0x00000000'/>
+ <cpuid eax_in='0xc0000000' ecx_in='0x00' eax='0x00000000' ebx='0x00000001' ecx='0x00000001' edx='0x00000000'/>
+</cpudata>
--
2.13.1
7 years, 5 months
[libvirt] [PATCH 0/6] qemu: Clean up storage file access
by Peter Krempa
A collection of few cleanups and bugfixes.
Peter Krempa (6):
lib: Remove misplaced and redundant comments
tests: storage: Fully register storage driver
storage: Split out virStorageSource accessors to separate file
storage: Make virStorageFileReadHeader more universal
qemu: Use storage driver APIs in qemuDomainBlockPeek
qemu: Support only raw volumes in qemuDomainBlockPeek
po/POTFILES.in | 1 +
src/Makefile.am | 1 +
src/libvirt-domain.c | 4 +-
src/qemu/qemu_domain.c | 1 +
src/qemu/qemu_driver.c | 35 +-
src/security/virt-aa-helper.c | 2 +-
src/storage/storage_backend.h | 9 +-
src/storage/storage_backend_fs.c | 20 +-
src/storage/storage_backend_gluster.c | 37 ++-
src/storage/storage_driver.c | 551 +------------------------------
src/storage/storage_driver.h | 28 --
src/storage/storage_source.c | 587 ++++++++++++++++++++++++++++++++++
src/storage/storage_source.h | 54 ++++
tests/virstoragetest.c | 6 +-
14 files changed, 709 insertions(+), 627 deletions(-)
create mode 100644 src/storage/storage_source.c
create mode 100644 src/storage/storage_source.h
--
2.12.2
7 years, 5 months
[libvirt] [PATCH] qemu: handle missing bind host/service on chardev hotplug
by Ján Tomko
On domain startup, bind host or bind service can be omitted
and we will format a working command line.
Extend this to hotplug as well and specify the service to QEMU
even if the host is missing.
https://bugzilla.redhat.com/show_bug.cgi?id=1452441
---
src/qemu/qemu_monitor_json.c | 13 ++++++++++---
tests/qemumonitorjsontest.c | 11 +++++++++++
2 files changed, 21 insertions(+), 3 deletions(-)
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index 0837290..ca9bb14 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -6429,6 +6429,8 @@ qemuMonitorJSONAttachCharDevCommand(const char *chrID,
virJSONValuePtr data = NULL;
virJSONValuePtr addr = NULL;
const char *backend_type = NULL;
+ const char *host;
+ const char *port;
char *tlsalias = NULL;
bool telnet;
@@ -6492,9 +6494,14 @@ qemuMonitorJSONAttachCharDevCommand(const char *chrID,
virJSONValueObjectAppend(data, "remote", addr) < 0)
goto error;
- if (chr->data.udp.bindHost) {
- addr = qemuMonitorJSONBuildInetSocketAddress(chr->data.udp.bindHost,
- chr->data.udp.bindService);
+ host = chr->data.udp.bindHost;
+ port = chr->data.udp.bindService;
+ if (host || port) {
+ if (!host)
+ host = "";
+ if (!port)
+ port = "";
+ addr = qemuMonitorJSONBuildInetSocketAddress(host, port);
if (!addr ||
virJSONValueObjectAppend(data, "local", addr) < 0)
goto error;
diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c
index e9f9d47..3de901c 100644
--- a/tests/qemumonitorjsontest.c
+++ b/tests/qemumonitorjsontest.c
@@ -895,6 +895,17 @@ qemuMonitorJSONTestAttachChardev(virDomainXMLOptionPtr xmlopt)
"'data':{'host':'localhost',"
"'port':'4321'}}}}}");
+ chr.data.udp.bindHost = NULL;
+ chr.data.udp.bindService = (char *) "4321";
+ CHECK("udp", false,
+ "{'id':'alias',"
+ "'backend':{'type':'udp',"
+ "'data':{'remote':{'type':'inet',"
+ "'data':{'host':'example.com',"
+ "'port':'1234'}},"
+ "'local':{'type':'inet',"
+ "'data':{'host':'',"
+ "'port':'4321'}}}}}");
memset(&chr, 0, sizeof(chr));
chr.type = VIR_DOMAIN_CHR_TYPE_UNIX;
chr.data.nix.path = (char *) "/path/to/socket";
--
2.10.2
7 years, 5 months
[libvirt] [PATCH 0/9] Properly implement json pseudo-protocol string deflattening
by Peter Krempa
In qemu's new syntax starting from 2.9 it's possible to have nested objects in
the json pseudo protocol string specifying a backing store for an image. Libvirt
would not be able to handle some of them, since the json deflattener was
meant to deflatten only 1 layer.
Peter Krempa (9):
tests: Rename jsontest to virjsontest
util: json: Add virJSONValueIsObject
util: Move JSON object deflattening code to json utility file
util: json: Don't remove the 'file' subobject when deflattening
tests: json: Add test for the deflattening function
util: json: Properly implement JSON deflattening
util: json: Recursively deflatten objects virJSONValueObjectDeflatten
util: storage: Always deflatten JSON pseudo-protocol objects
tests: Validate that JSON deflattening fixed nested json
pseudo-protocol strings
src/libvirt_private.syms | 2 +
src/util/virjson.c | 115 +++++++++++++++++++++
src/util/virjson.h | 4 +
src/util/virstoragefile.c | 79 ++------------
tests/Makefile.am | 8 +-
tests/virjsondata/deflatten-basic-file-in.json | 8 ++
tests/virjsondata/deflatten-basic-file-out.json | 10 ++
tests/virjsondata/deflatten-basic-generic-in.json | 14 +++
tests/virjsondata/deflatten-basic-generic-out.json | 20 ++++
.../deflatten-concat-double-key-in.json | 7 ++
tests/virjsondata/deflatten-concat-in.json | 5 +
tests/virjsondata/deflatten-concat-out.json | 8 ++
tests/virjsondata/deflatten-deep-file-in.json | 9 ++
tests/virjsondata/deflatten-deep-file-out.json | 23 +++++
tests/virjsondata/deflatten-deep-generic-in.json | 9 ++
tests/virjsondata/deflatten-deep-generic-out.json | 27 +++++
tests/virjsondata/deflatten-double-key-in.json | 4 +
tests/virjsondata/deflatten-nested-in.json | 16 +++
tests/virjsondata/deflatten-nested-out.json | 28 +++++
tests/virjsondata/deflatten-qemu-sheepdog-in.json | 11 ++
tests/virjsondata/deflatten-qemu-sheepdog-out.json | 13 +++
tests/virjsondata/deflatten-unflattened-in.json | 12 +++
tests/virjsondata/deflatten-unflattened-out.json | 14 +++
tests/{jsontest.c => virjsontest.c} | 75 ++++++++++++++
tests/virstoragetest.c | 10 ++
25 files changed, 458 insertions(+), 73 deletions(-)
create mode 100644 tests/virjsondata/deflatten-basic-file-in.json
create mode 100644 tests/virjsondata/deflatten-basic-file-out.json
create mode 100644 tests/virjsondata/deflatten-basic-generic-in.json
create mode 100644 tests/virjsondata/deflatten-basic-generic-out.json
create mode 100644 tests/virjsondata/deflatten-concat-double-key-in.json
create mode 100644 tests/virjsondata/deflatten-concat-in.json
create mode 100644 tests/virjsondata/deflatten-concat-out.json
create mode 100644 tests/virjsondata/deflatten-deep-file-in.json
create mode 100644 tests/virjsondata/deflatten-deep-file-out.json
create mode 100644 tests/virjsondata/deflatten-deep-generic-in.json
create mode 100644 tests/virjsondata/deflatten-deep-generic-out.json
create mode 100644 tests/virjsondata/deflatten-double-key-in.json
create mode 100644 tests/virjsondata/deflatten-nested-in.json
create mode 100644 tests/virjsondata/deflatten-nested-out.json
create mode 100644 tests/virjsondata/deflatten-qemu-sheepdog-in.json
create mode 100644 tests/virjsondata/deflatten-qemu-sheepdog-out.json
create mode 100644 tests/virjsondata/deflatten-unflattened-in.json
create mode 100644 tests/virjsondata/deflatten-unflattened-out.json
rename tests/{jsontest.c => virjsontest.c} (89%)
--
2.12.2
7 years, 5 months
[libvirt] [PATCH 0/8] Yet another round of qemu namespace fixes
by Michal Privoznik
I've encountered couple of problems while playing with the namespaces. For the
first issue (2/8) I've got a confirmation from openstack guys that it fixes
their issue.
Michal Privoznik (8):
conf: Rename and expose virDomainChrSourceDefPath
qemuDomainBuildNamespace: Handle special file mount points
qemu: Move preserved mount points path generation into a separate
function
qemuDomainCreateDeviceRecursive: Fail on unsupported file type
qemuDomainAttachDeviceMknodHelper: Fail on unsupported file type
qemuDomainCreateDeviceRecursive: Support file mount points
qemuDomainAttachDeviceMknodRecursive: Support file mount points
qemu ns: Create chardev backends more frequently
src/conf/domain_audit.c | 44 ++---------
src/conf/domain_conf.c | 33 +++++++++
src/conf/domain_conf.h | 2 +
src/libvirt_private.syms | 1 +
src/qemu/qemu_domain.c | 186 ++++++++++++++++++++++++++++++++++-------------
5 files changed, 178 insertions(+), 88 deletions(-)
--
2.13.0
7 years, 5 months
[libvirt] [PATCH v4 0/6] Fix error reporting in streams
by Michal Privoznik
v4 of:
https://www.redhat.com/archives/libvir-list/2017-June/msg00190.html
Frankly, nothing much changed since v3, but the discussion on those patches got
very hairy and without any explicit ACKs. So I'm resending to get them :-)
Michal Privoznik (6):
virfdstream: Check for thread error more frequently
fdstream: Report error from the I/O thread
virStream*All: Call virStreamAbort() more frequently
virStream*All: Preserve reported error
virFileInData: preserve errno in cleanup path
virStream*All: Report error if a callback fails
daemon/stream.c | 18 ++++++---
include/libvirt/libvirt-stream.h | 17 +++++++-
src/libvirt-stream.c | 83 +++++++++++++++++++++++++++++++---------
src/util/virfdstream.c | 26 ++++++++++---
src/util/virfile.c | 5 ++-
5 files changed, 117 insertions(+), 32 deletions(-)
--
2.13.0
7 years, 5 months