[libvirt] [PATCH 07/10] conf: domain: Split up formatting of <memtune> and <memoryBacking>

Peter Krempa pkrempa at redhat.com
Tue Nov 12 07:27:44 UTC 2019


Signed-off-by: Peter Krempa <pkrempa at redhat.com>
---
 src/conf/domain_conf.c | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 3e81140430..0e774889a2 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -27985,6 +27985,17 @@ virDomainMemtuneFormat(virBufferPtr buf,

     virXMLFormatElement(buf, "memtune", NULL, &childBuf);

+    ret = 0;
+    return ret;
+}
+
+
+static void
+virDomainMemorybackingFormat(virBufferPtr buf,
+                             const virDomainMemtune *mem)
+{
+    g_auto(virBuffer) childBuf = VIR_BUFFER_INITIALIZER;
+
     virBufferSetChildIndent(&childBuf, buf);

     if (mem->nhugepages)
@@ -28006,9 +28017,6 @@ virDomainMemtuneFormat(virBufferPtr buf,
         virBufferAddLit(&childBuf, "<discard/>\n");

     virXMLFormatElement(buf, "memoryBacking", NULL, &childBuf);
-
-    ret = 0;
-    return ret;
 }


@@ -28484,6 +28492,8 @@ virDomainDefFormatInternalSetRootName(virDomainDefPtr def,
     if (virDomainMemtuneFormat(buf, &def->mem) < 0)
         goto error;

+    virDomainMemorybackingFormat(buf, &def->mem);
+
     if (virDomainCpuDefFormat(buf, def) < 0)
         goto error;

-- 
2.23.0




More information about the libvir-list mailing list