<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Mar 22, 2018 at 5:26 PM, Martin Kletzander <span dir="ltr"><<a href="mailto:mkletzan@redhat.com" target="_blank">mkletzan@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On Mon, Mar 19, 2018 at 12:44:31PM +0100, Christian Ehrhardt wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
libvirt-guests.sh when run with more active guests than requested to<br>
shut down in parallel will run until it times out only shutting down<br>
the first set of guests.<br>
<br>
This patch fixes parallel shutdown by fixing a variable scope issue<br>
where check_guests_shutdown unintentionally reset $guests which<br>
prevented further progress.<br>
<br>
Fixes: <a href="https://bugs.launchpad.net/ubuntu/+source/libvirt/+bug/1688508" rel="noreferrer" target="_blank">https://bugs.launchpad.net/ubu<wbr>ntu/+source/libvirt/+bug/16885<wbr>08</a><br>
<br>
Signed-off-by: Christian Ehrhardt <<a href="mailto:christian.ehrhardt@canonical.com" target="_blank">christian.ehrhardt@canonical.<wbr>com</a>><br>
---<br>
tools/<a href="http://libvirt-guests.sh.in" rel="noreferrer" target="_blank">libvirt-guests.sh.in</a> | 4 ++--<br>
1 file changed, 2 insertions(+), 2 deletions(-)<br>
<br>
diff --git a/tools/<a href="http://libvirt-guests.sh.in" rel="noreferrer" target="_blank">libvirt-guests.sh.in</a> b/tools/<a href="http://libvirt-guests.sh.in" rel="noreferrer" target="_blank">libvirt-guests.sh.in</a><br>
index d5e68e5..fcada31 100644<br>
--- a/tools/<a href="http://libvirt-guests.sh.in" rel="noreferrer" target="_blank">libvirt-guests.sh.in</a><br>
+++ b/tools/<a href="http://libvirt-guests.sh.in" rel="noreferrer" target="_blank">libvirt-guests.sh.in</a><br>
@@ -333,11 +333,11 @@ guest_count()<br>
check_guests_shutdown()<br>
{<br>
    uri=$1<br>
-    guests=$2<br>
+    guests_to_check=$2<br>
<br>
    guests_shutting_down=<br>
    for guest in $guests; do<br>
-        if ! guest_is_on "$uri" "$guest" >/dev/null 2>&1; then<br>
+        if ! guest_is_on "$uri" "$guests_to_check" >/dev/null 2>&1; then<br>
            eval_gettext "Failed to determine state of guest: \$guest. Not tracking it anymore."<br>
</blockquote>
<br></div></div>
So I wanted to also send a patch for this                        ^^^^^^<br>
to be adjusted and realized it's not needed as that's a different<br>
variable.<br>
<br>
However, I also realized we're not using 'local' anywhere.  We should<br>
probably do that (maybe instead of renames in the future), so I'll add<br>
it to the BiteSizedTasks, I got to the half of the file and found out it<br>
can't be done with a regexp replace =)<br></blockquote><div><br></div><div>Hi Martin,</div><div>I agree that a general overhaul would be nice, but at least I couldn't affort the time this week to do so (away next week).</div><div>I guess you hit the fact that some functions intentionally do so with your regexp :-)</div><div>Also I was unsure about different shell implementations in doing some of the changes, so I didn't want to do a bigger change in a rush.</div><div><br></div><div>Thanks for adding it to the BiteSizedTasks - I think that is just the right thing to do.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
            echo<br>
            continue<span class="HOEnZb"><font color="#888888"><br>
-- <br>
2.7.4<br>
<br>
--<br>
libvir-list mailing list<br>
<a href="mailto:libvir-list@redhat.com" target="_blank">libvir-list@redhat.com</a><br>
<a href="https://www.redhat.com/mailman/listinfo/libvir-list" rel="noreferrer" target="_blank">https://www.redhat.com/mailman<wbr>/listinfo/libvir-list</a><br>
</font></span></blockquote>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><span style="color:rgb(136,136,136);font-size:12.8px">Christian Ehrhardt</span><div style="color:rgb(136,136,136);font-size:12.8px">Software Engineer, Ubuntu Server</div><div style="color:rgb(136,136,136);font-size:12.8px">Canonical Ltd</div></div></div></div></div>
</div></div>