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