From nobody Sun Feb 8 11:59:24 2026 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 1550842763239976.5598276785296; Fri, 22 Feb 2019 05:39:23 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7238D7F36B; Fri, 22 Feb 2019 13:39:21 +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 3C2D725279; Fri, 22 Feb 2019 13:39:21 +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 E1317247E2; Fri, 22 Feb 2019 13:39:20 +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 x1J95Iea016263 for ; Tue, 19 Feb 2019 04:05:18 -0500 Received: by smtp.corp.redhat.com (Postfix) id A49544139; Tue, 19 Feb 2019 09:05:18 +0000 (UTC) Received: from virval.usersys.redhat.com (unknown [10.43.2.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 51DE717C7B for ; Tue, 19 Feb 2019 09:05:15 +0000 (UTC) Received: by virval.usersys.redhat.com (Postfix, from userid 500) id 684DC10010E; Tue, 19 Feb 2019 10:05:09 +0100 (CET) From: Jiri Denemark To: libvir-list@redhat.com Date: Tue, 19 Feb 2019 10:04:55 +0100 Message-Id: <90f1efdc2355c8d18ce691a456fbcdabee0a442e.1550566126.git.jdenemar@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 12/20] qemu_process: Introduce qemuProcessQMPStart 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Fri, 22 Feb 2019 13:39:22 +0000 (UTC) Content-Type: text/plain; charset="utf-8" From: Chris Venteicher This is a replacement for qemuProcessQMPRun to make the name consistent with qemuProcessStart. The original qemuProcessQMPRun function is renamed as qemuProcessQMPLaunch and becomes one of the simpler functions called from the main qemuProcessQMPStart entry point. The following patches will move parts of the code in qemuProcessQMPLaunch to the other functions (qemuProcessQMPInit and qemuProcessQMPConnectMonitor). Signed-off-by: Chris Venteicher Signed-off-by: Jiri Denemark Reviewed-by: J=C3=A1n Tomko --- Notes: Version 7: - removed some fairy tales from the commit message and the documentation of qemuProcessQMPStart src/qemu/qemu_capabilities.c | 2 +- src/qemu/qemu_process.c | 74 +++++++++++++++++++++++++++++++++++- src/qemu/qemu_process.h | 2 +- 3 files changed, 74 insertions(+), 4 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 7460b452a0..4fd2169d49 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -4385,7 +4385,7 @@ virQEMUCapsInitQMPSingle(virQEMUCapsPtr qemuCaps, runUid, runGid, onlyTCG))) goto cleanup; =20 - if (qemuProcessQMPRun(proc) < 0) + if (qemuProcessQMPStart(proc) < 0) goto cleanup; =20 if (onlyTCG) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index d2859da2ec..19bc804d18 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -8391,8 +8391,21 @@ qemuProcessQMPNew(const char *binary, } =20 =20 -int -qemuProcessQMPRun(qemuProcessQMPPtr proc) +static int +qemuProcessQMPInit(qemuProcessQMPPtr proc) +{ + int ret =3D -1; + + VIR_DEBUG("proc=3D%p, emulator=3D%s", proc, proc->binary); + + ret =3D 0; + + return ret; +} + + +static int +qemuProcessQMPLaunch(qemuProcessQMPPtr proc) { virDomainXMLOptionPtr xmlopt =3D NULL; const char *machine; @@ -8480,6 +8493,63 @@ qemuProcessQMPRun(qemuProcessQMPPtr proc) } =20 =20 +static int +qemuProcessQMPConnectMonitor(qemuProcessQMPPtr proc) +{ + int ret =3D -1; + + VIR_DEBUG("proc=3D%p, emulator=3D%s, proc->pid=3D%lld", + proc, proc->binary, (long long)proc->pid); + + ret =3D 0; + + return ret; +} + + +/** + * qemuProcessQMPStart: + * @proc: QEMU process and connection state created by qemuProcessQMPNew() + * + * Start and connect to QEMU binary so QMP queries can be made. + * + * Usage: + * proc =3D qemuProcessQMPNew(binary, libDir, runUid, runGid, forceTCG); + * qemuProcessQMPStart(proc); + * ** Send QMP Queries to QEMU using monitor (proc->mon) ** + * qemuProcessQMPStop(proc); + * qemuProcessQMPFree(proc); + * + * Process error output (proc->stderr) remains available in qemuProcessQMP + * struct until qemuProcessQMPFree is called. + */ +int +qemuProcessQMPStart(qemuProcessQMPPtr proc) +{ + int ret =3D -1; + + VIR_DEBUG("proc=3D%p, emulator=3D%s", proc, proc->binary); + + if (qemuProcessQMPInit(proc) < 0) + goto cleanup; + + if (qemuProcessQMPLaunch(proc) < 0) + goto stop; + + if (qemuProcessQMPConnectMonitor(proc) < 0) + goto stop; + + ret =3D 0; + + cleanup: + return ret; + + stop: + qemuProcessQMPStop(proc); + goto cleanup; +} + + void qemuProcessQMPStop(qemuProcessQMPPtr proc) { diff --git a/src/qemu/qemu_process.h b/src/qemu/qemu_process.h index e7d4ca0c92..c075ae6445 100644 --- a/src/qemu/qemu_process.h +++ b/src/qemu/qemu_process.h @@ -240,7 +240,7 @@ qemuProcessQMPPtr qemuProcessQMPNew(const char *binary, =20 void qemuProcessQMPFree(qemuProcessQMPPtr proc); =20 -int qemuProcessQMPRun(qemuProcessQMPPtr proc); +int qemuProcessQMPStart(qemuProcessQMPPtr proc); =20 void qemuProcessQMPStop(qemuProcessQMPPtr proc); =20 --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list