From nobody Tue Nov 26 22:19:27 2024 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=1565092079; cv=none; d=zoho.com; s=zohoarc; b=IbeyYwKT0tMsCD6+vWBsHfLDStr+tYTRITON12ZwxyNNkFjqFtqP89RNAQRlOCY527bsS5hg1ztR4JGUXKTHkNH+cDxGsYEiuIPusC5M5s16q2T4l+idd7vb7O+TYMytxKStvuXiMsgDxW2LUOaHZb64i49F5anOXmG+ZJ+SmaI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565092079; h=Content-Type:Content-Transfer-Encoding:Cc: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=zhnlmcxYrOOkD5NhGSq6YFlj57zcX4sTgZ1I29KL/9k=; b=a3zyjEV5znrLnp5Qn0ynst8VC8z9V9oswvpP9kgFmpJdGas/UzXjh5rWXcovAd7PKRX0Wc0tmfw+0ClCAjUf4y9dNGGxowEL0yrYpFShX9W3iGvvTkcZn6/EFBPfvbN3UBZrRSms23gL246x2FQ+1A/DSf0F2XMtra5owhfRb+g= 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 1565092079436189.82508456748985; Tue, 6 Aug 2019 04:47:59 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id CF1D599D2E; Tue, 6 Aug 2019 11:47:57 +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 AD3C05D71C; Tue, 6 Aug 2019 11:47:57 +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 717FC180BA99; Tue, 6 Aug 2019 11:47:57 +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 x76Bls8N022388 for ; Tue, 6 Aug 2019 07:47:54 -0400 Received: by smtp.corp.redhat.com (Postfix) id 1B4B45DA8C; Tue, 6 Aug 2019 11:47:54 +0000 (UTC) Received: from moe.brq.redhat.com (unknown [10.43.2.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4E7585DA21; Tue, 6 Aug 2019 11:47:53 +0000 (UTC) From: Michal Privoznik To: libvir-list@redhat.com Date: Tue, 6 Aug 2019 13:47:46 +0200 Message-Id: <0f8e54c4f2c50d3aedd3c689b503a4aae6464e6b.1565092024.git.mprivozn@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 Cc: huaqiang.wang@intel.com Subject: [libvirt] [PATCH 3/3] qemuDomainGetResctrlMonData: Switch to switch() 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.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Tue, 06 Aug 2019 11:47:58 +0000 (UTC) Content-Type: text/plain; charset="utf-8" This way it is obvious when adding a new resource control type that stats helper func needs to be updated too. Signed-off-by: Michal Privoznik --- src/qemu/qemu_driver.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 25b6653e38..5606639482 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -20743,10 +20743,14 @@ qemuDomainGetResctrlMonData(virQEMUDriverPtr driv= er, =20 caps =3D virQEMUDriverGetCapabilities(driver, false); =20 - if (tag =3D=3D VIR_RESCTRL_MONITOR_TYPE_CACHE) { + switch (tag) { + case VIR_RESCTRL_MONITOR_TYPE_CACHE: if (caps->host.cache.monitor) features =3D caps->host.cache.monitor->features; - } else { + break; + case VIR_RESCTRL_MONITOR_TYPE_MEMBW: + case VIR_RESCTRL_MONITOR_TYPE_UNSUPPORT: + case VIR_RESCTRL_MONITOR_TYPE_LAST: virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s", _("Unsupported resctrl monitor type")); return -1; --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list