[PATCH 12/24] conf: numa: Format <numatune> XML only if necessary

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]