From 121cde472640cddcc64d2c06a607bb35bf9ae032 Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Mon, 16 Feb 2015 14:17:41 +0100 Subject: [PATCH] conf: numa: Format XML only if necessary Do a content-aware check if formatting of the 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 d86ac99a67..9b48fb87ea 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, "\n"); virBufferAdjustIndent(buf, 2); -- 2.47.2