Signed-off-by: zhengchuan<zhengchuan@huawei.com>
Signed-off-by: Jiang Jiacheng <jiangjiacheng@huawei.com>
---
src/qemu/qemu_process.c | 56 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 56 insertions(+)
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index e787db8b24..85a22c7e51 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -1438,6 +1438,61 @@ qemuProcessHandleSpiceMigrated(qemuMonitor *mon G_GNUC_UNUSED,
}
+static void
+qemuProcessHandleMigrationPinStatus(virDomainObj *vm, int status)
+{
+ qemuDomainObjPrivate *priv = vm->privateData;
+
+ if (vm->job->asyncJob != VIR_ASYNC_JOB_MIGRATION_OUT)
+ return;
+
+ switch (status) {
+ case QEMU_MONITOR_MIGRATION_STATUS_INACTIVE:
+ case QEMU_MONITOR_MIGRATION_STATUS_SETUP:
+ case QEMU_MONITOR_MIGRATION_STATUS_ACTIVE:
+ case QEMU_MONITOR_MIGRATION_STATUS_PRE_SWITCHOVER:
+ case QEMU_MONITOR_MIGRATION_STATUS_DEVICE:
+ case QEMU_MONITOR_MIGRATION_STATUS_POSTCOPY:
+ case QEMU_MONITOR_MIGRATION_STATUS_POSTCOPY_PAUSED:
+ case QEMU_MONITOR_MIGRATION_STATUS_POSTCOPY_RECOVER:
+ case QEMU_MONITOR_MIGRATION_STATUS_CANCELLING:
+ case QEMU_MONITOR_MIGRATION_STATUS_COMPLETED:
+ case QEMU_MONITOR_MIGRATION_STATUS_WAIT_UNPLUG:
+ break;
+ case QEMU_MONITOR_MIGRATION_STATUS_ERROR:
+ /*
+ * migration thread is still running,
+ * so we can't delete migration Cgroup.
+ */
+ qemuDomainMigThreadsInfoFree(priv->migThreadsInfo, priv->migThreadCount);
+ priv->migThreadsInfo = NULL;
+ priv->migThreadCount = 0;
+ g_free(priv->migrationThreadPinList);
+ virBitmapFree(priv->pcpumap);
+ priv->pcpumap = NULL;
+ break;
+ case QEMU_MONITOR_MIGRATION_STATUS_CANCELLED:
+ qemuDomainMigThreadsInfoFree(priv->migThreadsInfo, priv->migThreadCount);
+ priv->migThreadsInfo = NULL;
+ priv->migThreadCount = 0;
+ g_free(priv->migrationThreadPinList);
+ virBitmapFree(priv->pcpumap);
+ priv->pcpumap = NULL;
+ if (virCgroupDelThread(priv->cgroup,
+ VIR_CGROUP_THREAD_MIGRATION_THREAD, 0) < 0)
+ VIR_WARN("Failed to delete migration thread Cgroup!");
+ VIR_INFO("success to free pcpumap and migrationPids");
+ break;
+ default:
+ VIR_WARN("got unknown migration status'%s'",
+ qemuMonitorMigrationStatusTypeToString(status));
+ break;
+ }
+
+ return;
+}
+
+
static void
qemuProcessHandleMigrationStatus(qemuMonitor *mon G_GNUC_UNUSED,
virDomainObj *vm,
@@ -1552,6 +1607,7 @@ qemuProcessHandleMigrationStatus(qemuMonitor *mon G_GNUC_UNUSED,
default:
break;
}
+ qemuProcessHandleMigrationPinStatus(vm, status);
cleanup:
virObjectUnlock(vm);
--
2.33.0