From nobody Wed May 1 13:38:21 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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1534857834553934.3162604206947; Tue, 21 Aug 2018 06:23:54 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7F924C04F4D1; Tue, 21 Aug 2018 13:23:52 +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 4651C308BDA0; Tue, 21 Aug 2018 13:23:52 +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 033B518005D0; Tue, 21 Aug 2018 13:23:52 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w7LDNnuC019732 for ; Tue, 21 Aug 2018 09:23:49 -0400 Received: by smtp.corp.redhat.com (Postfix) id 85BA77D4D4; Tue, 21 Aug 2018 13:23:49 +0000 (UTC) Received: from hansolo.redhat.com (ovpn-12-123.pek2.redhat.com [10.72.12.123]) by smtp.corp.redhat.com (Postfix) with ESMTP id 21F8C63F70; Tue, 21 Aug 2018 13:23:45 +0000 (UTC) From: Han Han To: libvir-list@redhat.com Date: Tue, 21 Aug 2018 21:23:42 +0800 Message-Id: <20180821132342.539-1-hhan@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-loop: libvir-list@redhat.com Cc: Han Han Subject: [libvirt] [PATCH] virsh: Don't break loop of domblkinfo for disks 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.24 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Tue, 21 Aug 2018 13:23:53 +0000 (UTC) X-ZohoMail: RDMRC_0 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" https://bugzilla.redhat.com/show_bug.cgi?id=3D1619625 --all option is added to cmdDomblkinfo since commit 62c39193 allowing to show all block devices info. Remove its 'goto cleanup' part in case it brea= ks the loop of domblkinfo for all disks. Remove unnecessary variables and the condition part after virDomainGetBlockInfo returning fail. Signed-off-by: Han Han --- tools/virsh-domain-monitor.c | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/tools/virsh-domain-monitor.c b/tools/virsh-domain-monitor.c index b9b4f9739b..ee926baae8 100644 --- a/tools/virsh-domain-monitor.c +++ b/tools/virsh-domain-monitor.c @@ -476,7 +476,6 @@ cmdDomblkinfo(vshControl *ctl, const vshCmd *cmd) size_t i; xmlNodePtr *disks =3D NULL; char *target =3D NULL; - char *protocol =3D NULL; =20 if (!(dom =3D virshCommandOptDomain(ctl, cmd, NULL))) return false; @@ -490,7 +489,6 @@ cmdDomblkinfo(vshControl *ctl, const vshCmd *cmd) human =3D vshCommandOptBool(cmd, "human"); =20 if (all) { - bool active =3D virDomainIsActive(dom) =3D=3D 1; int rc; =20 if (virshDomainGetXML(ctl, cmd, 0, &xmldoc, &ctxt) < 0) @@ -505,29 +503,18 @@ cmdDomblkinfo(vshControl *ctl, const vshCmd *cmd) =20 for (i =3D 0; i < ndisks; i++) { ctxt->node =3D disks[i]; - protocol =3D virXPathString("string(./source/@protocol)", ctxt= ); target =3D virXPathString("string(./target/@dev)", ctxt); =20 rc =3D virDomainGetBlockInfo(dom, target, &info, 0); =20 if (rc < 0) { - /* If protocol is present that's an indication of a networ= ked - * storage device which cannot provide statistics, so gene= rate - * 0 based data and get the next disk. */ - if (protocol && !active && - virGetLastErrorCode() =3D=3D VIR_ERR_INTERNAL_ERROR && - virGetLastErrorDomain() =3D=3D VIR_FROM_STORAGE) { - memset(&info, 0, sizeof(info)); - vshResetLibvirtError(); - } else { - goto cleanup; - } + memset(&info, 0, sizeof(info)); + vshResetLibvirtError(); } =20 cmdDomblkinfoPrint(ctl, &info, target, human, false); =20 VIR_FREE(target); - VIR_FREE(protocol); } } else { if (virDomainGetBlockInfo(dom, device, &info, 0) < 0) @@ -541,7 +528,6 @@ cmdDomblkinfo(vshControl *ctl, const vshCmd *cmd) cleanup: virshDomainFree(dom); VIR_FREE(target); - VIR_FREE(protocol); VIR_FREE(disks); xmlXPathFreeContext(ctxt); xmlFreeDoc(xmldoc); --=20 2.18.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list