[libvirt] [PATCH v2 2/2] tools: do not report unknown guests in print_guests_shutdown

Christian Ehrhardt posted 2 patches 7 years ago
[libvirt] [PATCH v2 2/2] tools: do not report unknown guests in print_guests_shutdown
Posted by Christian Ehrhardt 7 years ago
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: <UUID>. 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 <christian.ehrhardt@canonical.com>
---
 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
 
         name=$(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
 }
 
-- 
2.7.4

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH v2 2/2] tools: do not report unknown guests in print_guests_shutdown
Posted by Dariusz Gadomski 7 years ago
On Thu, Apr 19, 2018 at 08:41:03AM +0200, Christian Ehrhardt wrote:
> 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: <UUID>. 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 <christian.ehrhardt@canonical.com>
> ---
>  tools/libvirt-guests.sh.in | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
Reviewed-by: Dariusz Gadomski <dariusz.gadomski@canonical.com>

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list