[libvirt] [PATCH RESEND RFC V2 0/2] Implement l3 CAT
by Eli Qiao
Allow user to define cachetune in domain xml.
RESEND:
* Fix stupid complile problem pointed out by Martin, check and syntax-check
passed.
V2 -> V1 changes:
* Redefine cachetune xml in domain xml.
* Create a struct for driver to talk with util/virresctrl.*
* Nit fixes
Eli Qiao (2):
Resctrl: Add new xml element to support cache tune
Resctrl: Do cache allocation while boot a qemu VM
docs/schemas/domaincommon.rng | 29 ++
include/libvirt/virterror.h | 1 +
src/Makefile.am | 1 +
src/conf/domain_conf.c | 112 ++++
src/conf/domain_conf.h | 19 +
src/libvirt_private.syms | 9 +
src/qemu/qemu_process.c | 81 +++
src/util/virerror.c | 1 +
src/util/virresctrl.c | 822 ++++++++++++++++++++++++++++++
src/util/virresctrl.h | 88 ++++
tests/Makefile.am | 8 +-
tests/virresctrldata/L3-free.schemata | 1 +
tests/virresctrldata/L3CODE-free.schemata | 1 +
tests/virresctrldata/L3DATA-free.schemata | 1 +
tests/virresctrldata/linux-resctrl | 1 +
tests/virresctrldata/linux-resctrl-cdp | 1 +
tests/virresctrltest.c | 119 +++++
17 files changed, 1294 insertions(+), 1 deletion(-)
create mode 100644 src/util/virresctrl.c
create mode 100644 src/util/virresctrl.h
create mode 100644 tests/virresctrldata/L3-free.schemata
create mode 100644 tests/virresctrldata/L3CODE-free.schemata
create mode 100644 tests/virresctrldata/L3DATA-free.schemata
create mode 120000 tests/virresctrldata/linux-resctrl
create mode 120000 tests/virresctrldata/linux-resctrl-cdp
create mode 100644 tests/virresctrltest.c
--
1.9.1
7 years, 4 months
[libvirt] [PATCHv2 0/2] Adding support for LXC Docker-json configuration
by Venkat Datta N H
Hi All,
I added two patches to support conversion of Docker JSON configuration into LXC Native Domain XML.
Venkat Datta N H (2):
lxc: add support for docker-json Memory and VCPU conversion
lxc: add support for docker-json command conversion
po/POTFILES.in | 1 +
src/Makefile.am | 1 +
src/lxc/lxc_docker.c | 181 +++++++++++++++++++++
src/lxc/lxc_docker.h | 32 ++++
src/lxc/lxc_driver.c | 13 +-
src/lxc/lxc_native.h | 1 +
tests/Makefile.am | 8 +-
.../lxcdocker2xmldata-command.json | 47 ++++++
.../lxcdocker2xmldata-command.xml | 17 ++
.../lxcdocker2xmldata-simple.json | 36 ++++
.../lxcdocker2xmldata/lxcdocker2xmldata-simple.xml | 15 ++
tests/lxcdocker2xmltest.c | 150 +++++++++++++++++
12 files changed, 496 insertions(+), 6 deletions(-)
create mode 100644 src/lxc/lxc_docker.c
create mode 100644 src/lxc/lxc_docker.h
create mode 100644 tests/lxcdocker2xmldata/lxcdocker2xmldata-command.json
create mode 100644 tests/lxcdocker2xmldata/lxcdocker2xmldata-command.xml
create mode 100644 tests/lxcdocker2xmldata/lxcdocker2xmldata-simple.json
create mode 100644 tests/lxcdocker2xmldata/lxcdocker2xmldata-simple.xml
create mode 100644 tests/lxcdocker2xmltest.c
--
2.7.4
7 years, 4 months
[libvirt] [PATCH] docs: add entry for Ravada to apps page
by Francesc Guasch
---
docs/apps.html.in | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/docs/apps.html.in b/docs/apps.html.in
index 5acf885a7..6b1357733 100644
--- a/docs/apps.html.in
+++ b/docs/apps.html.in
@@ -458,6 +458,14 @@
providers, OpenStack based public/private clouds, Docker servers, bare
metal servers and now KVM hypervisors).
</dd>
+ <dt><a href="http://ravada.upc.edu/">Ravada</a></dt>
+ <dd>
+ Ravada is an open source tool for managing Virtual Desktop
+ Infraestructure (VDI). It is very easy to install and use. Following
+ the documentation, you'll be ready to deploy virtual machines in
+ minutes. The only requirements for the users are a web-browser and
+ a light remote viewer.
+ </dd>
</dl>
<h2><a name="mobile">Mobile applications</a></h2>
--
2.11.0
7 years, 4 months
[libvirt] [PATCH] tests: Add DO_TEST_PARSE_ERROR() to qemuxml2xml
by Andrea Bolognani
qemuxml2argv already supports the ability to include test
cases that are known not to make it past XML parsing, and
since we want to keep qemuxml2xml in sync with it as much
as possible, we need to implement this missing feature.
Signed-off-by: Andrea Bolognani <abologna(a)redhat.com>
---
tests/qemuxml2xmltest.c | 104 +++++++++++++++++++++++++++++++-----------------
1 file changed, 67 insertions(+), 37 deletions(-)
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index c74614c..66729fa 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -28,6 +28,10 @@ enum {
WHEN_BOTH = 3,
};
+typedef enum {
+ FLAG_EXPECT_PARSE_ERROR = 1 << 0,
+} virQemuXML2XMLTestFlags;
+
struct testInfo {
char *inName;
char *outActiveName;
@@ -36,6 +40,8 @@ struct testInfo {
virBitmapPtr activeVcpus;
virQEMUCapsPtr qemuCaps;
+
+ virQemuXML2XMLTestFlags flags;
};
static int
@@ -55,12 +61,15 @@ static int
testXML2XMLActive(const void *opaque)
{
const struct testInfo *info = opaque;
+ testCompareDomXML2XMLResult flags = TEST_COMPARE_DOM_XML2XML_RESULT_SUCCESS;
+
+ if (info->flags & FLAG_EXPECT_PARSE_ERROR)
+ flags = TEST_COMPARE_DOM_XML2XML_RESULT_FAIL_PARSE;
return testCompareDomXML2XMLFiles(driver.caps, driver.xmlopt,
info->inName, info->outActiveName, true,
qemuXML2XMLActivePreFormatCallback,
- opaque, 0,
- TEST_COMPARE_DOM_XML2XML_RESULT_SUCCESS);
+ opaque, 0, flags);
}
@@ -68,11 +77,14 @@ static int
testXML2XMLInactive(const void *opaque)
{
const struct testInfo *info = opaque;
+ testCompareDomXML2XMLResult flags = TEST_COMPARE_DOM_XML2XML_RESULT_SUCCESS;
+
+ if (info->flags & FLAG_EXPECT_PARSE_ERROR)
+ flags = TEST_COMPARE_DOM_XML2XML_RESULT_FAIL_PARSE;
return testCompareDomXML2XMLFiles(driver.caps, driver.xmlopt, info->inName,
info->outInactiveName, false,
- NULL, opaque, 0,
- TEST_COMPARE_DOM_XML2XML_RESULT_SUCCESS);
+ NULL, opaque, 0, flags);
}
@@ -195,6 +207,8 @@ testCompareStatusXMLToXMLFiles(const void *opaque)
VIR_DOMAIN_DEF_PARSE_STATUS |
VIR_DOMAIN_DEF_PARSE_ACTUAL_NET |
VIR_DOMAIN_DEF_PARSE_PCI_ORIG_STATES))) {
+ if (data->flags & FLAG_EXPECT_PARSE_ERROR)
+ goto ok;
VIR_TEST_DEBUG("Failed to parse domain status XML:\n%s", source);
goto cleanup;
}
@@ -217,6 +231,17 @@ testCompareStatusXMLToXMLFiles(const void *opaque)
ret = 0;
+ ok:
+ if (data->flags & FLAG_EXPECT_PARSE_ERROR) {
+ if (ret < 0) {
+ VIR_TEST_DEBUG("Got expected error");
+ ret = 0;
+ } else {
+ VIR_TEST_DEBUG("Error expected but there wasn't any");
+ ret = -1;
+ }
+ }
+
cleanup:
xmlKeepBlanksDefault(keepBlanksDefault);
xmlFreeDoc(xml);
@@ -249,7 +274,8 @@ static int
testInfoSet(struct testInfo *info,
const char *name,
int when,
- int gic)
+ int gic,
+ virQemuXML2XMLTestFlags flags)
{
if (!(info->qemuCaps = virQEMUCapsNew()))
goto error;
@@ -296,6 +322,8 @@ testInfoSet(struct testInfo *info,
}
}
+ info->flags = flags;
+
return 0;
error:
@@ -335,9 +363,9 @@ mymain(void)
/* TODO: test with format probing disabled too */
driver.config->allowDiskFormatProbing = true;
-# define DO_TEST_FULL(name, when, gic, ...) \
+# define DO_TEST_FULL(name, when, gic, flags, ...) \
do { \
- if (testInfoSet(&info, name, when, gic) < 0) { \
+ if (testInfoSet(&info, name, when, gic, flags) < 0) { \
VIR_TEST_DEBUG("Failed to generate test data for '%s'", name); \
return -1; \
} \
@@ -364,8 +392,10 @@ mymain(void)
# define NONE QEMU_CAPS_LAST
# define DO_TEST(name, ...) \
- DO_TEST_FULL(name, WHEN_BOTH, GIC_NONE, __VA_ARGS__)
+ DO_TEST_FULL(name, WHEN_BOTH, GIC_NONE, 0, __VA_ARGS__)
+# define DO_TEST_PARSE_ERROR(name, ...) \
+ DO_TEST_FULL(name, WHEN_BOTH, GIC_NONE, FLAG_EXPECT_PARSE_ERROR, __VA_ARGS__)
/* Unset or set all envvars here that are copied in qemudBuildCommandLine
@@ -493,7 +523,7 @@ mymain(void)
QEMU_CAPS_SCSI_DISK_WWN);
DO_TEST("disk-mirror-old", NONE);
DO_TEST("disk-mirror", NONE);
- DO_TEST_FULL("disk-active-commit", WHEN_ACTIVE, GIC_NONE, NONE);
+ DO_TEST_FULL("disk-active-commit", WHEN_ACTIVE, GIC_NONE, 0, NONE);
DO_TEST("graphics-listen-network", NONE);
DO_TEST("graphics-vnc", NONE);
DO_TEST("graphics-vnc-websocket", NONE);
@@ -571,7 +601,7 @@ mymain(void)
DO_TEST("channel-virtio", NONE);
DO_TEST("channel-virtio-state", NONE);
- DO_TEST_FULL("channel-unix-source-path", WHEN_INACTIVE, GIC_NONE, NONE);
+ DO_TEST_FULL("channel-unix-source-path", WHEN_INACTIVE, GIC_NONE, 0, NONE);
DO_TEST("hostdev-usb-address", NONE);
DO_TEST("hostdev-pci-address", NONE);
@@ -644,17 +674,17 @@ mymain(void)
DO_TEST("blkdeviotune-max-length", NONE);
DO_TEST("controller-usb-order", NONE);
- DO_TEST_FULL("seclabel-dynamic-baselabel", WHEN_INACTIVE, GIC_NONE, NONE);
- DO_TEST_FULL("seclabel-dynamic-override", WHEN_INACTIVE, GIC_NONE, NONE);
- DO_TEST_FULL("seclabel-dynamic-labelskip", WHEN_INACTIVE, GIC_NONE, NONE);
- DO_TEST_FULL("seclabel-dynamic-relabel", WHEN_INACTIVE, GIC_NONE, NONE);
+ DO_TEST_FULL("seclabel-dynamic-baselabel", WHEN_INACTIVE, GIC_NONE, 0, NONE);
+ DO_TEST_FULL("seclabel-dynamic-override", WHEN_INACTIVE, GIC_NONE, 0, NONE);
+ DO_TEST_FULL("seclabel-dynamic-labelskip", WHEN_INACTIVE, GIC_NONE, 0, NONE);
+ DO_TEST_FULL("seclabel-dynamic-relabel", WHEN_INACTIVE, GIC_NONE, 0, NONE);
DO_TEST("seclabel-static", NONE);
- DO_TEST_FULL("seclabel-static-labelskip", WHEN_ACTIVE, GIC_NONE, NONE);
+ DO_TEST_FULL("seclabel-static-labelskip", WHEN_ACTIVE, GIC_NONE, 0, NONE);
DO_TEST("seclabel-none", NONE);
DO_TEST("seclabel-dac-none", NONE);
DO_TEST("seclabel-dynamic-none", NONE);
DO_TEST("seclabel-device-multiple", NONE);
- DO_TEST_FULL("seclabel-dynamic-none-relabel", WHEN_INACTIVE, GIC_NONE, NONE);
+ DO_TEST_FULL("seclabel-dynamic-none-relabel", WHEN_INACTIVE, GIC_NONE, 0, NONE);
DO_TEST("numad-static-vcpu-no-numatune", NONE);
DO_TEST("disk-scsi-lun-passthrough-sgio",
@@ -1088,27 +1118,27 @@ mymain(void)
QEMU_CAPS_PCI_MULTIFUNCTION, QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
QEMU_CAPS_DEVICE_VIRTIO_GPU, QEMU_CAPS_BOOTINDEX);
- DO_TEST_FULL("aarch64-gic-none", WHEN_BOTH, GIC_NONE, NONE);
- DO_TEST_FULL("aarch64-gic-none-v2", WHEN_BOTH, GIC_V2, NONE);
- DO_TEST_FULL("aarch64-gic-none-v3", WHEN_BOTH, GIC_V3, NONE);
- DO_TEST_FULL("aarch64-gic-none-both", WHEN_BOTH, GIC_BOTH, NONE);
- DO_TEST_FULL("aarch64-gic-none-tcg", WHEN_BOTH, GIC_BOTH, NONE);
- DO_TEST_FULL("aarch64-gic-default", WHEN_BOTH, GIC_NONE, NONE);
- DO_TEST_FULL("aarch64-gic-default", WHEN_BOTH, GIC_V2, NONE);
- DO_TEST_FULL("aarch64-gic-default", WHEN_BOTH, GIC_V3, NONE);
- DO_TEST_FULL("aarch64-gic-default", WHEN_BOTH, GIC_BOTH, NONE);
- DO_TEST_FULL("aarch64-gic-v2", WHEN_BOTH, GIC_NONE, NONE);
- DO_TEST_FULL("aarch64-gic-v2", WHEN_BOTH, GIC_V2, NONE);
- DO_TEST_FULL("aarch64-gic-v2", WHEN_BOTH, GIC_V3, NONE);
- DO_TEST_FULL("aarch64-gic-v2", WHEN_BOTH, GIC_BOTH, NONE);
- DO_TEST_FULL("aarch64-gic-v3", WHEN_BOTH, GIC_NONE, NONE);
- DO_TEST_FULL("aarch64-gic-v3", WHEN_BOTH, GIC_V2, NONE);
- DO_TEST_FULL("aarch64-gic-v3", WHEN_BOTH, GIC_V3, NONE);
- DO_TEST_FULL("aarch64-gic-v3", WHEN_BOTH, GIC_BOTH, NONE);
- DO_TEST_FULL("aarch64-gic-host", WHEN_BOTH, GIC_NONE, NONE);
- DO_TEST_FULL("aarch64-gic-host", WHEN_BOTH, GIC_V2, NONE);
- DO_TEST_FULL("aarch64-gic-host", WHEN_BOTH, GIC_V3, NONE);
- DO_TEST_FULL("aarch64-gic-host", WHEN_BOTH, GIC_BOTH, NONE);
+ DO_TEST_FULL("aarch64-gic-none", WHEN_BOTH, GIC_NONE, 0, NONE);
+ DO_TEST_FULL("aarch64-gic-none-v2", WHEN_BOTH, GIC_V2, 0, NONE);
+ DO_TEST_FULL("aarch64-gic-none-v3", WHEN_BOTH, GIC_V3, 0, NONE);
+ DO_TEST_FULL("aarch64-gic-none-both", WHEN_BOTH, GIC_BOTH, 0, NONE);
+ DO_TEST_FULL("aarch64-gic-none-tcg", WHEN_BOTH, GIC_BOTH, 0, NONE);
+ DO_TEST_FULL("aarch64-gic-default", WHEN_BOTH, GIC_NONE, 0, NONE);
+ DO_TEST_FULL("aarch64-gic-default", WHEN_BOTH, GIC_V2, 0, NONE);
+ DO_TEST_FULL("aarch64-gic-default", WHEN_BOTH, GIC_V3, 0, NONE);
+ DO_TEST_FULL("aarch64-gic-default", WHEN_BOTH, GIC_BOTH, 0, NONE);
+ DO_TEST_FULL("aarch64-gic-v2", WHEN_BOTH, GIC_NONE, 0, NONE);
+ DO_TEST_FULL("aarch64-gic-v2", WHEN_BOTH, GIC_V2, 0, NONE);
+ DO_TEST_FULL("aarch64-gic-v2", WHEN_BOTH, GIC_V3, 0, NONE);
+ DO_TEST_FULL("aarch64-gic-v2", WHEN_BOTH, GIC_BOTH, 0, NONE);
+ DO_TEST_FULL("aarch64-gic-v3", WHEN_BOTH, GIC_NONE, 0, NONE);
+ DO_TEST_FULL("aarch64-gic-v3", WHEN_BOTH, GIC_V2, 0, NONE);
+ DO_TEST_FULL("aarch64-gic-v3", WHEN_BOTH, GIC_V3, 0, NONE);
+ DO_TEST_FULL("aarch64-gic-v3", WHEN_BOTH, GIC_BOTH, 0, NONE);
+ DO_TEST_FULL("aarch64-gic-host", WHEN_BOTH, GIC_NONE, 0, NONE);
+ DO_TEST_FULL("aarch64-gic-host", WHEN_BOTH, GIC_V2, 0, NONE);
+ DO_TEST_FULL("aarch64-gic-host", WHEN_BOTH, GIC_V3, 0, NONE);
+ DO_TEST_FULL("aarch64-gic-host", WHEN_BOTH, GIC_BOTH, 0, NONE);
DO_TEST("memory-hotplug", NONE);
DO_TEST("memory-hotplug-nonuma", NONE);
--
2.7.5
7 years, 4 months
[libvirt] [PATCH] qemu: domain: Use vcpu 'node-id' property and pass it back to qemu
by Peter Krempa
vcpu properties gathered from query-hotpluggable cpus need to be passed
back to qemu. As qemu did not use the node-id property until now and
libvirt forgot to pass it back properly (it was parsed but not passed
around) we did not honor this.
This patch adds node-id to the structures where it was missing and
passes it around as necessary.
The test data was generated with a VM with following config:
<numa>
<cell id='0' cpus='0,2,4,6' memory='512000' unit='KiB'/>
<cell id='1' cpus='1,3,5,7' memory='512000' unit='KiB'/>
</numa>
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1452053
---
src/qemu/qemu_command.c | 4 +
src/qemu/qemu_domain.c | 1 +
src/qemu/qemu_domain.h | 1 +
src/qemu/qemu_monitor.c | 2 +
src/qemu/qemu_monitor.h | 1 +
...qemumonitorjson-cpuinfo-x86-node-full-cpus.json | 35 +++++++++
...umonitorjson-cpuinfo-x86-node-full-hotplug.json | 87 ++++++++++++++++++++++
.../qemumonitorjson-cpuinfo-x86-node-full.data | 48 ++++++++++++
tests/qemumonitorjsontest.c | 3 +
9 files changed, 182 insertions(+)
create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-node-full-cpus.json
create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-node-full-hotplug.json
create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-node-full.data
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index c53ab97b9..3fe291863 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -10508,6 +10508,10 @@ qemuBuildHotpluggableCPUProps(const virDomainVcpuDef *vcpu)
virJSONValueObjectAdd(ret, "i:thread-id", vcpupriv->thread_id, NULL) < 0)
goto error;
+ if (vcpupriv->node_id != -1 &&
+ virJSONValueObjectAdd(ret, "i:node-id", vcpupriv->node_id, NULL) < 0)
+ goto error;
+
return ret;
error:
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 8e7404da6..0d9cd94b2 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -6986,6 +6986,7 @@ qemuDomainRefreshVcpuInfo(virQEMUDriverPtr driver,
vcpupriv->socket_id = info[i].socket_id;
vcpupriv->core_id = info[i].core_id;
vcpupriv->thread_id = info[i].thread_id;
+ vcpupriv->node_id = info[i].node_id;
vcpupriv->vcpus = info[i].vcpus;
VIR_FREE(vcpupriv->type);
VIR_STEAL_PTR(vcpupriv->type, info[i].type);
diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
index aae322473..365b23c96 100644
--- a/src/qemu/qemu_domain.h
+++ b/src/qemu/qemu_domain.h
@@ -359,6 +359,7 @@ struct _qemuDomainVcpuPrivate {
int socket_id;
int core_id;
int thread_id;
+ int node_id;
int vcpus;
};
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index 5c29b3763..2b0afcc21 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -1750,6 +1750,7 @@ qemuMonitorCPUInfoClear(qemuMonitorCPUInfoPtr cpus,
cpus[i].socket_id = -1;
cpus[i].core_id = -1;
cpus[i].thread_id = -1;
+ cpus[i].node_id = -1;
cpus[i].vcpus = 0;
cpus[i].tid = 0;
cpus[i].halted = false;
@@ -1902,6 +1903,7 @@ qemuMonitorGetCPUInfoHotplug(struct qemuMonitorQueryHotpluggableCpusEntry *hotpl
vcpus[mastervcpu].socket_id = hotplugvcpus[i].socket_id;
vcpus[mastervcpu].core_id = hotplugvcpus[i].core_id;
vcpus[mastervcpu].thread_id = hotplugvcpus[i].thread_id;
+ vcpus[mastervcpu].node_id = hotplugvcpus[i].node_id;
vcpus[mastervcpu].vcpus = hotplugvcpus[i].vcpus;
VIR_STEAL_PTR(vcpus[mastervcpu].qom_path, hotplugvcpus[i].qom_path);
VIR_STEAL_PTR(vcpus[mastervcpu].alias, hotplugvcpus[i].alias);
diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h
index 8956bf929..1697db55c 100644
--- a/src/qemu/qemu_monitor.h
+++ b/src/qemu/qemu_monitor.h
@@ -483,6 +483,7 @@ struct _qemuMonitorCPUInfo {
int socket_id;
int core_id;
int thread_id;
+ int node_id;
unsigned int vcpus; /* number of vcpus added if given entry is hotplugged */
/* name of the qemu type to add in case of hotplug */
diff --git a/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-node-full-cpus.json b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-node-full-cpus.json
new file mode 100644
index 000000000..6b39efa69
--- /dev/null
+++ b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-node-full-cpus.json
@@ -0,0 +1,35 @@
+{
+ "return": [
+ {
+ "arch": "x86",
+ "current": true,
+ "props": {
+ "core-id": 0,
+ "thread-id": 0,
+ "node-id": 0,
+ "socket-id": 0
+ },
+ "CPU": 0,
+ "qom_path": "/machine/unattached/device[0]",
+ "pc": 1048956,
+ "halted": true,
+ "thread_id": 2033724
+ },
+ {
+ "arch": "x86",
+ "current": false,
+ "props": {
+ "core-id": 0,
+ "thread-id": 1,
+ "node-id": 1,
+ "socket-id": 0
+ },
+ "CPU": 1,
+ "qom_path": "/machine/unattached/device[2]",
+ "pc": 1037318,
+ "halted": true,
+ "thread_id": 2033725
+ }
+ ],
+ "id": "libvirt-21"
+}
diff --git a/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-node-full-hotplug.json b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-node-full-hotplug.json
new file mode 100644
index 000000000..dfddd9632
--- /dev/null
+++ b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-node-full-hotplug.json
@@ -0,0 +1,87 @@
+{
+ "return": [
+ {
+ "props": {
+ "core-id": 1,
+ "thread-id": 1,
+ "node-id": 1,
+ "socket-id": 1
+ },
+ "vcpus-count": 1,
+ "type": "Broadwell-x86_64-cpu"
+ },
+ {
+ "props": {
+ "core-id": 1,
+ "thread-id": 0,
+ "node-id": 0,
+ "socket-id": 1
+ },
+ "vcpus-count": 1,
+ "type": "Broadwell-x86_64-cpu"
+ },
+ {
+ "props": {
+ "core-id": 0,
+ "thread-id": 1,
+ "node-id": 1,
+ "socket-id": 1
+ },
+ "vcpus-count": 1,
+ "type": "Broadwell-x86_64-cpu"
+ },
+ {
+ "props": {
+ "core-id": 0,
+ "thread-id": 0,
+ "node-id": 0,
+ "socket-id": 1
+ },
+ "vcpus-count": 1,
+ "type": "Broadwell-x86_64-cpu"
+ },
+ {
+ "props": {
+ "core-id": 1,
+ "thread-id": 1,
+ "node-id": 1,
+ "socket-id": 0
+ },
+ "vcpus-count": 1,
+ "type": "Broadwell-x86_64-cpu"
+ },
+ {
+ "props": {
+ "core-id": 1,
+ "thread-id": 0,
+ "node-id": 0,
+ "socket-id": 0
+ },
+ "vcpus-count": 1,
+ "type": "Broadwell-x86_64-cpu"
+ },
+ {
+ "props": {
+ "core-id": 0,
+ "thread-id": 1,
+ "node-id": 1,
+ "socket-id": 0
+ },
+ "vcpus-count": 1,
+ "qom-path": "/machine/unattached/device[2]",
+ "type": "Broadwell-x86_64-cpu"
+ },
+ {
+ "props": {
+ "core-id": 0,
+ "thread-id": 0,
+ "node-id": 0,
+ "socket-id": 0
+ },
+ "vcpus-count": 1,
+ "qom-path": "/machine/unattached/device[0]",
+ "type": "Broadwell-x86_64-cpu"
+ }
+ ],
+ "id": "libvirt-20"
+}
diff --git a/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-node-full.data b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-node-full.data
new file mode 100644
index 000000000..070ea084e
--- /dev/null
+++ b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-node-full.data
@@ -0,0 +1,48 @@
+[vcpu libvirt-id='0']
+ online=yes
+ hotpluggable=no
+ thread-id='2033724'
+ enable-id='1'
+ query-cpus-id='0'
+ type='Broadwell-x86_64-cpu'
+ qom_path='/machine/unattached/device[0]'
+ topology: socket='0' core='0' thread='0' node='0' vcpus='1'
+[vcpu libvirt-id='1']
+ online=yes
+ hotpluggable=no
+ thread-id='2033725'
+ enable-id='2'
+ query-cpus-id='1'
+ type='Broadwell-x86_64-cpu'
+ qom_path='/machine/unattached/device[2]'
+ topology: socket='0' core='0' thread='1' node='1' vcpus='1'
+[vcpu libvirt-id='2']
+ online=no
+ hotpluggable=yes
+ type='Broadwell-x86_64-cpu'
+ topology: socket='0' core='1' thread='0' node='0' vcpus='1'
+[vcpu libvirt-id='3']
+ online=no
+ hotpluggable=yes
+ type='Broadwell-x86_64-cpu'
+ topology: socket='0' core='1' thread='1' node='1' vcpus='1'
+[vcpu libvirt-id='4']
+ online=no
+ hotpluggable=yes
+ type='Broadwell-x86_64-cpu'
+ topology: socket='1' core='0' thread='0' node='0' vcpus='1'
+[vcpu libvirt-id='5']
+ online=no
+ hotpluggable=yes
+ type='Broadwell-x86_64-cpu'
+ topology: socket='1' core='0' thread='1' node='1' vcpus='1'
+[vcpu libvirt-id='6']
+ online=no
+ hotpluggable=yes
+ type='Broadwell-x86_64-cpu'
+ topology: socket='1' core='1' thread='0' node='0' vcpus='1'
+[vcpu libvirt-id='7']
+ online=no
+ hotpluggable=yes
+ type='Broadwell-x86_64-cpu'
+ topology: socket='1' core='1' thread='1' node='1' vcpus='1'
diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c
index e9f9d47b5..6da27f783 100644
--- a/tests/qemumonitorjsontest.c
+++ b/tests/qemumonitorjsontest.c
@@ -2604,6 +2604,8 @@ testQemuMonitorCPUInfoFormat(qemuMonitorCPUInfoPtr vcpus,
virBufferAsprintf(&buf, " core='%d'", vcpu->core_id);
if (vcpu->thread_id != -1)
virBufferAsprintf(&buf, " thread='%d'", vcpu->thread_id);
+ if (vcpu->node_id != -1)
+ virBufferAsprintf(&buf, " node='%d'", vcpu->node_id);
if (vcpu->vcpus != 0)
virBufferAsprintf(&buf, " vcpus='%u'", vcpu->vcpus);
virBufferAddLit(&buf, "\n");
@@ -2913,6 +2915,7 @@ mymain(void)
DO_TEST_CPU_INFO("x86-basic-pluggable", 8);
DO_TEST_CPU_INFO("x86-full", 11);
+ DO_TEST_CPU_INFO("x86-node-full", 8);
DO_TEST_CPU_INFO("ppc64-basic", 24);
DO_TEST_CPU_INFO("ppc64-hotplug-1", 24);
--
2.12.2
7 years, 4 months
[libvirt] [PATCH go-xml v2] Add support for QEMU
by Thomas Hipp
Add support for QEMU, and add test code.
Signed-off-by: Thomas Hipp <thipp(a)suse.de>
---
Changes since v1:
- support multiple Args and Envs
---
domain.go | 50 +++++++++++++++++++++++++++++++++-----------------
domain_test.go | 28 ++++++++++++++++++++++++++++
2 files changed, 61 insertions(+), 17 deletions(-)
diff --git a/domain.go b/domain.go
index b9b0f77..8c1fa76 100644
--- a/domain.go
+++ b/domain.go
@@ -590,27 +590,43 @@ type DomainFeatureList struct {
SMM *DomainFeatureState `xml:"smm"`
}
+type DomainQEMUCommandlineArg struct {
+ Value string `xml:"value,attr"`
+}
+
+type DomainQEMUCommandlineEnv struct {
+ Name string `xml:"name,attr"`
+ Value string `xml:"value,attr,omitempty"`
+}
+
+type DomainQEMUCommandline struct {
+ Args []DomainQEMUCommandlineArg `xml:"qemu arg"`
+ Envs []DomainQEMUCommandlineEnv `xml:"qemu env"`
+}
+
// NB, try to keep the order of fields in this struct
// matching the order of XML elements that libvirt
// will generate when dumping XML.
type Domain struct {
- XMLName xml.Name `xml:"domain"`
- Type string `xml:"type,attr,omitempty"`
- Name string `xml:"name"`
- UUID string `xml:"uuid,omitempty"`
- Memory *DomainMemory `xml:"memory"`
- CurrentMemory *DomainMemory `xml:"currentMemory"`
- MaximumMemory *DomainMaxMemory `xml:"maxMemory"`
- VCPU *DomainVCPU `xml:"vcpu"`
- Resource *DomainResource `xml:"resource"`
- SysInfo *DomainSysInfo `xml:"sysinfo"`
- OS *DomainOS `xml:"os"`
- Features *DomainFeatureList `xml:"features"`
- CPU *DomainCPU `xml:"cpu"`
- OnPoweroff string `xml:"on_poweroff,omitempty"`
- OnReboot string `xml:"on_reboot,omitempty"`
- OnCrash string `xml:"on_crash,omitempty"`
- Devices *DomainDeviceList `xml:"devices"`
+ XMLName xml.Name `xml:"domain"`
+ XMLNS_QEMU string `xml:"xmlns qemu,attr,omitempty"`
+ Type string `xml:"type,attr,omitempty"`
+ Name string `xml:"name"`
+ UUID string `xml:"uuid,omitempty"`
+ Memory *DomainMemory `xml:"memory"`
+ CurrentMemory *DomainMemory `xml:"currentMemory"`
+ MaximumMemory *DomainMaxMemory `xml:"maxMemory"`
+ VCPU *DomainVCPU `xml:"vcpu"`
+ Resource *DomainResource `xml:"resource"`
+ SysInfo *DomainSysInfo `xml:"sysinfo"`
+ OS *DomainOS `xml:"os"`
+ Features *DomainFeatureList `xml:"features"`
+ CPU *DomainCPU `xml:"cpu"`
+ OnPoweroff string `xml:"on_poweroff,omitempty"`
+ OnReboot string `xml:"on_reboot,omitempty"`
+ OnCrash string `xml:"on_crash,omitempty"`
+ Devices *DomainDeviceList `xml:"devices"`
+ QEMUCommandline *DomainQEMUCommandline `xml:"qemu commandline"`
}
func (d *Domain) Unmarshal(doc string) error {
diff --git a/domain_test.go b/domain_test.go
index 47e5e26..0aa5938 100644
--- a/domain_test.go
+++ b/domain_test.go
@@ -1141,6 +1141,34 @@ var domainTestData = []struct {
`</domain>`,
},
},
+ {
+ Object: &Domain{
+ Type: "qemu",
+ Name: "test",
+ XMLNS_QEMU: "http://libvirt.org/schemas/domain/qemu/1.0",
+ QEMUCommandline: &DomainQEMUCommandline{
+ Args: []DomainQEMUCommandlineArg{
+ DomainQEMUCommandlineArg{Value: "-newarg"},
+ DomainQEMUCommandlineArg{Value: "-oldarg"},
+ },
+ Envs: []DomainQEMUCommandlineEnv{
+ DomainQEMUCommandlineEnv{Name: "QEMU_ENV", Value: "VAL"},
+ DomainQEMUCommandlineEnv{Name: "QEMU_VAR", Value: "VAR"},
+ },
+ },
+ },
+ Expected: []string{
+ `<domain xmlns:_xmlns="xmlns" _xmlns:qemu="http://libvirt.org/schemas/domain/qemu/1.0" type="qemu">`,
+ ` <name>test</name>`,
+ ` <commandline xmlns="qemu">`,
+ ` <arg xmlns="qemu" value="-newarg"></arg>`,
+ ` <arg xmlns="qemu" value="-oldarg"></arg>`,
+ ` <env xmlns="qemu" name="QEMU_ENV" value="VAL"></env>`,
+ ` <env xmlns="qemu" name="QEMU_VAR" value="VAR"></env>`,
+ ` </commandline>`,
+ `</domain>`,
+ },
+ },
/* Tests for sub-documents that can be hotplugged */
{
--
2.13.2
7 years, 4 months
[libvirt] [PATCH] tools: domdisplay command is not freeing the domain pointer.
by Julio Faracco
The command 'domdisplay' is not freeing the domain pointer properly in
cleanup section. See the error below:
virsh # domdisplay WINDOWS7
vnc://127.0.0.1:0
virsh # quit
error: One or more references were leaked after disconnect from the hypervisor
Valgrind report:
==29168== 66 (56 direct, 10 indirect) bytes in 1 blocks are definitely lost in loss record 154 of 239
==29168== at 0x4C2FB55: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==29168== by 0x5505324: virAllocVar (viralloc.c:560)
==29168== by 0x555A61B: virObjectNew (virobject.c:199)
==29168== by 0x561F367: virGetDomain (datatypes.c:284)
==29168== by 0x5680979: get_nonnull_domain (remote_driver.c:8143)
==29168== by 0x5680979: remoteDomainLookupByName (remote_client_bodies.h:3047)
==29168== by 0x5623D9A: virDomainLookupByName (libvirt-domain.c:425)
==29168== by 0x160480: virshLookupDomainInternal (virsh-util.c:59)
==29168== by 0x160547: virshCommandOptDomainBy (virsh-util.c:98)
==29168== by 0x13D3A9: cmdDomDisplay (virsh-domain.c:10963)
==29168== by 0x165680: vshCommandRun (vsh.c:1327)
==29168== by 0x12E320: main (virsh.c:953)
Signed-off-by: Julio Faracco <jcfaracco(a)gmail.com>
---
tools/virsh-domain.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 55f4e14..8f3d4d5 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -11153,6 +11153,7 @@ cmdDomDisplay(vshControl *ctl, const vshCmd *cmd)
VIR_FREE(output);
xmlXPathFreeContext(ctxt);
xmlFreeDoc(xml);
+ virshDomainFree(dom);
return ret;
}
--
2.7.4
7 years, 4 months
[libvirt] [PATCH 0/2] qemu: Parameter usage cleanups
by Ján Tomko
Here be patches.
Ján Tomko (2):
qemuDomainSetSchedulerParametersFlags: use the value_ul variable
qemuDomainSetInterfaceParameters: use the temporary params variable
src/qemu/qemu_driver.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
--
2.13.0
7 years, 4 months
[libvirt] [PATCH] configure: fix typo in nss error message
by Pino Toscano
This error message refers to the lack of network, not to yajl.
Signed-off-by: Pino Toscano <ptoscano(a)redhat.com>
---
m4/virt-nss.m4 | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/m4/virt-nss.m4 b/m4/virt-nss.m4
index 8840e7b..951a74e 100644
--- a/m4/virt-nss.m4
+++ b/m4/virt-nss.m4
@@ -37,7 +37,7 @@ AC_DEFUN([LIBVIRT_CHECK_NSS],[
if test "x$with_network" != "xyes" ; then
if test "x$with_nss_plugin" = "xyes" ; then
- AC_MSG_ERROR([Can't build nss plugin without yajl])
+ AC_MSG_ERROR([Can't build nss plugin without network])
else
with_nss_plugin=no
fi
--
2.9.4
7 years, 4 months
[libvirt] [PATCH] test: adding tests to virStrToDouble() inside virstringtest.
by Julio Faracco
There are no occurrences of tests related to Strings and Double numbers
inside virstringtest.c. This commit introduces some tests to validate the
conversion. The test does not include locale changes yet.
Signed-off-by: Julio Faracco <jcfaracco(a)gmail.com>
---
tests/virstringtest.c | 80 +++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 80 insertions(+)
diff --git a/tests/virstringtest.c b/tests/virstringtest.c
index 97c6e76..cc95d3c 100644
--- a/tests/virstringtest.c
+++ b/tests/virstringtest.c
@@ -652,6 +652,48 @@ testStringToLong(const void *opaque)
}
+struct stringToDoubleData {
+ const char *str;
+ const char *end_ptr;
+ double res;
+};
+
+/* This test checks if double strings are successfully converted to double
+ * number considering the byproduct string too. */
+static int
+testStringToDouble(const void *opaque)
+{
+ const struct stringToDoubleData *data = opaque;
+ int ret = -1;
+ char *end_ptr = NULL;
+ double res = 0;
+
+ /* end_ptr returns or a substring or an empty string.
+ * It never returns a NULL pointer. */
+ if ((ret = virStrToDouble(data->str,
+ data->end_ptr ? &end_ptr : NULL,
+ &res)) < 0) {
+ fprintf(stderr, "Convert error of '%s', expected '%lf'\n",
+ data->str, data->res);
+ return ret;
+ }
+
+ if (res != data->res) {
+ fprintf(stderr, "Returned '%lf', expected '%lf'\n",
+ res, data->res);
+ return -1;
+ }
+
+ /* Comparing substrings. */
+ if (STRNEQ_NULLABLE(end_ptr, data->end_ptr)) {
+ fprintf(stderr, "Expected substring '%s', but got '%s'\n",
+ end_ptr, data->end_ptr);
+ return -1;
+ }
+
+ return ret;
+}
+
/* The point of this test is to check whether all members of the array are
* freed. The test has to be checked using valgrind. */
static int
@@ -965,6 +1007,44 @@ mymain(void)
TEST_STRTOL("-18446744073709551616", NULL, 0, -1, 0U, -1,
0LL, -1, 0ULL, -1);
+#define TEST_STRTOD(str, end_ptr, res) \
+ do { \
+ struct stringToDoubleData data = { \
+ str, end_ptr, res, \
+ }; \
+ if (virTestRun("virStringToDouble '" str "'", \
+ testStringToDouble, &data) < 0) \
+ ret = -1; \
+ } while (0)
+
+ /* Simple numbers. */
+ TEST_STRTOD("0.0", NULL, 0);
+ TEST_STRTOD("1.0", NULL, 1);
+ TEST_STRTOD("3.14159", NULL, 3.14159);
+ TEST_STRTOD("0.57721", NULL, 0.57721);
+
+ /* Testing ending string. */
+ TEST_STRTOD("2.718", "", 2.718);
+ TEST_STRTOD("2.718 281 828 459", " 281 828 459", 2.718);
+ TEST_STRTOD("2.718,281,828,459", ",281,828,459", 2.718);
+
+ /* Scientific numbers. */
+ TEST_STRTOD("3.14159e+000", NULL, 3.14159);
+ TEST_STRTOD("2.00600e+003", NULL, 2006);
+ TEST_STRTOD("1.00000e-010", NULL, 1e-010);
+
+ /* Negative numbers. */
+ TEST_STRTOD("-1.6180339887", NULL, -1.6180339887);
+ TEST_STRTOD("-0.00031e-010", NULL, -0.00031e-010);
+
+ /* Long numbers. */
+ TEST_STRTOD("57089907708238388904078437636832797971793838081897.0",
+ NULL,
+ 57089907708238388904078437636832797971793838081897.0);
+ TEST_STRTOD("3.141592653589793238462643383279502884197169399375105",
+ NULL,
+ 3.141592653589793238462643383279502884197169399375105);
+
/* test virStringListFreeCount */
if (virTestRun("virStringListFreeCount", testVirStringListFreeCount,
NULL) < 0)
--
2.7.4
7 years, 4 months