render / rpms / libvirt

Forked from rpms/libvirt 10 months ago
Clone
032100
From a1d825e5dcb8cbe0854fa852d25e5997a52d57cd Mon Sep 17 00:00:00 2001
032100
Message-Id: <a1d825e5dcb8cbe0854fa852d25e5997a52d57cd@dist-git>
032100
From: Jiri Denemark <jdenemar@redhat.com>
032100
Date: Wed, 27 Jul 2022 14:33:23 +0200
032100
Subject: [PATCH] qemu: Restore original memory locking limit on reconnect
032100
032100
Commit v8.4.0-287-gd4d3bb8130 tried to make sure the original
032100
pre-migration memory locking limit is restored at the end of migration,
032100
but it missed the case when libvirt daemon is restarted during
032100
migration which needs to be aborted on reconnect.
032100
032100
And if this was not enough, I forgot to actually save the status XML
032100
after setting the field in priv (in the commit mentioned above and also
032100
in v8.4.0-291-gd375993ab3).
032100
032100
https://bugzilla.redhat.com/show_bug.cgi?id=2107424
032100
032100
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
032100
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
032100
(cherry picked from commit bb9badb9168ad0d40bca86b6463ef504624f096d)
032100
032100
Conflicts:
032100
	src/qemu/qemu_migration.c
032100
            - commit v8.5.0-2-gf9dcc01a0f not backported
032100
032100
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
032100
---
032100
 src/qemu/qemu_migration.c | 13 +++++++++----
032100
 src/qemu/qemu_process.c   |  2 ++
032100
 2 files changed, 11 insertions(+), 4 deletions(-)
032100
032100
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
032100
index 9289df81eb..61fcaf4258 100644
032100
--- a/src/qemu/qemu_migration.c
032100
+++ b/src/qemu/qemu_migration.c
032100
@@ -4672,10 +4672,12 @@ qemuMigrationSrcStart(virDomainObj *vm,
032100
     switch (spec->destType) {
032100
     case MIGRATION_DEST_HOST:
032100
         if (STREQ(spec->dest.host.protocol, "rdma") &&
032100
-            vm->def->mem.hard_limit > 0 &&
032100
-            qemuDomainSetMaxMemLock(vm, vm->def->mem.hard_limit << 10,
032100
-                                    &priv->preMigrationMemlock) < 0) {
032100
-            return -1;
032100
+            vm->def->mem.hard_limit > 0) {
032100
+            if (qemuDomainSetMaxMemLock(vm, vm->def->mem.hard_limit << 10,
032100
+                                        &priv->preMigrationMemlock) < 0)
032100
+                return -1;
032100
+            /* Store the original memory locking limit */
032100
+            qemuDomainSaveStatus(vm);
032100
         }
032100
         return qemuMonitorMigrateToHost(priv->mon, migrateFlags,
032100
                                         spec->dest.host.protocol,
032100
@@ -4870,6 +4872,9 @@ qemuMigrationSrcRun(virQEMUDriver *driver,
032100
 
032100
         if (qemuDomainSetMaxMemLock(vm, limit << 10, &priv->preMigrationMemlock) < 0)
032100
             goto error;
032100
+
032100
+        /* Store the original memory locking limit */
032100
+        qemuDomainSaveStatus(vm);
032100
     }
032100
 
032100
     if (storageMigration) {
032100
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
032100
index 771a623ef7..1c28d4b102 100644
032100
--- a/src/qemu/qemu_process.c
032100
+++ b/src/qemu/qemu_process.c
032100
@@ -3677,6 +3677,7 @@ qemuProcessRecoverMigration(virQEMUDriver *driver,
032100
 {
032100
     virDomainJobStatus migStatus = VIR_DOMAIN_JOB_STATUS_NONE;
032100
     qemuDomainJobPrivate *jobPriv = job->privateData;
032100
+    qemuDomainObjPrivate *priv = vm->privateData;
032100
     virDomainState state;
032100
     int reason;
032100
     int rc;
032100
@@ -3726,6 +3727,7 @@ qemuProcessRecoverMigration(virQEMUDriver *driver,
032100
 
032100
     qemuMigrationParamsReset(driver, vm, VIR_ASYNC_JOB_NONE,
032100
                              jobPriv->migParams, job->apiFlags);
032100
+    qemuDomainSetMaxMemLock(vm, 0, &priv->preMigrationMemlock);
032100
 
032100
     return 0;
032100
 }
032100
-- 
032100
2.35.1
032100