Do a content-aware check if formatting of the <numatune> element is
necessary. Later on the def->numa structure will be always present so we
cannot decide only on the basis whether it's allocated.
---
src/conf/numa_conf.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/src/conf/numa_conf.c b/src/conf/numa_conf.c
index d5ba27f..359bdff 100644
--- a/src/conf/numa_conf.c
+++ b/src/conf/numa_conf.c
@@ -278,11 +278,22 @@ virDomainNumatuneFormatXML(virBufferPtr buf,
{
const char *tmp = NULL;
char *nodeset = NULL;
+ bool nodesetSpecified = false;
size_t i = 0;
if (!numatune)
return 0;
+ for (i = 0; i < numatune->nmem_nodes; i++) {
+ if (numatune->mem_nodes[i].nodeset) {
+ nodesetSpecified = true;
+ break;
+ }
+ }
+
+ if (!nodesetSpecified && !numatune->memory.specified)
+ return 0;
+
virBufferAddLit(buf, "<numatune>\n");
virBufferAdjustIndent(buf, 2);
--
2.2.2