From nobody Sat May 4 16:44:24 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1517494790353912.2087036612379; Thu, 1 Feb 2018 06:19:50 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id AC87781E09; Thu, 1 Feb 2018 14:19:48 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id ADA9D5D962; Thu, 1 Feb 2018 14:19:47 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id DC33418033D9; Thu, 1 Feb 2018 14:19:45 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w11EJj0F032765 for ; Thu, 1 Feb 2018 09:19:45 -0500 Received: by smtp.corp.redhat.com (Postfix) id 85D665D9C7; Thu, 1 Feb 2018 14:19:45 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id B5DD45D968; Thu, 1 Feb 2018 14:19:38 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Thu, 1 Feb 2018 15:18:59 +0100 Message-Id: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: Peter Krempa Subject: [libvirt] [PATCH] qemu: migration: Refresh device information after transferring state X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Thu, 01 Feb 2018 14:19:49 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" In my first approach in 4b480d10768c I overlooked the comment in qemuMigrationRunIncoming stating that during actual migration the qemuMigrationRunIncoming does not wait until the migration is complete but rather offloads that to the Finish phase of migration. This means that during actual migration qemuProcessRefreshState was called prior to qemu actually transferring the full state and thus the queries did not get the correct information. The approach worked only for restore, where we wait for the migration to finish during qemu startup. Fix the issue by calling qemuProcessRefreshState both from qemuProcessStart if there's no incomming migration and from qemuMigrationFinish so that the code actually works as expected. --- src/qemu/qemu_migration.c | 9 +++++++++ src/qemu/qemu_process.c | 17 ++++++++++------- src/qemu/qemu_process.h | 4 ++++ 3 files changed, 23 insertions(+), 7 deletions(-) diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index 1854900c9a..ea8b275601 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -5373,6 +5373,15 @@ qemuMigrationFinish(virQEMUDriverPtr driver, goto endjob; } + /* Now that the state data was transferred we can refresh the actual s= tate + * of the devices */ + if (qemuProcessRefreshState(driver, vm, QEMU_ASYNC_JOB_MIGRATION_IN) <= 0) { + /* Similarly to the case above v2 protocol will not be able to rec= over + * from this. Let's ignore this and perhaps stuff will not break. = */ + if (v3proto) + goto endjob; + } + if (priv->job.current->status =3D=3D QEMU_DOMAIN_JOB_STATUS_POSTCOPY) inPostCopy =3D true; diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index bcd4ac8ad6..fe12d94d37 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -6084,7 +6084,7 @@ qemuProcessLaunch(virConnectPtr conn, * function is called after a deferred migration finishes so that we can u= pdate * state influenced by the migration stream. */ -static int +int qemuProcessRefreshState(virQEMUDriverPtr driver, virDomainObjPtr vm, qemuDomainAsyncJob asyncJob) @@ -6125,9 +6125,6 @@ qemuProcessFinishStartup(virConnectPtr conn, virQEMUDriverConfigPtr cfg =3D virQEMUDriverGetConfig(driver); int ret =3D -1; - if (qemuProcessRefreshState(driver, vm, asyncJob) < 0) - goto cleanup; - if (startCPUs) { VIR_DEBUG("Starting domain CPUs"); if (qemuProcessStartCPUs(driver, vm, conn, @@ -6231,11 +6228,17 @@ qemuProcessStart(virConnectPtr conn, VIR_DOMAIN_PAUSED_USER) < 0) goto stop; - /* Keep watching qemu log for errors during incoming migration, otherw= ise - * unset reporting errors from qemu log. */ - if (!incoming) + if (!incoming) { + /* Keep watching qemu log for errors during incoming migration, ot= herwise + * unset reporting errors from qemu log. */ qemuMonitorSetDomainLog(priv->mon, NULL, NULL, NULL); + /* Refresh state of devices from qemu. During migration this needs= to + * happen after the state information is fully transferred. */ + if (qemuProcessRefreshState(driver, vm, asyncJob) < 0) + goto stop; + } + ret =3D 0; cleanup: diff --git a/src/qemu/qemu_process.h b/src/qemu/qemu_process.h index cd9a720313..b383ff309b 100644 --- a/src/qemu/qemu_process.h +++ b/src/qemu/qemu_process.h @@ -129,6 +129,10 @@ int qemuProcessFinishStartup(virConnectPtr conn, bool startCPUs, virDomainPausedReason pausedReason); +int qemuProcessRefreshState(virQEMUDriverPtr driver, + virDomainObjPtr vm, + qemuDomainAsyncJob asyncJob); + typedef enum { VIR_QEMU_PROCESS_STOP_MIGRATED =3D 1 << 0, VIR_QEMU_PROCESS_STOP_NO_RELABEL =3D 1 << 1, --=20 2.15.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list