The numad advice is not valid at the point of hotplug so we are not
reusing it. If the user would want to hot-add memory with automatic
placement we'd report:
'Advice from numad is needed in case of automatic numa placement'
Change it to:
'automatic placement of memory is not possible when hotplugging'
---
src/conf/numa_conf.c | 20 +++++++++++++++++---
src/conf/numa_conf.h | 1 +
src/libvirt_private.syms | 1 +
src/qemu/qemu_hotplug.c | 7 +++++++
4 files changed, 26 insertions(+), 3 deletions(-)
diff --git a/src/conf/numa_conf.c b/src/conf/numa_conf.c
index e0d5688..e10fed8 100644
--- a/src/conf/numa_conf.c
+++ b/src/conf/numa_conf.c
@@ -419,6 +419,22 @@ virDomainNumatuneFormatNodeset(virDomainNumaPtr numatune,
}
+/**
+ * virDomainNumatuneNeedNumadAdvice:
+ * @numatune: domain numa definition
+ *
+ * Returns true if the numa configuration requires automatic placement data
+ * gathered by numad.
+ */
+bool
+virDomainNumatuneNeedNumadAdvice(virDomainNumaPtr numatune)
+{
+ return numatune &&
+ numatune->memory.specified &&
+ numatune->memory.placement == VIR_DOMAIN_NUMATUNE_PLACEMENT_AUTO;
+}
+
+
int
virDomainNumatuneMaybeGetNodeset(virDomainNumaPtr numatune,
virBitmapPtr auto_nodeset,
@@ -434,9 +450,7 @@ virDomainNumatuneMaybeGetNodeset(virDomainNumaPtr numatune,
!numatune->memory.specified)
return 0;
- if (numatune->memory.specified &&
- numatune->memory.placement == VIR_DOMAIN_NUMATUNE_PLACEMENT_AUTO &&
- !auto_nodeset) {
+ if (virDomainNumatuneNeedNumadAdvice(numatune) && !auto_nodeset) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Advice from numad is needed in case of "
"automatic numa placement"));
diff --git a/src/conf/numa_conf.h b/src/conf/numa_conf.h
index 90deacb..82f0155 100644
--- a/src/conf/numa_conf.h
+++ b/src/conf/numa_conf.h
@@ -155,5 +155,6 @@ int virDomainNumaDefCPUFormat(virBufferPtr buf, virDomainNumaPtr
def);
unsigned int virDomainNumaGetCPUCountTotal(virDomainNumaPtr numa);
+bool virDomainNumatuneNeedNumadAdvice(virDomainNumaPtr numatune);
#endif /* __NUMA_CONF_H__ */
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 7c44047..8b88667 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -692,6 +692,7 @@ virDomainNumatuneMaybeFormatNodeset;
virDomainNumatuneMaybeGetNodeset;
virDomainNumatuneMemModeTypeFromString;
virDomainNumatuneMemModeTypeToString;
+virDomainNumatuneNeedNumadAdvice;
virDomainNumatuneNodesetIsAvailable;
virDomainNumatuneNodeSpecified;
virDomainNumatuneParseXML;
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index e82dbf5..84475b7 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -1760,6 +1760,13 @@ qemuDomainAttachMemory(virQEMUDriverPtr driver,
if (vm->def->mem.cur_balloon == virDomainDefGetMemoryActual(vm->def))
fix_balloon = true;
+ if (virDomainNumatuneNeedNumadAdvice(vm->def->numa) &&
!mem->sourceNodes) {
+ virReportError(VIR_ERR_OPERATION_INVALID, "%s",
+ _("automatic placement of memory is not possible when "
+ "hotplugging"));
+ goto cleanup;
+ }
+
if (!(devstr = qemuBuildMemoryDeviceStr(mem)))
goto cleanup;
--
2.7.3