From nobody Thu May 2 01:20:56 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 1549969596507300.6736703046471; Tue, 12 Feb 2019 03:06:36 -0800 (PST) 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 14DE1C0669CC; Tue, 12 Feb 2019 11:06:34 +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 3BAD354505; Tue, 12 Feb 2019 11:06:33 +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 5BB4D1819AF9; Tue, 12 Feb 2019 11:06:30 +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 x1CB6SKq009059 for ; Tue, 12 Feb 2019 06:06:28 -0500 Received: by smtp.corp.redhat.com (Postfix) id A31B15D961; Tue, 12 Feb 2019 11:06:28 +0000 (UTC) Received: from icr.brq.redhat.com (unknown [10.43.2.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 29B345D9D1 for ; Tue, 12 Feb 2019 11:06:27 +0000 (UTC) From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Date: Tue, 12 Feb 2019 12:06:20 +0100 Message-Id: <4b842c710c95767680bc9ad149690cb636df0d0b.1549969567.git.jtomko@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 Subject: [libvirt] [PATCH 1/4] virsh: reduce the optimism in cmdIOThreadInfo 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.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Tue, 12 Feb 2019 11:06:34 +0000 (UTC) Instead of using niothreads which defaults to zero, use the common pattern with a ret varaible set to true just before the cleanup label. Signed-off-by: J=C3=A1n Tomko Reviewed-by: John Ferlan --- tools/virsh-domain.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 8b20059335..420ab5e2c3 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -7538,6 +7538,7 @@ cmdIOThreadInfo(vshControl *ctl, const vshCmd *cmd) unsigned int flags =3D VIR_DOMAIN_AFFECT_CURRENT; virshControlPtr priv =3D ctl->privData; vshTablePtr table =3D NULL; + bool ret =3D false; =20 VSH_EXCLUSIVE_OPTIONS_VAR(current, live); VSH_EXCLUSIVE_OPTIONS_VAR(current, config); @@ -7559,6 +7560,7 @@ cmdIOThreadInfo(vshControl *ctl, const vshCmd *cmd) } =20 if (niothreads =3D=3D 0) { + ret =3D true; vshPrintExtra(ctl, _("No IOThreads found for the domain")); goto cleanup; } @@ -7582,13 +7584,15 @@ cmdIOThreadInfo(vshControl *ctl, const vshCmd *cmd) =20 vshTablePrintToStdout(table, ctl); =20 + ret =3D true; + cleanup: for (i =3D 0; i < niothreads; i++) virDomainIOThreadInfoFree(info[i]); VIR_FREE(info); vshTableFree(table); virshDomainFree(dom); - return niothreads >=3D 0; + return ret; } =20 /* --=20 2.19.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 01:20:56 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 1549969618201125.47115107076377; Tue, 12 Feb 2019 03:06:58 -0800 (PST) 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 4D8EB89ACA; Tue, 12 Feb 2019 11:06:55 +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 15C7C6013E; Tue, 12 Feb 2019 11:06:55 +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 C41A83F774; Tue, 12 Feb 2019 11:06:54 +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 x1CB6TkH009067 for ; Tue, 12 Feb 2019 06:06:29 -0500 Received: by smtp.corp.redhat.com (Postfix) id 768EF5D962; Tue, 12 Feb 2019 11:06:29 +0000 (UTC) Received: from icr.brq.redhat.com (unknown [10.43.2.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id EF8765D9D1 for ; Tue, 12 Feb 2019 11:06:28 +0000 (UTC) From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Date: Tue, 12 Feb 2019 12:06:21 +0100 Message-Id: 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 Subject: [libvirt] [PATCH 2/4] virsh: do not assign negative values to niothreads 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.26]); Tue, 12 Feb 2019 11:06:56 +0000 (UTC) Use a temporary 'rc' variable to avoid comparing signed and unsigned integers in the cleanup section. Bug introduced by commit 3072ded which added the comparison against the unsigned 'i'. Also make niothreads size_t to mark that it should be unsigned. Signed-off-by: J=C3=A1n Tomko Reviewed-by: John Ferlan --- tools/virsh-domain.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 420ab5e2c3..17dd992751 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -7531,7 +7531,7 @@ cmdIOThreadInfo(vshControl *ctl, const vshCmd *cmd) bool config =3D vshCommandOptBool(cmd, "config"); bool live =3D vshCommandOptBool(cmd, "live"); bool current =3D vshCommandOptBool(cmd, "current"); - int niothreads =3D 0; + size_t niothreads =3D 0; virDomainIOThreadInfoPtr *info; size_t i; int maxcpu; @@ -7539,6 +7539,7 @@ cmdIOThreadInfo(vshControl *ctl, const vshCmd *cmd) virshControlPtr priv =3D ctl->privData; vshTablePtr table =3D NULL; bool ret =3D false; + int rc; =20 VSH_EXCLUSIVE_OPTIONS_VAR(current, live); VSH_EXCLUSIVE_OPTIONS_VAR(current, config); @@ -7554,10 +7555,11 @@ cmdIOThreadInfo(vshControl *ctl, const vshCmd *cmd) if ((maxcpu =3D virshNodeGetCPUCount(priv->conn)) < 0) goto cleanup; =20 - if ((niothreads =3D virDomainGetIOThreadInfo(dom, &info, flags)) < 0) { + if ((rc =3D virDomainGetIOThreadInfo(dom, &info, flags)) < 0) { vshError(ctl, _("Unable to get domain IOThreads information")); goto cleanup; } + niothreads =3D rc; =20 if (niothreads =3D=3D 0) { ret =3D true; --=20 2.19.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 01:20:56 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 1549969616757908.4586547282014; Tue, 12 Feb 2019 03:06:56 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 10DCF81F12; Tue, 12 Feb 2019 11:06:54 +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 C910B101960B; Tue, 12 Feb 2019 11:06:53 +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 7C4891819AFC; Tue, 12 Feb 2019 11:06:53 +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 x1CB6U9V009074 for ; Tue, 12 Feb 2019 06:06:30 -0500 Received: by smtp.corp.redhat.com (Postfix) id 49CBF5D962; Tue, 12 Feb 2019 11:06:30 +0000 (UTC) Received: from icr.brq.redhat.com (unknown [10.43.2.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id C46745D9D1 for ; Tue, 12 Feb 2019 11:06:29 +0000 (UTC) From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Date: Tue, 12 Feb 2019 12:06:22 +0100 Message-Id: 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 Subject: [libvirt] [PATCH 3/4] virsh: remove redundant virshNodeGetCPUCount 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.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Tue, 12 Feb 2019 11:06:55 +0000 (UTC) Since commit 4c4b821e it is not used for anything. Signed-off-by: J=C3=A1n Tomko Reviewed-by: John Ferlan --- tools/virsh-domain.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 17dd992751..516b647401 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -7534,9 +7534,7 @@ cmdIOThreadInfo(vshControl *ctl, const vshCmd *cmd) size_t niothreads =3D 0; virDomainIOThreadInfoPtr *info; size_t i; - int maxcpu; unsigned int flags =3D VIR_DOMAIN_AFFECT_CURRENT; - virshControlPtr priv =3D ctl->privData; vshTablePtr table =3D NULL; bool ret =3D false; int rc; @@ -7552,9 +7550,6 @@ cmdIOThreadInfo(vshControl *ctl, const vshCmd *cmd) if (!(dom =3D virshCommandOptDomain(ctl, cmd, NULL))) return false; =20 - if ((maxcpu =3D virshNodeGetCPUCount(priv->conn)) < 0) - goto cleanup; - if ((rc =3D virDomainGetIOThreadInfo(dom, &info, flags)) < 0) { vshError(ctl, _("Unable to get domain IOThreads information")); goto cleanup; --=20 2.19.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 01:20:56 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 1549969620469898.6784623426914; Tue, 12 Feb 2019 03:07:00 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3A18D89ACD; Tue, 12 Feb 2019 11:06:58 +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 EC0B7104C512; Tue, 12 Feb 2019 11:06: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 A48B63F603; Tue, 12 Feb 2019 11:06: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 x1CB6V0c009082 for ; Tue, 12 Feb 2019 06:06:31 -0500 Received: by smtp.corp.redhat.com (Postfix) id 1CB9E5D9D1; Tue, 12 Feb 2019 11:06:31 +0000 (UTC) Received: from icr.brq.redhat.com (unknown [10.43.2.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 974A75D962 for ; Tue, 12 Feb 2019 11:06:30 +0000 (UTC) From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Date: Tue, 12 Feb 2019 12:06:23 +0100 Message-Id: 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 Subject: [libvirt] [PATCH 4/4] virsh: initialize info in cmdIOThreadInfo 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.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Tue, 12 Feb 2019 11:06:59 +0000 (UTC) Although it is not needed at the moment, do not rely on a value being set before the first jump to cleanup. Signed-off-by: J=C3=A1n Tomko Reviewed-by: John Ferlan --- tools/virsh-domain.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 516b647401..825c07ac96 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -7532,7 +7532,7 @@ cmdIOThreadInfo(vshControl *ctl, const vshCmd *cmd) bool live =3D vshCommandOptBool(cmd, "live"); bool current =3D vshCommandOptBool(cmd, "current"); size_t niothreads =3D 0; - virDomainIOThreadInfoPtr *info; + virDomainIOThreadInfoPtr *info =3D NULL; size_t i; unsigned int flags =3D VIR_DOMAIN_AFFECT_CURRENT; vshTablePtr table =3D NULL; --=20 2.19.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list