[libvirt] [PATCH] Transform VIR_ERROR into VIR_WARN in detect_scsi_host_caps
by Cédric Bosdonnat
If detect_scsi_host_caps reports errors but keeps libvirtd going on
startup, the user is mislead by the error messages. Transforming them
into warning still shows the problems, but indicates this is not fatal.
---
po/POTFILES.in | 1 -
src/node_device/node_device_linux_sysfs.c | 22 +++++++++++-----------
2 files changed, 11 insertions(+), 12 deletions(-)
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 89c6a44..1439ae4 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -92,7 +92,6 @@ src/network/bridge_driver_linux.c
src/network/leaseshelper.c
src/node_device/node_device_driver.c
src/node_device/node_device_hal.c
-src/node_device/node_device_linux_sysfs.c
src/node_device/node_device_udev.c
src/nodeinfo.c
src/nwfilter/nwfilter_dhcpsnoop.c
diff --git a/src/node_device/node_device_linux_sysfs.c b/src/node_device/node_device_linux_sysfs.c
index be95e51..4a95b2b 100644
--- a/src/node_device/node_device_linux_sysfs.c
+++ b/src/node_device/node_device_linux_sysfs.c
@@ -62,7 +62,7 @@ detect_scsi_host_caps(union _virNodeDevCapData *d)
d->scsi_host.host,
"port_name",
&d->scsi_host.wwpn) < 0) {
- VIR_ERROR(_("Failed to read WWPN for host%d"), d->scsi_host.host);
+ VIR_WARN("Failed to read WWPN for host%d", d->scsi_host.host);
goto cleanup;
}
@@ -70,7 +70,7 @@ detect_scsi_host_caps(union _virNodeDevCapData *d)
d->scsi_host.host,
"node_name",
&d->scsi_host.wwnn) < 0) {
- VIR_ERROR(_("Failed to read WWNN for host%d"), d->scsi_host.host);
+ VIR_WARN("Failed to read WWNN for host%d", d->scsi_host.host);
goto cleanup;
}
@@ -78,8 +78,8 @@ detect_scsi_host_caps(union _virNodeDevCapData *d)
d->scsi_host.host,
"fabric_name",
&d->scsi_host.fabric_wwn) < 0) {
- VIR_ERROR(_("Failed to read fabric WWN for host%d"),
- d->scsi_host.host);
+ VIR_WARN("Failed to read fabric WWN for host%d",
+ d->scsi_host.host);
goto cleanup;
}
}
@@ -91,8 +91,8 @@ detect_scsi_host_caps(union _virNodeDevCapData *d)
d->scsi_host.host,
"max_npiv_vports",
&max_vports) < 0) {
- VIR_ERROR(_("Failed to read max_npiv_vports for host%d"),
- d->scsi_host.host);
+ VIR_WARN("Failed to read max_npiv_vports for host%d",
+ d->scsi_host.host);
goto cleanup;
}
@@ -100,22 +100,22 @@ detect_scsi_host_caps(union _virNodeDevCapData *d)
d->scsi_host.host,
"npiv_vports_inuse",
&vports) < 0) {
- VIR_ERROR(_("Failed to read npiv_vports_inuse for host%d"),
- d->scsi_host.host);
+ VIR_WARN("Failed to read npiv_vports_inuse for host%d",
+ d->scsi_host.host);
goto cleanup;
}
if (virStrToLong_i(max_vports, NULL, 10,
&d->scsi_host.max_vports) < 0) {
- VIR_ERROR(_("Failed to parse value of max_npiv_vports '%s'"),
+ VIR_WARN("Failed to parse value of max_npiv_vports '%s'",
max_vports);
goto cleanup;
}
if (virStrToLong_i(vports, NULL, 10,
&d->scsi_host.vports) < 0) {
- VIR_ERROR(_("Failed to parse value of npiv_vports_inuse '%s'"),
- vports);
+ VIR_WARN("Failed to parse value of npiv_vports_inuse '%s'",
+ vports);
goto cleanup;
}
}
--
1.8.4.5
10 years, 1 month
[libvirt] [PATCH v2] Memory : Allow specification of 'units' for numa nodes.
by Prerna Saxena
Reference :
=======
v1: http://www.spinics.net/linux/fedora/libvir/msg105516.html
Changes since v1:
===========
1) As suggested by Michal, a new function "virCPUNumaCellMemoryParseXML" has
been introduced for neat computation of NUMA memory.
2) Patches 2 & 3 of v1 have been merged together into this cumulative patch.
3) Corresponding documentation added.
>From 2199d97b88cf9eab29788fb0e440c4b0a0bb23ec Mon Sep 17 00:00:00 2001
From: Prerna Saxena <prerna(a)linux.vnet.ibm.com>
Date: Mon, 3 Nov 2014 07:53:59 +0530
CPU numa topology implicitly allows memory specification in 'KiB'.
Enabling this to accept the 'unit' in which memory needs to be specified.
This now allows users to specify memory in units of choice, and
lists the same in 'KiB' -- just like other 'memory' elements in XML.
<numa>
<cell cpus='0-3' memory='1024' unit='MiB' />
<cell cpus='4-7' memory='1024' unit='MiB' />
</numa>
Also augment test cases to correctly model NUMA memory specification.
This adds the tag 'unit="KiB"' for memory attribute in NUMA cells.
Signed-off-by: Prerna Saxena <prerna(a)linux.vnet.ibm.com>
---
docs/formatdomain.html.in | 6 ++-
docs/schemas/domaincommon.rng | 5 ++
src/conf/cpu_conf.c | 62 ++++++++++++++++------
.../qemuxml2argv-cpu-numa-disjoint.xml | 4 +-
.../qemuxml2argv-cpu-numa-memshared.xml | 4 +-
tests/qemuxml2argvdata/qemuxml2argv-cpu-numa1.xml | 4 +-
tests/qemuxml2argvdata/qemuxml2argv-cpu-numa2.xml | 4 +-
tests/qemuxml2argvdata/qemuxml2argv-cpu-numa3.xml | 4 +-
.../qemuxml2argv-hugepages-pages.xml | 8 +--
.../qemuxml2argv-hugepages-pages2.xml | 4 +-
.../qemuxml2argv-hugepages-pages3.xml | 4 +-
.../qemuxml2argv-hugepages-pages4.xml | 8 +--
.../qemuxml2argv-hugepages-shared.xml | 8 +--
.../qemuxml2argv-numatune-auto-prefer.xml | 2 +-
.../qemuxml2argv-numatune-memnode-no-memory.xml | 4 +-
.../qemuxml2argv-numatune-memnode.xml | 6 +--
.../qemuxml2argv-numatune-memnodes-problematic.xml | 4 +-
.../qemuxml2xmlout-cpu-numa1.xml | 4 +-
.../qemuxml2xmlout-cpu-numa2.xml | 4 +-
.../qemuxml2xmlout-numatune-auto-prefer.xml | 2 +-
.../qemuxml2xmlout-numatune-memnode.xml | 6 +--
21 files changed, 97 insertions(+), 60 deletions(-)
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 0099ce7..24afc87 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -1140,8 +1140,8 @@
<cpu>
...
<numa>
- <cell id='0' cpus='0-3' memory='512000'/>
- <cell id='1' cpus='4-7' memory='512000' memAccess='shared'/>
+ <cell id='0' cpus='0-3' memory='512000' unit='KiB'/>
+ <cell id='1' cpus='4-7' memory='512000' unit='KiB' memAccess='shared'/>
</numa>
...
</cpu>
@@ -1152,6 +1152,8 @@
<code>cpus</code> specifies the CPU or range of CPUs that are
part of the node. <code>memory</code> specifies the node memory
in kibibytes (i.e. blocks of 1024 bytes).
+ <span class="since">Since 1.2.11</span> one can specify an additional
+ <code>unit</code> attribute to describe the node memory unit.
<span class="since">Since 1.2.7</span> all cells should
have <code>id</code> attribute in case referring to some cell is
necessary in the code, otherwise the cells are
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 20d81ae..44cabad 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -4144,6 +4144,11 @@
<ref name="memoryKB"/>
</attribute>
<optional>
+ <attribute name="unit">
+ <ref name="unit"/>
+ </attribute>
+ </optional>
+ <optional>
<attribute name="memAccess">
<choice>
<value>shared</value>
diff --git a/src/conf/cpu_conf.c b/src/conf/cpu_conf.c
index 5475c07..a0a60c8 100644
--- a/src/conf/cpu_conf.c
+++ b/src/conf/cpu_conf.c
@@ -177,6 +177,48 @@ virCPUDefCopy(const virCPUDef *cpu)
return NULL;
}
+static int
+virCPUNumaCellMemoryParseXML(xmlNodePtr node,
+ xmlXPathContextPtr ctxt,
+ unsigned long long* cellMemory)
+{
+ int ret = -1;
+ xmlNodePtr oldnode = ctxt->node;
+ unsigned long long bytes, max;
+ char *unit = NULL;
+
+ ctxt->node = node;
+
+ /* 32 vs 64 bit will differ in value of upper memory bound.
+ * On 32-bit machines, our bound is 0xffffffff * KiB. On 64-bit
+ * machines, our bound is off_t (2^63).
+ */
+ if (sizeof(unsigned long) < sizeof(long long))
+ max = 1024ull * ULONG_MAX;
+ else
+ max = LLONG_MAX;
+
+ if (virXPathULongLong("string(./@memory)", ctxt, &bytes) < 0) {
+ virReportError(VIR_ERR_XML_DETAIL, "%s",
+ _("unable to parse memory size attribute"));
+ goto cleanup;
+ }
+
+ unit = virXPathString("string(./@unit)", ctxt);
+
+ if (virScaleInteger(&bytes, unit, 1024, max) < 0)
+ goto cleanup;
+
+ *cellMemory = VIR_DIV_UP(bytes, 1024);
+
+ ret = 0;
+ cleanup:
+ VIR_FREE(unit);
+ ctxt->node = oldnode;
+ return ret;
+
+}
+
virCPUDefPtr
virCPUDefParseXML(xmlNodePtr node,
xmlXPathContextPtr ctxt,
@@ -440,7 +482,7 @@ virCPUDefParseXML(xmlNodePtr node,
def->ncells = n;
for (i = 0; i < n; i++) {
- char *cpus, *memory, *memAccessStr;
+ char *cpus, *memAccessStr;
int ret, ncpus = 0;
unsigned int cur_cell;
char *tmp = NULL;
@@ -489,21 +531,8 @@ virCPUDefParseXML(xmlNodePtr node,
goto error;
def->cells_cpus += ncpus;
- memory = virXMLPropString(nodes[i], "memory");
- if (!memory) {
- virReportError(VIR_ERR_XML_ERROR, "%s",
- _("Missing 'memory' attribute in NUMA cell"));
- goto error;
- }
-
- ret = virStrToLong_ull(memory, NULL, 10, &def->cells[cur_cell].mem);
- if (ret == -1) {
- virReportError(VIR_ERR_XML_ERROR, "%s",
- _("Invalid 'memory' attribute in NUMA cell"));
- VIR_FREE(memory);
- goto error;
- }
- VIR_FREE(memory);
+ virCPUNumaCellMemoryParseXML(nodes[i],
+ ctxt, &def->cells[cur_cell].mem);
memAccessStr = virXMLPropString(nodes[i], "memAccess");
if (memAccessStr) {
@@ -703,6 +732,7 @@ virCPUDefFormatBuf(virBufferPtr buf,
virBufferAsprintf(buf, " id='%zu'", i);
virBufferAsprintf(buf, " cpus='%s'", def->cells[i].cpustr);
virBufferAsprintf(buf, " memory='%llu'", def->cells[i].mem);
+ virBufferAddLit(buf, " unit='KiB'");
if (memAccess)
virBufferAsprintf(buf, " memAccess='%s'",
virMemAccessTypeToString(memAccess));
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cpu-numa-disjoint.xml b/tests/qemuxml2argvdata/qemuxml2argv-cpu-numa-disjoint.xml
index 474a238..bdffcd1 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-cpu-numa-disjoint.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-cpu-numa-disjoint.xml
@@ -11,8 +11,8 @@
<cpu>
<topology sockets='2' cores='4' threads='2'/>
<numa>
- <cell id='0' cpus='0-3,8-11' memory='109550'/>
- <cell id='1' cpus='4-7,12-15' memory='109550'/>
+ <cell id='0' cpus='0-3,8-11' memory='109550' unit='KiB'/>
+ <cell id='1' cpus='4-7,12-15' memory='109550' unit='KiB'/>
</numa>
</cpu>
<clock offset='utc'/>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cpu-numa-memshared.xml b/tests/qemuxml2argvdata/qemuxml2argv-cpu-numa-memshared.xml
index cf7c040..c638ffa 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-cpu-numa-memshared.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-cpu-numa-memshared.xml
@@ -11,8 +11,8 @@
<cpu>
<topology sockets='2' cores='4' threads='2'/>
<numa>
- <cell id='0' cpus='0-7' memory='109550' memAccess='shared'/>
- <cell id='1' cpus='8-15' memory='109550' memAccess='private'/>
+ <cell id='0' cpus='0-7' memory='109550' unit='KiB' memAccess='shared'/>
+ <cell id='1' cpus='8-15' memory='109550' unit='KiB' memAccess='private'/>
</numa>
</cpu>
<clock offset='utc'/>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cpu-numa1.xml b/tests/qemuxml2argvdata/qemuxml2argv-cpu-numa1.xml
index 0543f7f..20120e9 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-cpu-numa1.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-cpu-numa1.xml
@@ -11,8 +11,8 @@
<cpu>
<topology sockets='2' cores='4' threads='2'/>
<numa>
- <cell cpus='0-7' memory='109550'/>
- <cell cpus='8-15' memory='109550'/>
+ <cell cpus='0-7' memory='109550' unit='KiB'/>
+ <cell cpus='8-15' memory='109550' unit='KiB'/>
</numa>
</cpu>
<clock offset='utc'/>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cpu-numa2.xml b/tests/qemuxml2argvdata/qemuxml2argv-cpu-numa2.xml
index 0a5f9fc..a90e7a2 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-cpu-numa2.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-cpu-numa2.xml
@@ -11,8 +11,8 @@
<cpu>
<topology sockets='2' cores='4' threads='2'/>
<numa>
- <cell id='1' cpus='8-15' memory='109550'/>
- <cell id='0' cpus='0-7' memory='109550'/>
+ <cell id='1' cpus='8-15' memory='109550' unit='KiB'/>
+ <cell id='0' cpus='0-7' memory='109550' unit='KiB'/>
</numa>
</cpu>
<clock offset='utc'/>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cpu-numa3.xml b/tests/qemuxml2argvdata/qemuxml2argv-cpu-numa3.xml
index fa3070d..ea2dc81 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-cpu-numa3.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-cpu-numa3.xml
@@ -11,8 +11,8 @@
<cpu>
<topology sockets='2' cores='4' threads='2'/>
<numa>
- <cell id='1' cpus='0-7' memory='109550'/>
- <cell id='2' cpus='8-15' memory='109550'/>
+ <cell id='1' cpus='0-7' memory='109550' unit='KiB'/>
+ <cell id='2' cpus='8-15' memory='109550' unit='KiB'/>
</numa>
</cpu>
<clock offset='utc'/>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-hugepages-pages.xml b/tests/qemuxml2argvdata/qemuxml2argv-hugepages-pages.xml
index 5ad0695..b67df2f 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-hugepages-pages.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-hugepages-pages.xml
@@ -20,10 +20,10 @@
</os>
<cpu>
<numa>
- <cell id='0' cpus='0' memory='1048576'/>
- <cell id='1' cpus='1' memory='1048576'/>
- <cell id='2' cpus='2' memory='1048576'/>
- <cell id='3' cpus='3' memory='1048576'/>
+ <cell id='0' cpus='0' memory='1048576' unit='KiB'/>
+ <cell id='1' cpus='1' memory='1048576' unit='KiB'/>
+ <cell id='2' cpus='2' memory='1048576' unit='KiB'/>
+ <cell id='3' cpus='3' memory='1048576' unit='KiB'/>
</numa>
</cpu>
<clock offset='utc'/>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-hugepages-pages2.xml b/tests/qemuxml2argvdata/qemuxml2argv-hugepages-pages2.xml
index 3df870b..6afa6ef 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-hugepages-pages2.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-hugepages-pages2.xml
@@ -15,8 +15,8 @@
</os>
<cpu>
<numa>
- <cell id='0' cpus='0' memory='262144'/>
- <cell id='1' cpus='1' memory='786432'/>
+ <cell id='0' cpus='0' memory='262144' unit='KiB'/>
+ <cell id='1' cpus='1' memory='786432' unit='KiB'/>
</numa>
</cpu>
<clock offset='utc'/>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-hugepages-pages3.xml b/tests/qemuxml2argvdata/qemuxml2argv-hugepages-pages3.xml
index 35aa2cf..21f4985 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-hugepages-pages3.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-hugepages-pages3.xml
@@ -15,8 +15,8 @@
</os>
<cpu>
<numa>
- <cell id='0' cpus='0' memory='262144'/>
- <cell id='1' cpus='1' memory='786432'/>
+ <cell id='0' cpus='0' memory='262144' unit='KiB'/>
+ <cell id='1' cpus='1' memory='786432' unit='KiB'/>
</numa>
</cpu>
<clock offset='utc'/>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-hugepages-pages4.xml b/tests/qemuxml2argvdata/qemuxml2argv-hugepages-pages4.xml
index a3ed29b..eb18f24 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-hugepages-pages4.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-hugepages-pages4.xml
@@ -20,10 +20,10 @@
</os>
<cpu>
<numa>
- <cell id='0' cpus='0' memory='1048576'/>
- <cell id='1' cpus='1' memory='1048576'/>
- <cell id='2' cpus='2' memory='1048576'/>
- <cell id='3' cpus='3' memory='1048576'/>
+ <cell id='0' cpus='0' memory='1048576' unit='KiB'/>
+ <cell id='1' cpus='1' memory='1048576' unit='KiB'/>
+ <cell id='2' cpus='2' memory='1048576' unit='KiB'/>
+ <cell id='3' cpus='3' memory='1048576' unit='KiB'/>
</numa>
</cpu>
<clock offset='utc'/>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-hugepages-shared.xml b/tests/qemuxml2argvdata/qemuxml2argv-hugepages-shared.xml
index e7db69c..52ca2f9 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-hugepages-shared.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-hugepages-shared.xml
@@ -20,10 +20,10 @@
</os>
<cpu>
<numa>
- <cell id='0' cpus='0' memory='1048576'/>
- <cell id='1' cpus='1' memory='1048576' memAccess='shared'/>
- <cell id='2' cpus='2' memory='1048576' memAccess='private'/>
- <cell id='3' cpus='3' memory='1048576'/>
+ <cell id='0' cpus='0' memory='1048576' unit='KiB'/>
+ <cell id='1' cpus='1' memory='1048576' unit='KiB' memAccess='shared'/>
+ <cell id='2' cpus='2' memory='1048576' unit='KiB' memAccess='private'/>
+ <cell id='3' cpus='3' memory='1048576' unit='KiB'/>
</numa>
</cpu>
<clock offset='utc'/>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-numatune-auto-prefer.xml b/tests/qemuxml2argvdata/qemuxml2argv-numatune-auto-prefer.xml
index 63f0d1f..8f80962 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-numatune-auto-prefer.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-numatune-auto-prefer.xml
@@ -13,7 +13,7 @@
</os>
<cpu>
<numa>
- <cell id='0' cpus='0' memory='65536'/>
+ <cell id='0' cpus='0' memory='65536' unit='KiB'/>
</numa>
</cpu>
<clock offset='utc'/>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-numatune-memnode-no-memory.xml b/tests/qemuxml2argvdata/qemuxml2argv-numatune-memnode-no-memory.xml
index 4b2efa2..886a07a 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-numatune-memnode-no-memory.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-numatune-memnode-no-memory.xml
@@ -13,8 +13,8 @@
</os>
<cpu>
<numa>
- <cell id='0' cpus='0' memory='32768'/>
- <cell id='1' cpus='1' memory='32768'/>
+ <cell id='0' cpus='0' memory='32768' unit='KiB'/>
+ <cell id='1' cpus='1' memory='32768' unit='KiB'/>
</numa>
</cpu>
<clock offset='utc'/>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-numatune-memnode.xml b/tests/qemuxml2argvdata/qemuxml2argv-numatune-memnode.xml
index 440413b..8912017 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-numatune-memnode.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-numatune-memnode.xml
@@ -15,9 +15,9 @@
</os>
<cpu>
<numa>
- <cell id='0' cpus='0' memory='20002'/>
- <cell id='1' cpus='1-27,29' memory='660066'/>
- <cell id='2' cpus='28-31,^29' memory='24002400'/>
+ <cell id='0' cpus='0' memory='20002' unit='KiB'/>
+ <cell id='1' cpus='1-27,29' memory='660066' unit='KiB'/>
+ <cell id='2' cpus='28-31,^29' memory='24002400' unit='KiB'/>
</numa>
</cpu>
<clock offset='utc'/>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-numatune-memnodes-problematic.xml b/tests/qemuxml2argvdata/qemuxml2argv-numatune-memnodes-problematic.xml
index bb4e4af..e1d115c 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-numatune-memnodes-problematic.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-numatune-memnodes-problematic.xml
@@ -14,8 +14,8 @@
</os>
<cpu>
<numa>
- <cell id='0' cpus='0' memory='32768'/>
- <cell id='1' cpus='1' memory='32768'/>
+ <cell id='0' cpus='0' memory='32768' unit='KiB'/>
+ <cell id='1' cpus='1' memory='32768' unit='KiB'/>
</numa>
</cpu>
<clock offset='utc'/>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-numa1.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-numa1.xml
index 227bf1c..58f40b9 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-numa1.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-numa1.xml
@@ -11,8 +11,8 @@
<cpu>
<topology sockets='2' cores='4' threads='2'/>
<numa>
- <cell id='0' cpus='0-7' memory='109550'/>
- <cell id='1' cpus='8-15' memory='109550'/>
+ <cell id='0' cpus='0-7' memory='109550' unit='KiB'/>
+ <cell id='1' cpus='8-15' memory='109550' unit='KiB'/>
</numa>
</cpu>
<clock offset='utc'/>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-numa2.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-numa2.xml
index 227bf1c..58f40b9 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-numa2.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-numa2.xml
@@ -11,8 +11,8 @@
<cpu>
<topology sockets='2' cores='4' threads='2'/>
<numa>
- <cell id='0' cpus='0-7' memory='109550'/>
- <cell id='1' cpus='8-15' memory='109550'/>
+ <cell id='0' cpus='0-7' memory='109550' unit='KiB'/>
+ <cell id='1' cpus='8-15' memory='109550' unit='KiB'/>
</numa>
</cpu>
<clock offset='utc'/>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-numatune-auto-prefer.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-numatune-auto-prefer.xml
index 19761b4..1000e9f 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-numatune-auto-prefer.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-numatune-auto-prefer.xml
@@ -13,7 +13,7 @@
</os>
<cpu>
<numa>
- <cell id='0' cpus='0' memory='65536'/>
+ <cell id='0' cpus='0' memory='65536' unit='KiB'/>
</numa>
</cpu>
<clock offset='utc'/>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-numatune-memnode.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-numatune-memnode.xml
index 82b5f61..ffc57cf 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-numatune-memnode.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-numatune-memnode.xml
@@ -15,9 +15,9 @@
</os>
<cpu>
<numa>
- <cell id='0' cpus='0' memory='20002'/>
- <cell id='1' cpus='1-27,29' memory='660066'/>
- <cell id='2' cpus='28-31,^29' memory='24002400'/>
+ <cell id='0' cpus='0' memory='20002' unit='KiB'/>
+ <cell id='1' cpus='1-27,29' memory='660066' unit='KiB'/>
+ <cell id='2' cpus='28-31,^29' memory='24002400' unit='KiB'/>
</numa>
</cpu>
<clock offset='utc'/>
--
1.9.3
--
Prerna Saxena
Linux Technology Centre,
IBM Systems and Technology Lab,
Bangalore, India
10 years, 1 month
[libvirt] is there a notification when watchdog triggers?
by Chris Friesen
The libvirt.org docs say "A virtual hardware watchdog device can be
added to the guest via the watchdog element....Currently libvirt does
not support notification when the watchdog fires. This feature is
planned for a future version of libvirt."
Is that still accurate? Or does libvirt now support notifications?
Chris
10 years, 1 month
[libvirt] [PATCH] qemu: don't setup cpuset.mems if memory mode in numatune is 'preferred'
by Wang Rui
If the memory mode is specified as preferred, we get the following error when
starting domain.
error: Unable to write to '$my_cgroup_path/cpuset.mems': Device or resource busy
XML is configured with numatune as follows:
<numatune>
<memory mode='preferred' nodeset='0'/>
</numatune>
If memory mode is 'preferred', cpuset.mems in cgroup shouldn't be set to
'nodeset'. I find that maybe commit 1a7be8c600905aa07ac2d78293336ba8523ad48e
changes the former logic of checking mode in virDomainNumatuneGetNodeset.
Signed-off-by: Wang Rui <moon.wangrui(a)huawei.com>
---
src/qemu/qemu_cgroup.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c
index b5bdb36..8685d6f 100644
--- a/src/qemu/qemu_cgroup.c
+++ b/src/qemu/qemu_cgroup.c
@@ -618,6 +618,11 @@ qemuSetupCpusetMems(virDomainObjPtr vm,
if (!virCgroupHasController(priv->cgroup, VIR_CGROUP_CONTROLLER_CPUSET))
return 0;
+ if (virDomainNumatuneGetMode(vm->def->numatune, -1) !=
+ VIR_DOMAIN_NUMATUNE_MEM_STRICT) {
+ return 0;
+ }
+
if (virDomainNumatuneMaybeFormatNodeset(vm->def->numatune,
nodemask,
&mem_mask, -1) < 0)
--
1.7.12.4
10 years, 1 month
[libvirt] [PATCH] virnuma: add notset NULL check in virNumaSetupMemoryPolicy
by Chen Fan
introduce by commit c63ef0452b, when nodeset is NULL, validation
will pass in virNumaSetupMemoryPolicy, but virBitmapNextSetBit
must ensure bitmap is not Null. there will cause a segmentation
fault. this patch fixed it.
Signed-off-by: Chen Fan <chen.fan.fnst(a)cn.fujitsu.com>
---
src/util/virnuma.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/util/virnuma.c b/src/util/virnuma.c
index 06520f7..b8d76f4 100644
--- a/src/util/virnuma.c
+++ b/src/util/virnuma.c
@@ -97,6 +97,9 @@ virNumaSetupMemoryPolicy(virDomainNumatuneMemMode mode,
size_t i;
int maxnode = 0;
+ if (!nodeset)
+ return 0;
+
if (!virNumaNodesetIsAvailable(nodeset))
return -1;
--
1.9.3
10 years, 1 month
[libvirt] [v2 PATCH] doc: Fix a mismatch attribute name
by Luyao Huang
>From virAccessDriverPolkitCheckInterface function, we know this
attribute should named: interface_macaddr
Signed-off-by: Luyao Huang <lhuang(a)redhat.com>
---
docs/aclpolkit.html.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/docs/aclpolkit.html.in b/docs/aclpolkit.html.in
index 91b5296..e5a9b16 100644
--- a/docs/aclpolkit.html.in
+++ b/docs/aclpolkit.html.in
@@ -121,7 +121,7 @@
<td>Name of the network interface, unique to the local host</td>
</tr>
<tr>
- <td>interface_mac</td>
+ <td>interface_macaddr</td>
<td>MAC address of the network interface, not unique</td>
</tr>
</tbody>
--
1.8.3.1
10 years, 1 month
[libvirt] [PATCH] Fix a mismatch attribute name
by Luyao Huang
>From libvirt.org we know this attribute named:
interface_mac MAC address of the network interface, not unique
Signed-off-by: Luyao Huang <lhuang(a)redhat.com>
---
src/access/viraccessdriverpolkit.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/access/viraccessdriverpolkit.c b/src/access/viraccessdriverpolkit.c
index 3136be7..0e07053 100644
--- a/src/access/viraccessdriverpolkit.c
+++ b/src/access/viraccessdriverpolkit.c
@@ -206,7 +206,7 @@ virAccessDriverPolkitCheckInterface(virAccessManagerPtr manager,
const char *attrs[] = {
"connect_driver", driverName,
"interface_name", iface->name,
- "interface_macaddr", iface->mac,
+ "interface_mac", iface->mac,
NULL,
};
--
1.8.3.1
10 years, 1 month
[libvirt] [Patch v6 0/5] Libvirt CPU enhancements for Power KVM
by Prerna Saxena
This patch series is a collection of enhancements for PowerPC CPUs on PowerKVM.
The v5 of this series has been acked. I have just rebased the patches on top of
latest master and added a testcase.
Series Summary:
==========
Patch 1/5 : Introduce a new architecture 'ppc64le' for libvirt.
Patch 2/5 : Add libvirt support for VMs running in 'compat' mode on Power KVM.
Patch 3/5 : Improve PVR handling to fall back to cpu generation.
Patch 4/5 : Add documentation describing compat mode usage for PowerPC guests.
Patch 5/5 : Add a test case for compat mode.
Detail:
====
* PowerPC has traditionally been a Big-endian architecture. However, with PowerPC ISA version 2.07, it can run in Little-endian mode as well. IBM Power8 processors, compliant with ISA 2.07 allow launching VMs in little-endian mode. This is signified by 'ppc64le' architecture. Patch 1 adds this support to libvirt, to allow running VMs based on ppc64le architecture.
* Patch 2,3 tweak libvirt to correctly model PowerPC CPUs based on recent PowerKVM implementation.
PowerKVM permits VMs with vcpus in the following allowed modes :
i) Host native mode:
where the vcpu seen in the VM belongs to the same processor generation as the host.
Example: A POWER7 host, conforming to PowerISA version 2.06, will run VMs with "power7" vcpus.
ii) Binary Compatibility ("compat") mode:
PowerISA allows processors to run VMs in binary compatibility ("compat") mode supporting an older version of ISA.
As an example: In compatibility mode, a POWER7 host can run a "power6" VM, conforming to power ISA v2.05.
Similarly, a POWER8 host can run a "power7" VM conforming to PowerISA v2.06.
QEMU has recently added support to explicitly denote a VM running in compatibility mode through commits 6d9412ea & 8dfa3a5e85. Henceforth, VMs of type (i) will be invoked with the QEMU invocation "-cpu host", while VMs of type (ii) will be invoked using "-cpu host, compat=power6".
Now, an explicit cpu selection using "-cpu POWER6" is not valid. Instead, the recommended practice is to use the matching compat mode, if the requested cpu type differs from the host.
Patches 2-3 address various aspects of this change.
* Patch 2 : Adds support for generating the correct command line for QEMU. Existing xml semantics of 'host-model' are interpreted differently on PowerPc architecture to signify this type.
* Patch 3 : PowerKVM vCPUs differ uniquely across generations ( such as power6, power7, power8). Each generation signifies a new PowerISA version that exhibits features unique to that generation. The higher order 16 bits of PVR denote the processor generation and the lower order 16 bits denote the cpu chip (sub)version.
For all practical purposes of launching a VM, we care about the generation the vCPU will belong to, and not specifically the chip version. In fact, PowerKVM does not seek out specification of a unique chip version(such as POWER7_v2.3) for running a vCPU. This patch updates the libvirt PVR check to reflect this relationship.
* Patch 4 : Documentation is added to explain functionality introduced by Patch 2.
* Patch 5 : Added a test case for patch 2.
Changelog:
=========
v1 : https://www.redhat.com/archives/libvir-list/2014-June/msg01338.html
v2 : http://www.redhat.com/archives/libvir-list/2014-October/msg00351.html
v3 : http://www.mail-archive.com/libvir-list@redhat.com/msg104010.html
v4 : http://www.mail-archive.com/libvir-list@redhat.com/msg104067.html
v5 : http://www.mail-archive.com/libvir-list@redhat.com/msg104311.html
Changes since v5:
================
* Added a new patch which introduces a test case for compat mode.
* Fixed a whitespace in documentation patch #4.
* Added listing for Power8e cpu model in cpu_map.xml
Regards,
--
Prerna Saxena
Linux Technology Centre,
IBM Systems and Technology Lab,
Bangalore, India
10 years, 1 month
[libvirt] [[PATCH libvirt-java]] Implement Connect.listAllDomains
by Cédric Bosdonnat
From: Cédric Bosdonnat <cedric.bosdonnat(a)free.fr>
---
src/main/java/org/libvirt/Connect.java | 46 +++++++++++++++++++++++++
src/main/java/org/libvirt/jna/Libvirt.java | 2 ++
src/test/java/org/libvirt/TestJavaBindings.java | 1 +
3 files changed, 49 insertions(+)
diff --git a/src/main/java/org/libvirt/Connect.java b/src/main/java/org/libvirt/Connect.java
index fedc60e..390ed89 100644
--- a/src/main/java/org/libvirt/Connect.java
+++ b/src/main/java/org/libvirt/Connect.java
@@ -24,6 +24,7 @@ import com.sun.jna.Memory;
import com.sun.jna.NativeLong;
import com.sun.jna.Pointer;
import com.sun.jna.ptr.LongByReference;
+import com.sun.jna.ptr.PointerByReference;
/**
* The Connect object represents a connection to a local or remote
@@ -33,6 +34,28 @@ import com.sun.jna.ptr.LongByReference;
*/
public class Connect {
+ static final class ListAllDomainsFlags {
+ static final int VIR_CONNECT_LIST_DOMAINS_ACTIVE = (1 << 0);
+ static final int VIR_CONNECT_LIST_DOMAINS_INACTIVE = (1 << 1);
+
+ static final int VIR_CONNECT_LIST_DOMAINS_PERSISTENT = (1 << 2);
+ static final int VIR_CONNECT_LIST_DOMAINS_TRANSIENT = (1 << 3);
+
+ static final int VIR_CONNECT_LIST_DOMAINS_RUNNING = (1 << 4);
+ static final int VIR_CONNECT_LIST_DOMAINS_PAUSED = (1 << 5);
+ static final int VIR_CONNECT_LIST_DOMAINS_SHUTOFF = (1 << 6);
+ static final int VIR_CONNECT_LIST_DOMAINS_OTHER = (1 << 7);
+
+ static final int VIR_CONNECT_LIST_DOMAINS_MANAGEDSAVE = (1 << 8);
+ static final int VIR_CONNECT_LIST_DOMAINS_NO_MANAGEDSAVE = (1 << 9);
+
+ static final int VIR_CONNECT_LIST_DOMAINS_AUTOSTART = (1 << 10);
+ static final int VIR_CONNECT_LIST_DOMAINS_NO_AUTOSTART = (1 << 11);
+
+ static final int VIR_CONNECT_LIST_DOMAINS_HAS_SNAPSHOT = (1 << 12);
+ static final int VIR_CONNECT_LIST_DOMAINS_NO_SNAPSHOT = (1 << 13);
+ }
+
/**
* Get the version of a connection.
*
@@ -758,6 +781,29 @@ public class Connect {
}
/**
+ * Lists a possibly filtered list of all the domains.
+ *
+ * @param flags bitwise-OR of ListAllDomainsFlags
+ *
+ * @return and array of the IDs of the active domains
+ * @throws LibvirtException
+ */
+ public Domain[] listAllDomains(int flags) throws LibvirtException {
+ PointerByReference domainsRef = new PointerByReference();
+ int ret = libvirt.virConnectListAllDomains(VCP, domainsRef, flags);
+ processError(ret);
+
+ Pointer[] pointers = domainsRef.getValue().getPointerArray(0);
+ Domain[] domains = new Domain[ret];
+ for (int i = 0; i < ret; i++) {
+ DomainPointer domainPtr = new DomainPointer();
+ domainPtr.setPointer(pointers[i]);
+ domains[i] = new Domain(this, domainPtr);
+ }
+ return domains;
+ }
+
+ /**
* Provides the list of names of interfaces on this host
*
* @return an Array of Strings that contains the names of the interfaces on
diff --git a/src/main/java/org/libvirt/jna/Libvirt.java b/src/main/java/org/libvirt/jna/Libvirt.java
index 0e4c9fc..1331f80 100644
--- a/src/main/java/org/libvirt/jna/Libvirt.java
+++ b/src/main/java/org/libvirt/jna/Libvirt.java
@@ -8,6 +8,7 @@ import com.sun.jna.Platform;
import com.sun.jna.Pointer;
import com.sun.jna.ptr.IntByReference;
import com.sun.jna.ptr.LongByReference;
+import com.sun.jna.ptr.PointerByReference;
/**
* The libvirt interface which is exposed via JNA. The complete API is
@@ -135,6 +136,7 @@ public interface Libvirt extends Library {
int virConnectListDefinedStoragePools(ConnectionPointer virConnectPtr, Pointer[] names, int maxnames);
int virConnectListDefinedInterfaces(ConnectionPointer virConnectPtr, Pointer[] name, int maxNames);
int virConnectListDomains(ConnectionPointer virConnectPtr, int[] ids, int maxnames);
+ int virConnectListAllDomains(ConnectionPointer virConnectPtr, PointerByReference domains, int flags);
int virConnectListInterfaces(ConnectionPointer virConnectPtr, Pointer[] name, int maxNames);
int virConnectListNetworks(ConnectionPointer virConnectPtr, Pointer[] name, int maxnames);
int virConnectListNWFilters(ConnectionPointer virConnectPtr, Pointer[] name, int maxnames);
diff --git a/src/test/java/org/libvirt/TestJavaBindings.java b/src/test/java/org/libvirt/TestJavaBindings.java
index 0123e6a..2703aa3 100644
--- a/src/test/java/org/libvirt/TestJavaBindings.java
+++ b/src/test/java/org/libvirt/TestJavaBindings.java
@@ -137,6 +137,7 @@ public final class TestJavaBindings extends TestCase {
assertEquals("Number of listed domains", 2, conn.listDomains().length);
assertEquals("Number of defined domains", 1, conn.numOfDefinedDomains());
assertEquals("Number of listed defined domains", 1, conn.listDefinedDomains().length);
+ assertEquals("Number of all listed domains", 3, conn.listAllDomains(0).length);
assertTrue("Domain1 should be persistent", dom1.isPersistent() == 1);
assertTrue("Domain1 should not be active", dom1.isActive() == 0);
assertTrue("Domain2 should be active", dom2.isActive() == 1);
--
1.8.4.5
10 years, 1 month
[libvirt] [PATCH] add temporary compilation files into .gitignore
by Martin Kletzander
When using git-status during configure phase, three additional files are
shown as untracked.
Signed-off-by: Martin Kletzander <mkletzan(a)redhat.com>
---
.gitignore | 3 +++
1 file changed, 3 insertions(+)
diff --git a/.gitignore b/.gitignore
index 9776ea1..c1d1455 100644
--- a/.gitignore
+++ b/.gitignore
@@ -40,6 +40,7 @@
/build-aux
/build-aux/
/build/
+/confdefs.h
/config.cache
/config.guess
/config.h
@@ -50,6 +51,8 @@
/config.sub
/configure
/configure.lineno
+/conftest.c
+/conftest.err
/daemon/*_dispatch.h
/daemon/libvirt_qemud
/daemon/libvirtd
--
2.1.3
10 years, 1 month