From nobody Thu May 2 16:08:35 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=fail(p=none dis=none) header.from=canonical.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1524120079493841.0441935477951; Wed, 18 Apr 2018 23:41:19 -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 0EECC3133E61; Thu, 19 Apr 2018 06:41:18 +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 9E66975D0F; Thu, 19 Apr 2018 06:41:17 +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 6C18F4CA9C; Thu, 19 Apr 2018 06:41:16 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w3J6fEXq002263 for ; Thu, 19 Apr 2018 02:41:14 -0400 Received: by smtp.corp.redhat.com (Postfix) id 52C6875D0A; Thu, 19 Apr 2018 06:41:14 +0000 (UTC) Received: from mx1.redhat.com (ext-mx01.extmail.prod.ext.phx2.redhat.com [10.5.110.25]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4B68C75D08; Thu, 19 Apr 2018 06:41:10 +0000 (UTC) Received: from youngberry.canonical.com (youngberry.canonical.com [91.189.89.112]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id AD97381DEE; Thu, 19 Apr 2018 06:41:09 +0000 (UTC) Received: from 147-060-210-188.ip-addr.inexio.net ([188.210.60.147] helo=lap.fritz.box) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.76) (envelope-from ) id 1f93Fk-0006vF-9e; Thu, 19 Apr 2018 06:41:08 +0000 From: Christian Ehrhardt To: libvir-list@redhat.com, =?UTF-8?q?Guido=20G=C3=BCnther?= , Michal Privoznik , Dariusz Gadomski Date: Thu, 19 Apr 2018 08:41:02 +0200 Message-Id: <1524120063-3312-2-git-send-email-christian.ehrhardt@canonical.com> In-Reply-To: <1524120063-3312-1-git-send-email-christian.ehrhardt@canonical.com> References: <1524120063-3312-1-git-send-email-christian.ehrhardt@canonical.com> X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 207 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Thu, 19 Apr 2018 06:41:09 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Thu, 19 Apr 2018 06:41:09 +0000 (UTC) for IP:'91.189.89.112' DOMAIN:'youngberry.canonical.com' HELO:'youngberry.canonical.com' FROM:'christian.ehrhardt@canonical.com' RCPT:'' X-RedHat-Spam-Score: -5 (RCVD_IN_DNSWL_HI) 91.189.89.112 youngberry.canonical.com 91.189.89.112 youngberry.canonical.com X-Scanned-By: MIMEDefang 2.83 on 10.5.110.25 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Cc: Christian Ehrhardt Subject: [libvirt] [PATCH v2 1/2] tools: fix check_guests_shutdown loop 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.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.46]); Thu, 19 Apr 2018 06:41:18 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The recent fix to libvirt-guests.sh.in works for what it intended to fix (variable scope) but failed to adapt the loop in check_guests_shutdown correctly. Due to that it currently might detect all guests as "Failed to determine state of guest" by bad var content or just assumes they are shut down by picking up an empty variable. This commit fixes loop to use the passed value and the call in the loop to actually use the variable assigned in the iterated. Fixes: 7e476356 "tools: fix variable scope in in check_guests_shutdown" Fixes: https://bugs.launchpad.net/ubuntu/+source/libvirt/+bug/1764668 Reviewed-by: Dariusz Gadomski Signed-off-by: Christian Ehrhardt --- tools/libvirt-guests.sh.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/libvirt-guests.sh.in b/tools/libvirt-guests.sh.in index fcada31..28fe506 100644 --- a/tools/libvirt-guests.sh.in +++ b/tools/libvirt-guests.sh.in @@ -336,8 +336,8 @@ check_guests_shutdown() guests_to_check=3D$2 =20 guests_shutting_down=3D - for guest in $guests; do - if ! guest_is_on "$uri" "$guests_to_check" >/dev/null 2>&1; then + for guest in $guests_to_check; do + if ! guest_is_on "$uri" "$guest" >/dev/null 2>&1; then eval_gettext "Failed to determine state of guest: \$guest. Not= tracking it anymore." echo continue --=20 2.7.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 16:08:35 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=fail(p=none dis=none) header.from=canonical.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1524120088999848.2586620212095; Wed, 18 Apr 2018 23:41:28 -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 F27848553D; Thu, 19 Apr 2018 06:41:26 +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 B4B9F18390; Thu, 19 Apr 2018 06:41:26 +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 44437180215E; Thu, 19 Apr 2018 06:41:26 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w3J6fKvg002603 for ; Thu, 19 Apr 2018 02:41:20 -0400 Received: by smtp.corp.redhat.com (Postfix) id 0858017CFF; Thu, 19 Apr 2018 06:41:20 +0000 (UTC) Received: from mx1.redhat.com (ext-mx02.extmail.prod.ext.phx2.redhat.com [10.5.110.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id EB56717F32; Thu, 19 Apr 2018 06:41:16 +0000 (UTC) Received: from youngberry.canonical.com (youngberry.canonical.com [91.189.89.112]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A7A0C85A07; Thu, 19 Apr 2018 06:41:10 +0000 (UTC) Received: from 147-060-210-188.ip-addr.inexio.net ([188.210.60.147] helo=lap.fritz.box) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.76) (envelope-from ) id 1f93Fl-0006vF-Fq; Thu, 19 Apr 2018 06:41:09 +0000 From: Christian Ehrhardt To: libvir-list@redhat.com, =?UTF-8?q?Guido=20G=C3=BCnther?= , Michal Privoznik , Dariusz Gadomski Date: Thu, 19 Apr 2018 08:41:03 +0200 Message-Id: <1524120063-3312-3-git-send-email-christian.ehrhardt@canonical.com> In-Reply-To: <1524120063-3312-1-git-send-email-christian.ehrhardt@canonical.com> References: <1524120063-3312-1-git-send-email-christian.ehrhardt@canonical.com> X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 207 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Thu, 19 Apr 2018 06:41:15 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Thu, 19 Apr 2018 06:41:15 +0000 (UTC) for IP:'91.189.89.112' DOMAIN:'youngberry.canonical.com' HELO:'youngberry.canonical.com' FROM:'christian.ehrhardt@canonical.com' RCPT:'' X-RedHat-Spam-Score: -5 (RCVD_IN_DNSWL_HI) 91.189.89.112 youngberry.canonical.com 91.189.89.112 youngberry.canonical.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.26 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Cc: Christian Ehrhardt Subject: [libvirt] [PATCH v2 2/2] tools: do not report unknown guests in print_guests_shutdown 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.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.28]); Thu, 19 Apr 2018 06:41:27 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" If another event in background while running libvirt-guests.sh completely undefines a guest it will no more be available for proper reporting of its shutdown. This appears in the log as: Failed to determint state of guest: . Not tracking it anymore Shutdown of guest complete The first message already reports that we are giving up on the guest (per UUID which is all we have left at that point). To avoid the message with an empty guest_name in such a case lets check what guest_name returned and only print a report on valid content. Signed-off-by: Christian Ehrhardt Reviewed-by: Dariusz Gadomski --- tools/libvirt-guests.sh.in | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/libvirt-guests.sh.in b/tools/libvirt-guests.sh.in index 28fe506..4bc6e86 100644 --- a/tools/libvirt-guests.sh.in +++ b/tools/libvirt-guests.sh.in @@ -363,8 +363,10 @@ print_guests_shutdown() esac =20 name=3D$(guest_name "$uri" "$guest") - eval_gettext "Shutdown of guest \$name complete." - echo + if [ -n "$name" ]; then + eval_gettext "Shutdown of guest \$name complete." + echo + fi done } =20 --=20 2.7.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list