From nobody Thu May 2 08:43:11 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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1506350006522995.2234307299517; Mon, 25 Sep 2017 07:33:26 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6D9A77F6BA; Mon, 25 Sep 2017 14:33:25 +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 47BC46BF85; Mon, 25 Sep 2017 14:33:25 +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 0BA331855944; Mon, 25 Sep 2017 14:33:25 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v8PEPtLh010189 for ; Mon, 25 Sep 2017 10:25:55 -0400 Received: by smtp.corp.redhat.com (Postfix) id C86F863762; Mon, 25 Sep 2017 14:25:55 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2988F66D39; Mon, 25 Sep 2017 14:25:52 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 6D9A77F6BA Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=libvir-list-bounces@redhat.com From: Peter Krempa To: libvir-list@redhat.com Date: Mon, 25 Sep 2017 16:25:46 +0200 Message-Id: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Cc: Peter Krempa Subject: [libvirt] [PATCH] qemu: process: Refresh data from qemu monitor after migration 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.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Mon, 25 Sep 2017 14:33:25 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Some values we read from the qemu monitor may be changed with the actual state by the incomming migration. This means that we should refresh certain things only after the migration has finished. This is mostly visible in the cdrom tray state, which is by default closed but may be opened by the guest OS. This would be refreshed before qemu transferred the actual state and thus libvirt would think that the tray is closed. Note that this patch moves only a few obvious query commands. Other may be moved later after individual assesment. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=3D1463168 Reviewed-by: John Ferlan --- src/qemu/qemu_process.c | 59 +++++++++++++++++++++++++++++++++++----------= ---- 1 file changed, 43 insertions(+), 16 deletions(-) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index c104985aa..2be82e958 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -5787,14 +5787,6 @@ qemuProcessLaunch(virConnectPtr conn, if (qemuProcessSetLinkStates(driver, vm, asyncJob) < 0) goto cleanup; - VIR_DEBUG("Fetching list of active devices"); - if (qemuDomainUpdateDeviceList(driver, vm, asyncJob) < 0) - goto cleanup; - - VIR_DEBUG("Updating info of memory devices"); - if (qemuDomainUpdateMemoryDeviceInfo(driver, vm, asyncJob) < 0) - goto cleanup; - VIR_DEBUG("Setting initial memory amount"); if (qemuProcessSetupBalloon(driver, vm, asyncJob) < 0) goto cleanup; @@ -5806,14 +5798,6 @@ qemuProcessLaunch(virConnectPtr conn, qemuProcessRefreshBalloonState(driver, vm, asyncJob) < 0) goto cleanup; - VIR_DEBUG("Detecting actual memory size for video device"); - if (qemuProcessUpdateVideoRamSize(driver, vm, asyncJob) < 0) - goto cleanup; - - VIR_DEBUG("Updating disk data"); - if (qemuProcessRefreshDisks(driver, vm, asyncJob) < 0) - goto cleanup; - if (flags & VIR_QEMU_PROCESS_START_AUTODESTROY && qemuProcessAutoDestroyAdd(driver, vm, conn) < 0) goto cleanup; @@ -5831,6 +5815,46 @@ qemuProcessLaunch(virConnectPtr conn, } +/** + * qemuProcessRefreshState: + * @driver: qemu driver data + * @vm: domain to refresh + * @asyncJob: async job type + * + * This function gathers calls to refresh qemu state after startup. This + * function is called after a deferred migration finishes so that we can u= pdate + * state influenced by the migration stream. + */ +static int +qemuProcessRefreshState(virQEMUDriverPtr driver, + virDomainObjPtr vm, + qemuDomainAsyncJob asyncJob) +{ + int ret =3D -1; + + VIR_DEBUG("Fetching list of active devices"); + if (qemuDomainUpdateDeviceList(driver, vm, asyncJob) < 0) + goto cleanup; + + VIR_DEBUG("Updating info of memory devices"); + if (qemuDomainUpdateMemoryDeviceInfo(driver, vm, asyncJob) < 0) + goto cleanup; + + VIR_DEBUG("Detecting actual memory size for video device"); + if (qemuProcessUpdateVideoRamSize(driver, vm, asyncJob) < 0) + goto cleanup; + + VIR_DEBUG("Updating disk data"); + if (qemuProcessRefreshDisks(driver, vm, asyncJob) < 0) + goto cleanup; + + ret =3D 0; + + cleanup: + return ret; +} + + /** * qemuProcessFinishStartup: * @@ -5847,6 +5871,9 @@ 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, --=20 2.14.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list