From nobody Thu May 15 12:44:44 2025 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 1508326177859639.3945460944007; Wed, 18 Oct 2017 04:29:37 -0700 (PDT) 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 4F6FC6CB24; Wed, 18 Oct 2017 11:29:36 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2F8386D812; Wed, 18 Oct 2017 11:29:36 +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 EDBBF410BB; Wed, 18 Oct 2017 11:29:35 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v9IBTWja018776 for ; Wed, 18 Oct 2017 07:29:32 -0400 Received: by smtp.corp.redhat.com (Postfix) id 6B16917CDD; Wed, 18 Oct 2017 11:29:32 +0000 (UTC) Received: from virval.usersys.redhat.com (unknown [10.43.2.105]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3EAC991D8C for ; Wed, 18 Oct 2017 11:29:29 +0000 (UTC) Received: by virval.usersys.redhat.com (Postfix, from userid 500) id A3438101295; Wed, 18 Oct 2017 13:29:28 +0200 (CEST) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 4F6FC6CB24 Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=libvir-list-bounces@redhat.com From: Jiri Denemark To: libvir-list@redhat.com Date: Wed, 18 Oct 2017 13:29:22 +0200 Message-Id: <019f0287ffea5f932ab952d45b70edbcc02b5cc1.1508325942.git.jdenemar@redhat.com> In-Reply-To: References: In-Reply-To: References: Mail-Followup-To: libvir-list@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 1/5] qemu: Create a wrapper around qemuMonitorSetCapabilities 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.27]); Wed, 18 Oct 2017 11:29:36 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The new function is called qemuProcessInitMonitor and it will enter/exit the monitor so that the caller doesn't have to deal with this. The goal of this patch is to simplify the code in qemuConnectMonitor which would otherwise be a bit hairy after the following patch. Signed-off-by: Jiri Denemark Reviewed-by: John Ferlan --- src/qemu/qemu_process.c | 34 +++++++++++++++++++++++++--------- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index e062194294..24675498a2 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -1730,12 +1730,31 @@ qemuProcessMonitorLogFree(void *opaque) virObjectUnref(logCtxt); } =20 + +static int +qemuProcessInitMonitor(virQEMUDriverPtr driver, + virDomainObjPtr vm, + qemuDomainAsyncJob asyncJob) +{ + int ret; + + if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) + return -1; + + ret =3D qemuMonitorSetCapabilities(QEMU_DOMAIN_PRIVATE(vm)->mon); + + if (qemuDomainObjExitMonitor(driver, vm) < 0) + ret =3D -1; + + return ret; +} + + static int qemuConnectMonitor(virQEMUDriverPtr driver, virDomainObjPtr vm, int asyncJ= ob, qemuDomainLogContextPtr logCtxt) { qemuDomainObjPrivatePtr priv =3D vm->privateData; - int ret =3D -1; qemuMonitorPtr mon =3D NULL; unsigned long long timeout =3D 0; =20 @@ -1794,13 +1813,12 @@ qemuConnectMonitor(virQEMUDriverPtr driver, virDoma= inObjPtr vm, int asyncJob, return -1; } =20 + if (qemuProcessInitMonitor(driver, vm, asyncJob) < 0) + return -1; =20 if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) return -1; =20 - if (qemuMonitorSetCapabilities(priv->mon) < 0) - goto cleanup; - if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_MIGRATION_EVENT) && qemuMonitorSetMigrationCapability(priv->mon, QEMU_MONITOR_MIGRATION_CAPS_EVEN= TS, @@ -1809,12 +1827,10 @@ qemuConnectMonitor(virQEMUDriverPtr driver, virDoma= inObjPtr vm, int asyncJob, virQEMUCapsClear(priv->qemuCaps, QEMU_CAPS_MIGRATION_EVENT); } =20 - ret =3D 0; - - cleanup: if (qemuDomainObjExitMonitor(driver, vm) < 0) - ret =3D -1; - return ret; + return -1; + + return 0; } =20 =20 --=20 2.14.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list