From nobody Sun Feb 8 19:56:41 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 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=1628780205; cv=none; d=zohomail.com; s=zohoarc; b=dXpAXYoXzpIdMsbmHZS39ZNVdVO5AgNVXLroj6sren64z2dg+a1poRhDbqr7WkAlCXoCtnjjFIsoSeEyxk1ambsuR6ZrF6/0jZz0UC7cgB4jZp2zVpfW7PVB7lQmMX5iGBLy+tbBFNmnzWjnje2lGUJ5+sfEU0C94ZBPwCALhxo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1628780205; 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; bh=ES7HCyKqaizpilpTTfjfpRLTh92zWPKn7P2o2acW/Vs=; b=cuRIcDXlUSM+UjYcaz1cb5q52vVpvWZRQcQ+tHcfr2x3bN80VWjb93IkciOQEnUUSU7oyPGe477Rd0iwLYz1Ody3964Kv7IWC2AP6upqhQhrZEwswB1M3GYKquH0d15eF6iCxq5/2BrMxdOUjnCzOda0fADbEPEClyZZsh/jJTs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1628780205471611.0197534037821; Thu, 12 Aug 2021 07:56:45 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-207-szVkezTiOfeus431KJZUjQ-1; Thu, 12 Aug 2021 10:56:42 -0400 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4D3C7801AC5; Thu, 12 Aug 2021 14:56:37 +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 18A536C8FA; Thu, 12 Aug 2021 14:56: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 430304A70C; Thu, 12 Aug 2021 14:56:34 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 17CEnZe7008511 for ; Thu, 12 Aug 2021 10:49:35 -0400 Received: by smtp.corp.redhat.com (Postfix) id 9F2C419D9F; Thu, 12 Aug 2021 14:49:35 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.33]) by smtp.corp.redhat.com (Postfix) with ESMTP id 03F3419C44 for ; Thu, 12 Aug 2021 14:49:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1628780204; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=ES7HCyKqaizpilpTTfjfpRLTh92zWPKn7P2o2acW/Vs=; b=DoAF/zr5z4ZtKbUs0/JzDvihD3rxjMdd0QQnSCAFFIorWb0i7FOio6r8GIGQXaspu7O2Dy uXdPADFTpa9/Eu67zkPuj/WbzReXw8Zj9mkoha8HLWIhP6sl6Ck4eOGySGVzO5/RhkLkVb jhhvVMy2Pvz4pBXFmzilViOOzZCNxxw= X-MC-Unique: szVkezTiOfeus431KJZUjQ-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 13/22] qemuMonitorJSONSetBlockIoThrottle: Switch to standard error reporting Date: Thu, 12 Aug 2021 16:49:06 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1628780207845100001 Content-Type: text/plain; charset="utf-8" Use qemuMonitorJSONCheckError instead of handcrafted error reporting. Signed-off-by: Peter Krempa --- src/qemu/qemu_monitor_json.c | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 9931313baa..7727d1e7fb 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -5431,10 +5431,6 @@ int qemuMonitorJSONSetBlockIoThrottle(qemuMonitor *m= on, g_autoptr(virJSONValue) cmd =3D NULL; g_autoptr(virJSONValue) result =3D NULL; g_autoptr(virJSONValue) args =3D NULL; - const char *errdev =3D drivealias; - - if (!errdev) - errdev =3D qomid; if (!(cmd =3D qemuMonitorJSONMakeCommand("block_set_io_throttle", NULL= ))) return -1; @@ -5492,22 +5488,8 @@ int qemuMonitorJSONSetBlockIoThrottle(qemuMonitor *m= on, if (qemuMonitorJSONCommand(mon, cmd, &result) < 0) return -1; - if (virJSONValueObjectHasKey(result, "error")) { - if (qemuMonitorJSONHasError(result, "DeviceNotActive")) { - virReportError(VIR_ERR_OPERATION_INVALID, - _("No active operation on device: %s"), errdev); - } else if (qemuMonitorJSONHasError(result, "NotSupported")) { - virReportError(VIR_ERR_OPERATION_INVALID, - _("Operation is not supported for device: %s"),= errdev); - } else { - virJSONValue *error =3D virJSONValueObjectGet(result, "error"); - virReportError(VIR_ERR_INTERNAL_ERROR, - _("unable to execute '%s', unexpected error: '%= s'"), - qemuMonitorJSONCommandName(cmd), - qemuMonitorJSONStringifyError(error)); - } + if (qemuMonitorJSONCheckError(cmd, result) < 0) return -1; - } return 0; } --=20 2.31.1