From nobody Tue Feb 10 16:19:00 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 1547341021366797.8774069184542; Sat, 12 Jan 2019 16:57:01 -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 77B15796EC; Sun, 13 Jan 2019 00:56:59 +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 3EE2245C7; Sun, 13 Jan 2019 00:56:59 +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 F083C1888CE6; Sun, 13 Jan 2019 00:56:58 +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 x0D0upIQ001477 for ; Sat, 12 Jan 2019 19:56:51 -0500 Received: by smtp.corp.redhat.com (Postfix) id 9CEDF7F1CB; Sun, 13 Jan 2019 00:56:51 +0000 (UTC) Received: from cv1.lan (ovpn-126-68.rdu2.redhat.com [10.10.126.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id 18E2F81658; Sun, 13 Jan 2019 00:56:49 +0000 (UTC) From: Chris Venteicher To: libvir-list@redhat.com Date: Sat, 12 Jan 2019 18:50:07 -0600 Message-Id: <20190113005032.17880-9-cventeic@redhat.com> In-Reply-To: <20190113005032.17880-1-cventeic@redhat.com> References: <20190113005032.17880-1-cventeic@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Cc: walling@linux.ibm.com, Chris Venteicher , david@redhat.com, mprivozn@redhat.com, jdenemar@redhat.com, chris@venteicher.org Subject: [libvirt] [PATCH v6 08/33] qemu_process: All ProcessQMP errors are fatal 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.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.25]); Sun, 13 Jan 2019 00:57:00 +0000 (UTC) Content-Type: text/plain; charset="utf-8" In the past capabilities could be determined in other ways if QMP messaging didn't succeed so a non-fatal error case was included in the capabilities and QMP Process code. For a while now, QMP capabilities failure has been a fatal case. This patch makes QMP process failures return as a fatal error in all cases consistent with 1) all failures actually being fatal in QMP capabilities code and 2) the QMP process code being made generic. The process changes impact the capabilities code because non-fatal return codes are no longer returned. The rest of the QMP associated capabilities code is updated to make all errors fatal for consistency. Signed-off-by: Chris Venteicher --- src/qemu/qemu_capabilities.c | 14 ++------------ src/qemu/qemu_process.c | 15 +++------------ 2 files changed, 5 insertions(+), 24 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 35aac798d9..502bac5e43 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -4155,7 +4155,6 @@ virQEMUCapsInitQMPMonitor(virQEMUCapsPtr qemuCaps, if (qemuMonitorSetCapabilities(mon) < 0) { VIR_DEBUG("Failed to set monitor capabilities %s", virGetLastErrorMessage()); - ret =3D 0; goto cleanup; } =20 @@ -4164,7 +4163,6 @@ virQEMUCapsInitQMPMonitor(virQEMUCapsPtr qemuCaps, &package) < 0) { VIR_DEBUG("Failed to query monitor version %s", virGetLastErrorMessage()); - ret =3D 0; goto cleanup; } =20 @@ -4336,7 +4334,6 @@ virQEMUCapsInitQMPMonitorTCG(virQEMUCapsPtr qemuCaps = ATTRIBUTE_UNUSED, if (qemuMonitorSetCapabilities(mon) < 0) { VIR_DEBUG("Failed to set monitor capabilities %s", virGetLastErrorMessage()); - ret =3D 0; goto cleanup; } =20 @@ -4362,17 +4359,13 @@ virQEMUCapsInitQMP(virQEMUCapsPtr qemuCaps, qemuProcessQMPPtr proc =3D NULL; qemuProcessQMPPtr procTCG =3D NULL; int ret =3D -1; - int rc; =20 if (!(proc =3D qemuProcessQMPNew(qemuCaps->binary, libDir, runUid, runGid, qmperr, false))) goto cleanup; =20 - if ((rc =3D qemuProcessQMPRun(proc)) !=3D 0) { - if (rc =3D=3D 1) - ret =3D 0; + if (qemuProcessQMPRun(proc) < 0) goto cleanup; - } =20 if (virQEMUCapsInitQMPMonitor(qemuCaps, proc->mon) < 0) goto cleanup; @@ -4387,11 +4380,8 @@ virQEMUCapsInitQMP(virQEMUCapsPtr qemuCaps, procTCG =3D qemuProcessQMPNew(qemuCaps->binary, libDir, runUid, runGid, NULL, true); =20 - if ((rc =3D qemuProcessQMPRun(procTCG)) !=3D 0) { - if (rc =3D=3D 1) - ret =3D 0; + if (qemuProcessQMPRun(procTCG) < 0) goto cleanup; - } =20 if (virQEMUCapsInitQMPMonitorTCG(qemuCaps, procTCG->mon) < 0) goto cleanup; diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 297a542e3d..f662b7d2ce 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -8271,10 +8271,6 @@ qemuProcessQMPNew(const char *binary, } =20 =20 -/* Returns -1 on fatal error, - * 0 on success, - * 1 when probing QEMU failed - */ int qemuProcessQMPRun(qemuProcessQMPPtr proc) { @@ -8315,19 +8311,18 @@ qemuProcessQMPRun(qemuProcessQMPPtr proc) =20 virCommandSetErrorBuffer(proc->cmd, proc->qmperr); =20 - /* Log, but otherwise ignore, non-zero status. */ if (virCommandRun(proc->cmd, &status) < 0) goto cleanup; =20 if (status !=3D 0) { VIR_DEBUG("QEMU %s exited with status %d: %s", proc->binary, status, *proc->qmperr); - goto ignore; + goto cleanup; } =20 if (virPidFileReadPath(proc->pidfile, &proc->pid) < 0) { VIR_DEBUG("Failed to read pidfile %s", proc->pidfile); - goto ignore; + goto cleanup; } =20 if (!(xmlopt =3D virDomainXMLOptionNew(NULL, NULL, NULL, NULL, NULL)) = || @@ -8338,7 +8333,7 @@ qemuProcessQMPRun(qemuProcessQMPPtr proc) =20 if (!(proc->mon =3D qemuMonitorOpen(proc->vm, &proc->config, true, tru= e, 0, &callbacks, NULL))) - goto ignore; + goto cleanup; =20 virObjectLock(proc->mon); =20 @@ -8350,10 +8345,6 @@ qemuProcessQMPRun(qemuProcessQMPPtr proc) virObjectUnref(xmlopt); =20 return ret; - - ignore: - ret =3D 1; - goto cleanup; } =20 =20 --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list