]> xenbits.xensource.com Git - libvirt.git/commitdiff
tools: fix variable scope in in check_guests_shutdown
authorChristian Ehrhardt <christian.ehrhardt@canonical.com>
Mon, 19 Mar 2018 11:44:31 +0000 (12:44 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Mon, 19 Mar 2018 12:06:03 +0000 (13:06 +0100)
libvirt-guests.sh when run with more active guests than requested to
shut down in parallel will run until it times out only shutting down
the first set of guests.

This patch fixes parallel shutdown by fixing a variable scope issue
where check_guests_shutdown unintentionally reset $guests which
prevented further progress.

Fixes: https://bugs.launchpad.net/ubuntu/+source/libvirt/+bug/1688508
Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
tools/libvirt-guests.sh.in

index d5e68e5f827381ed203c023d4815bbea234cdcc2..fcada312e19a0c4d9675a3a38cfb63271b00a198 100644 (file)
@@ -333,11 +333,11 @@ guest_count()
 check_guests_shutdown()
 {
     uri=$1
-    guests=$2
+    guests_to_check=$2
 
     guests_shutting_down=
     for guest in $guests; do
-        if ! guest_is_on "$uri" "$guest" >/dev/null 2>&1; then
+        if ! guest_is_on "$uri" "$guests_to_check" >/dev/null 2>&1; then
             eval_gettext "Failed to determine state of guest: \$guest. Not tracking it anymore."
             echo
             continue