mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-21 12:05:17 +00:00
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:
parent
10d9038b74
commit
c086af6b9b
@ -461,26 +461,30 @@ stop() {
|
||||
done
|
||||
set +f
|
||||
|
||||
while read uri list; do
|
||||
if "$suspending"; then
|
||||
eval_gettext "Suspending guests on \$uri URI..."; echo
|
||||
else
|
||||
eval_gettext "Shutting down guests on \$uri URI..."; echo
|
||||
fi
|
||||
if [ -s "$LISTFILE" ]; then
|
||||
while read uri list; do
|
||||
if "$suspending"; then
|
||||
eval_gettext "Suspending guests on \$uri URI..."; echo
|
||||
else
|
||||
eval_gettext "Shutting down guests on \$uri URI..."; echo
|
||||
fi
|
||||
|
||||
if [ "$PARALLEL_SHUTDOWN" -gt 1 ] &&
|
||||
! "$suspending"; then
|
||||
shutdown_guests_parallel "$uri" "$list"
|
||||
else
|
||||
for guest in $list; do
|
||||
if "$suspending"; then
|
||||
suspend_guest "$uri" "$guest"
|
||||
else
|
||||
shutdown_guest "$uri" "$guest"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
done <"$LISTFILE"
|
||||
if [ "$PARALLEL_SHUTDOWN" -gt 1 ] &&
|
||||
! "$suspending"; then
|
||||
shutdown_guests_parallel "$uri" "$list"
|
||||
else
|
||||
for guest in $list; do
|
||||
if "$suspending"; then
|
||||
suspend_guest "$uri" "$guest"
|
||||
else
|
||||
shutdown_guest "$uri" "$guest"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
done <"$LISTFILE"
|
||||
else
|
||||
rm -f "$LISTFILE"
|
||||
fi
|
||||
|
||||
rm -f "$VAR_SUBSYS_LIBVIRT_GUESTS"
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user