Adjust the config code so that it does not enforce that target memory
node is specified. To avoid breakage, adjust the qemu memory hotplug
config checker to disallow such config for now.
---
docs/formatdomain.html.in | 5 +++--
docs/schemas/domaincommon.rng | 8 +++++---
src/conf/domain_conf.c | 10 +++++++---
src/qemu/qemu_domain.c | 7 +++++++
4 files changed, 22 insertions(+), 8 deletions(-)
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index c88b032..279424d 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -6300,8 +6300,9 @@ qemu-kvm -net nic,model=? /dev/null
added memory as a scaled integer.
</p>
<p>
- The mandatory <code>node</code> subelement configures the guest
NUMA
- node to attach the memory to.
+ The <code>node</code> subelement configures the guest NUMA node to
+ attach the memory to. Note: Some hypervisors or specific
+ configurations may require that <code>node</code> is specified.
</p>
</dd>
</dl>
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index f196177..994face 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -4532,9 +4532,11 @@
<element name="size">
<ref name="scaledInteger"/>
</element>
- <element name="node">
- <ref name="unsignedInt"/>
- </element>
+ <optional>
+ <element name="node">
+ <ref name="unsignedInt"/>
+ </element>
+ </optional>
</interleave>
</element>
</define>
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 514bd8a..a5ab29c 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -12520,11 +12520,15 @@ virDomainMemoryTargetDefParseXML(xmlNodePtr node,
int ret = -1;
xmlNodePtr save = ctxt->node;
ctxt->node = node;
+ int rv;
- if (virXPathInt("string(./node)", ctxt, &def->targetNode) < 0 ||
- def->targetNode < 0) {
+ /* initialize to value which marks that the user didn't speify it */
+ def->targetNode = -1;
+
+ if ((rv = virXPathInt("string(./node)", ctxt, &def->targetNode)) ==
-2 ||
+ (rv == 0 && def->targetNode < 0)) {
virReportError(VIR_ERR_XML_ERROR, "%s",
- _("invalid or missing value of memory device node"));
+ _("invalid value of memory device node"));
goto cleanup;
}
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index a22e5ad..29fed1d 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -3591,6 +3591,13 @@ qemuDomainDefValidateMemoryHotplugDevice(const virDomainMemoryDef
*mem,
return -1;
}
+ if (mem->targetNode == -1) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("target NUMA node needs to be specifed for memory
"
+ "device"));
+ return -1;
+ }
+
if (mem->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_DIMM) {
if (mem->info.addr.dimm.slot >= def->mem.memory_slots) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
--
2.4.5