4372d3
From b221b3ab6d881efedc544e0e0ed9c507e21fd178 Mon Sep 17 00:00:00 2001
4372d3
Message-Id: <b221b3ab6d881efedc544e0e0ed9c507e21fd178@dist-git>
11fcb6
From: Michal Privoznik <mprivozn@redhat.com>
11fcb6
Date: Wed, 11 May 2022 16:37:27 +0200
11fcb6
Subject: [PATCH] qemu_domain: Format qemuDomainObjPrivate::originalMemlock
11fcb6
11fcb6
Now that qemuDomainObjPrivate struct gained new member format it
11fcb6
into XML and parse it so that the value is preserved across
11fcb6
daemon restarts.
11fcb6
11fcb6
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
11fcb6
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
11fcb6
(cherry picked from commit 21aec91790ae14d24512856b20cff49764ede637)
11fcb6
4372d3
https://bugzilla.redhat.com/show_bug.cgi?id=2089433
11fcb6
11fcb6
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
11fcb6
---
11fcb6
 src/qemu/qemu_domain.c | 13 +++++++++++++
11fcb6
 1 file changed, 13 insertions(+)
11fcb6
11fcb6
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
11fcb6
index 86d673dafa..ee7d310903 100644
11fcb6
--- a/src/qemu/qemu_domain.c
11fcb6
+++ b/src/qemu/qemu_domain.c
11fcb6
@@ -2383,6 +2383,12 @@ qemuDomainObjPrivateXMLFormat(virBuffer *buf,
11fcb6
     if (qemuDomainObjPrivateXMLFormatBackups(buf, vm) < 0)
11fcb6
         return -1;
11fcb6
 
11fcb6
+    if (priv->originalMemlock > 0) {
11fcb6
+        virBufferAsprintf(buf,
11fcb6
+                          "<originalMemlock>%llu</originalMemlock>\n",
11fcb6
+                          priv->originalMemlock);
11fcb6
+    }
11fcb6
+
11fcb6
     return 0;
11fcb6
 }
11fcb6
 
11fcb6
@@ -3104,6 +3110,13 @@ qemuDomainObjPrivateXMLParse(xmlXPathContextPtr ctxt,
11fcb6
 
11fcb6
     priv->memPrealloc = virXPathBoolean("boolean(./memPrealloc)", ctxt) == 1;
11fcb6
 
11fcb6
+    if (virXPathULongLong("string(./originalMemlock)",
11fcb6
+                          ctxt, &priv->originalMemlock) == -2) {
11fcb6
+        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
11fcb6
+                       _("failed to parse original memlock size"));
11fcb6
+        goto error;
11fcb6
+    }
11fcb6
+
11fcb6
     return 0;
11fcb6
 
11fcb6
  error:
11fcb6
-- 
11fcb6
2.35.1
11fcb6