libvirt-guests: Remove LISTFILE if it's empty when stopping service

$LISTFILE is created even no domain is running, and the empty
$LISTFILE could cause improper service status.

    stopped ,with saved guests

Which is not right, as there is no domain was saved.
This commit is contained in:
Osier Yang 2012-05-15 16:22:28 +08:00
parent 10d9038b74
commit c086af6b9b

View File

@ -461,26 +461,30 @@ stop() {
done done
set +f set +f
while read uri list; do if [ -s "$LISTFILE" ]; then
if "$suspending"; then while read uri list; do
eval_gettext "Suspending guests on \$uri URI..."; echo if "$suspending"; then
else eval_gettext "Suspending guests on \$uri URI..."; echo
eval_gettext "Shutting down guests on \$uri URI..."; echo else
fi eval_gettext "Shutting down guests on \$uri URI..."; echo
fi
if [ "$PARALLEL_SHUTDOWN" -gt 1 ] && if [ "$PARALLEL_SHUTDOWN" -gt 1 ] &&
! "$suspending"; then ! "$suspending"; then
shutdown_guests_parallel "$uri" "$list" shutdown_guests_parallel "$uri" "$list"
else else
for guest in $list; do for guest in $list; do
if "$suspending"; then if "$suspending"; then
suspend_guest "$uri" "$guest" suspend_guest "$uri" "$guest"
else else
shutdown_guest "$uri" "$guest" shutdown_guest "$uri" "$guest"
fi fi
done done
fi fi
done <"$LISTFILE" done <"$LISTFILE"
else
rm -f "$LISTFILE"
fi
rm -f "$VAR_SUBSYS_LIBVIRT_GUESTS" rm -f "$VAR_SUBSYS_LIBVIRT_GUESTS"
} }