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