|
|
11fcb6 |
From 7cbfdb081de6e4eb684447ba48869082df798419 Mon Sep 17 00:00:00 2001
|
|
|
11fcb6 |
Message-Id: <7cbfdb081de6e4eb684447ba48869082df798419@dist-git>
|
|
|
11fcb6 |
From: Jiri Denemark <jdenemar@redhat.com>
|
|
|
11fcb6 |
Date: Wed, 22 Jun 2022 16:12:02 +0200
|
|
|
11fcb6 |
Subject: [PATCH] qemu_migration: Restore original memory locking limit
|
|
|
11fcb6 |
MIME-Version: 1.0
|
|
|
11fcb6 |
Content-Type: text/plain; charset=UTF-8
|
|
|
11fcb6 |
Content-Transfer-Encoding: 8bit
|
|
|
11fcb6 |
|
|
|
11fcb6 |
For RDMA migration we update memory locking limit, but never set it back
|
|
|
11fcb6 |
once migration finishes (on the destination host) or aborts (on the
|
|
|
11fcb6 |
source host).
|
|
|
11fcb6 |
|
|
|
11fcb6 |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
11fcb6 |
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
|
|
11fcb6 |
(cherry picked from commit d4d3bb813031275c2c7cf72724b83c97ce82ab7a)
|
|
|
11fcb6 |
|
|
|
11fcb6 |
https://bugzilla.redhat.com/show_bug.cgi?id=2117272
|
|
|
11fcb6 |
|
|
|
11fcb6 |
Conflicts:
|
|
|
11fcb6 |
src/qemu/qemu_migration.c
|
|
|
11fcb6 |
- post-copy resovery not backported
|
|
|
11fcb6 |
|
|
|
11fcb6 |
The original 8.7.0 backport contained a bug which was later fixed by
|
|
|
11fcb6 |
"qemu_migration: Fix restoring memlock limit on destination". This
|
|
|
11fcb6 |
backport includes the follow up fix squashed in.
|
|
|
11fcb6 |
|
|
|
11fcb6 |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
11fcb6 |
---
|
|
|
11fcb6 |
src/qemu/qemu_domain.c | 12 ++++++++++++
|
|
|
11fcb6 |
src/qemu/qemu_domain.h | 3 +++
|
|
|
11fcb6 |
src/qemu/qemu_migration.c | 11 +++++++++--
|
|
|
11fcb6 |
3 files changed, 24 insertions(+), 2 deletions(-)
|
|
|
11fcb6 |
|
|
|
11fcb6 |
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
|
|
|
11fcb6 |
index a81789f194..c24d1e4d53 100644
|
|
|
11fcb6 |
--- a/src/qemu/qemu_domain.c
|
|
|
11fcb6 |
+++ b/src/qemu/qemu_domain.c
|
|
|
11fcb6 |
@@ -2389,6 +2389,11 @@ qemuDomainObjPrivateXMLFormat(virBuffer *buf,
|
|
|
11fcb6 |
priv->originalMemlock);
|
|
|
11fcb6 |
}
|
|
|
11fcb6 |
|
|
|
11fcb6 |
+ if (priv->preMigrationMemlock > 0) {
|
|
|
11fcb6 |
+ virBufferAsprintf(buf, "<preMigrationMemlock>%llu</preMigrationMemlock>\n",
|
|
|
11fcb6 |
+ priv->preMigrationMemlock);
|
|
|
11fcb6 |
+ }
|
|
|
11fcb6 |
+
|
|
|
11fcb6 |
return 0;
|
|
|
11fcb6 |
}
|
|
|
11fcb6 |
|
|
|
11fcb6 |
@@ -3117,6 +3122,13 @@ qemuDomainObjPrivateXMLParse(xmlXPathContextPtr ctxt,
|
|
|
11fcb6 |
goto error;
|
|
|
11fcb6 |
}
|
|
|
11fcb6 |
|
|
|
11fcb6 |
+ if (virXPathULongLong("string(./preMigrationMemlock)", ctxt,
|
|
|
11fcb6 |
+ &priv->preMigrationMemlock) == -2) {
|
|
|
11fcb6 |
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
|
|
11fcb6 |
+ _("failed to parse pre-migration memlock limit"));
|
|
|
11fcb6 |
+ return -1;
|
|
|
11fcb6 |
+ }
|
|
|
11fcb6 |
+
|
|
|
11fcb6 |
return 0;
|
|
|
11fcb6 |
|
|
|
11fcb6 |
error:
|
|
|
11fcb6 |
diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
|
|
|
11fcb6 |
index 6d1d23439a..d6e8a7a0fb 100644
|
|
|
11fcb6 |
--- a/src/qemu/qemu_domain.h
|
|
|
11fcb6 |
+++ b/src/qemu/qemu_domain.h
|
|
|
11fcb6 |
@@ -146,6 +146,9 @@ struct _qemuDomainObjPrivate {
|
|
|
11fcb6 |
int nbdPort; /* Port used for migration with NBD */
|
|
|
11fcb6 |
unsigned short migrationPort;
|
|
|
11fcb6 |
int preMigrationState;
|
|
|
11fcb6 |
+ unsigned long long preMigrationMemlock; /* Original RLIMIT_MEMLOCK in case
|
|
|
11fcb6 |
+ it was changed for the current
|
|
|
11fcb6 |
+ migration job. */
|
|
|
11fcb6 |
|
|
|
11fcb6 |
virChrdevs *devs;
|
|
|
11fcb6 |
|
|
|
11fcb6 |
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
|
|
|
11fcb6 |
index 10338f8e87..01102c4300 100644
|
|
|
11fcb6 |
--- a/src/qemu/qemu_migration.c
|
|
|
11fcb6 |
+++ b/src/qemu/qemu_migration.c
|
|
|
11fcb6 |
@@ -2974,7 +2974,8 @@ qemuMigrationDstPrepareAny(virQEMUDriver *driver,
|
|
|
11fcb6 |
|
|
|
11fcb6 |
if (STREQ_NULLABLE(protocol, "rdma") &&
|
|
|
11fcb6 |
vm->def->mem.hard_limit > 0 &&
|
|
|
11fcb6 |
- qemuDomainSetMaxMemLock(vm, vm->def->mem.hard_limit << 10, NULL) < 0) {
|
|
|
11fcb6 |
+ qemuDomainSetMaxMemLock(vm, vm->def->mem.hard_limit << 10,
|
|
|
11fcb6 |
+ &priv->preMigrationMemlock) < 0) {
|
|
|
11fcb6 |
goto stopjob;
|
|
|
11fcb6 |
}
|
|
|
11fcb6 |
|
|
|
11fcb6 |
@@ -3451,6 +3452,7 @@ qemuMigrationSrcConfirmPhase(virQEMUDriver *driver,
|
|
|
11fcb6 |
VIR_DOMAIN_EVENT_STOPPED_MIGRATED);
|
|
|
11fcb6 |
virObjectEventStateQueue(driver->domainEventState, event);
|
|
|
11fcb6 |
qemuDomainEventEmitJobCompleted(driver, vm);
|
|
|
11fcb6 |
+ priv->preMigrationMemlock = 0;
|
|
|
11fcb6 |
} else {
|
|
|
11fcb6 |
virErrorPtr orig_err;
|
|
|
11fcb6 |
int reason;
|
|
|
11fcb6 |
@@ -3471,6 +3473,7 @@ qemuMigrationSrcConfirmPhase(virQEMUDriver *driver,
|
|
|
11fcb6 |
|
|
|
11fcb6 |
qemuMigrationParamsReset(driver, vm, QEMU_ASYNC_JOB_MIGRATION_OUT,
|
|
|
11fcb6 |
jobPriv->migParams, priv->job.apiFlags);
|
|
|
11fcb6 |
+ qemuDomainSetMaxMemLock(vm, 0, &priv->preMigrationMemlock);
|
|
|
11fcb6 |
|
|
|
11fcb6 |
qemuDomainSaveStatus(vm);
|
|
|
11fcb6 |
}
|
|
|
11fcb6 |
@@ -4224,7 +4227,8 @@ qemuMigrationSrcRun(virQEMUDriver *driver,
|
|
|
11fcb6 |
case MIGRATION_DEST_HOST:
|
|
|
11fcb6 |
if (STREQ(spec->dest.host.protocol, "rdma") &&
|
|
|
11fcb6 |
vm->def->mem.hard_limit > 0 &&
|
|
|
11fcb6 |
- qemuDomainSetMaxMemLock(vm, vm->def->mem.hard_limit << 10, NULL) < 0) {
|
|
|
11fcb6 |
+ qemuDomainSetMaxMemLock(vm, vm->def->mem.hard_limit << 10,
|
|
|
11fcb6 |
+ &priv->preMigrationMemlock) < 0) {
|
|
|
11fcb6 |
goto exit_monitor;
|
|
|
11fcb6 |
}
|
|
|
11fcb6 |
rc = qemuMonitorMigrateToHost(priv->mon, migrate_flags,
|
|
|
11fcb6 |
@@ -5408,6 +5412,7 @@ qemuMigrationSrcPerformPhase(virQEMUDriver *driver,
|
|
|
11fcb6 |
if (ret < 0) {
|
|
|
11fcb6 |
qemuMigrationParamsReset(driver, vm, QEMU_ASYNC_JOB_MIGRATION_OUT,
|
|
|
11fcb6 |
jobPriv->migParams, priv->job.apiFlags);
|
|
|
11fcb6 |
+ qemuDomainSetMaxMemLock(vm, 0, &priv->preMigrationMemlock);
|
|
|
11fcb6 |
qemuMigrationJobFinish(driver, vm);
|
|
|
11fcb6 |
} else {
|
|
|
11fcb6 |
qemuMigrationJobContinue(vm);
|
|
|
11fcb6 |
@@ -5869,6 +5874,8 @@ qemuMigrationDstFinish(virQEMUDriver *driver,
|
|
|
11fcb6 |
*/
|
|
|
11fcb6 |
if (inPostCopy)
|
|
|
11fcb6 |
g_clear_pointer(&priv->job.completed, qemuDomainJobInfoFree);
|
|
|
11fcb6 |
+
|
|
|
11fcb6 |
+ qemuDomainSetMaxMemLock(vm, 0, &priv->preMigrationMemlock);
|
|
|
11fcb6 |
}
|
|
|
11fcb6 |
|
|
|
11fcb6 |
qemuMigrationParamsReset(driver, vm, QEMU_ASYNC_JOB_MIGRATION_IN,
|
|
|
11fcb6 |
--
|
|
|
11fcb6 |
2.35.1
|
|
|
11fcb6 |
|