From nobody Sun Feb 8 12:57:51 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 ARC-Seal: i=1; a=rsa-sha256; t=1560600699; cv=none; d=zoho.com; s=zohoarc; b=AgMFMTQh3J0o26hiy3qo2ehDRASfe4ByiFrg2pL3QrdeXyTDR5YRMLk0BRp+iWEWn5UF8WgQXgkDRsG5tqDSw9F4copHBL16L5I3Zl3ybghW6cwUtxgRp43Z2w0+bKpstXWFXtQcTeQx/o0p2sA4hCx/aqGZ5j1qEVKyAqF/qCI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560600699; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=7agjhNhfTvO3UfX4yqzs5ayqvT2Z4OW0eUXbLapEDAM=; b=l0kNp/U2OBA4o8mmRy3scuytAQF7bW3eGa7kTdIhJ6FlzUEgAgrKxpCuKErBj9ztJLPk3imRQH01nKYo4f8mlCsHfcgb20i1PXbcOqwM1ynjFNhmFMk1d3gEf0Om0fqg6uK7+ZgdU1lpmBV6/MkQCX5hAIJvOc469LKaBYlmxCk= ARC-Authentication-Results: i=1; mx.zoho.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 header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1560600699555926.6181785211459; Sat, 15 Jun 2019 05:11:39 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 087833086275; Sat, 15 Jun 2019 12:11:38 +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 D8FF860570; Sat, 15 Jun 2019 12:11:37 +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 A5592183300E; Sat, 15 Jun 2019 12:11:37 +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 x5FCBQuq029739 for ; Sat, 15 Jun 2019 08:11:27 -0400 Received: by smtp.corp.redhat.com (Postfix) id E88DE5C269; Sat, 15 Jun 2019 12:11:26 +0000 (UTC) Received: from lpt.redhat.com (ovpn-200-22.brq.redhat.com [10.40.200.22]) by smtp.corp.redhat.com (Postfix) with ESMTP id F0CC34D711 for ; Sat, 15 Jun 2019 12:11:25 +0000 (UTC) From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Date: Sat, 15 Jun 2019 14:11:36 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 07/10] qemu: monitor: remove mon->json checks 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-Type: text/plain; charset="utf-8" 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.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Sat, 15 Jun 2019 12:11:38 +0000 (UTC) Remove all the mon->json checks in qemuMonitor functions. Signed-off-by: J=C3=A1n Tomko --- src/qemu/qemu_monitor.c | 84 ++++++++++++----------------------------- 1 file changed, 25 insertions(+), 59 deletions(-) diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index 30c1b1e596..ab2b54e002 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -1197,7 +1197,7 @@ qemuMonitorInitBalloonObjectPath(qemuMonitorPtr mon, =20 /** * To update video memory size in status XML we need to load correct value= s from - * QEMU. This is supported only with JSON monitor. + * QEMU. * * Returns 0 on success, -1 on failure and sets proper error message. */ @@ -1211,29 +1211,25 @@ qemuMonitorUpdateVideoMemorySize(qemuMonitorPtr mon, =20 QEMU_CHECK_MONITOR(mon); =20 - if (mon->json) { - ret =3D qemuMonitorJSONFindLinkPath(mon, videoName, - video->info.alias, &path); - if (ret < 0) { - if (ret =3D=3D -2) - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Failed to find QOM Object path for " - "device '%s'"), videoName); - return -1; - } - - ret =3D qemuMonitorJSONUpdateVideoMemorySize(mon, video, path); - VIR_FREE(path); - return ret; + ret =3D qemuMonitorJSONFindLinkPath(mon, videoName, + video->info.alias, &path); + if (ret < 0) { + if (ret =3D=3D -2) + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Failed to find QOM Object path for " + "device '%s'"), videoName); + return -1; } =20 - return 0; + ret =3D qemuMonitorJSONUpdateVideoMemorySize(mon, video, path); + VIR_FREE(path); + return ret; } =20 =20 /** * To update video vram64 size in status XML we need to load correct value= from - * QEMU. This is supported only with JSON monitor. + * QEMU. * * Returns 0 on success, -1 on failure and sets proper error message. */ @@ -1247,23 +1243,19 @@ qemuMonitorUpdateVideoVram64Size(qemuMonitorPtr mon, =20 QEMU_CHECK_MONITOR(mon); =20 - if (mon->json) { - ret =3D qemuMonitorJSONFindLinkPath(mon, videoName, - video->info.alias, &path); - if (ret < 0) { - if (ret =3D=3D -2) - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Failed to find QOM Object path for " - "device '%s'"), videoName); - return -1; - } - - ret =3D qemuMonitorJSONUpdateVideoVram64Size(mon, video, path); - VIR_FREE(path); - return ret; + ret =3D qemuMonitorJSONFindLinkPath(mon, videoName, + video->info.alias, &path); + if (ret < 0) { + if (ret =3D=3D -2) + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Failed to find QOM Object path for " + "device '%s'"), videoName); + return -1; } =20 - return 0; + ret =3D qemuMonitorJSONUpdateVideoVram64Size(mon, video, path); + VIR_FREE(path); + return ret; } =20 =20 @@ -1700,9 +1692,6 @@ qemuMonitorSetCapabilities(qemuMonitorPtr mon) { QEMU_CHECK_MONITOR(mon); =20 - if (!mon->json) - return 0; - return qemuMonitorJSONSetCapabilities(mon); } =20 @@ -2015,9 +2004,6 @@ qemuMonitorGetCPUInfo(qemuMonitorPtr mon, if (VIR_ALLOC_N(info, maxvcpus) < 0) return -1; =20 - if (!mon->json) - hotplug =3D false; - /* initialize a few non-zero defaults */ qemuMonitorCPUInfoClear(info, maxvcpus); =20 @@ -2168,9 +2154,6 @@ qemuMonitorSetMemoryStatsPeriod(qemuMonitorPtr mon, if (!mon) return -1; =20 - if (!mon->json) - return -1; - if (period < 0) return -1; =20 @@ -2696,10 +2679,6 @@ qemuMonitorGetDumpGuestMemoryCapability(qemuMonitorP= tr mon, =20 QEMU_CHECK_MONITOR(mon); =20 - /* No capability is supported without JSON monitor */ - if (!mon->json) - return 0; - return qemuMonitorJSONGetDumpGuestMemoryCapability(mon, capability); } =20 @@ -3303,7 +3282,7 @@ qemuMonitorBlockCommit(qemuMonitorPtr mon, const char= *device, bool qemuMonitorSupportsActiveCommit(qemuMonitorPtr mon) { - if (!mon || !mon->json) + if (!mon) return false; =20 return qemuMonitorJSONSupportsActiveCommit(mon); @@ -3854,10 +3833,6 @@ qemuMonitorGetMigrationCapabilities(qemuMonitorPtr m= on, { QEMU_CHECK_MONITOR(mon); =20 - /* No capability is supported without JSON monitor */ - if (!mon->json) - return 0; - return qemuMonitorJSONGetMigrationCapabilities(mon, capabilities); } =20 @@ -4139,12 +4114,6 @@ qemuMonitorGetIOThreads(qemuMonitorPtr mon, =20 QEMU_CHECK_MONITOR(mon); =20 - /* Requires JSON to make the query */ - if (!mon->json) { - *iothreads =3D NULL; - return 0; - } - return qemuMonitorJSONGetIOThreads(mon, iothreads); } =20 @@ -4191,9 +4160,6 @@ qemuMonitorGetMemoryDeviceInfo(qemuMonitorPtr mon, =20 QEMU_CHECK_MONITOR(mon); =20 - if (!mon->json) - return -2; - if (!(*info =3D virHashCreate(10, virHashValueFree))) return -1; =20 --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list