[libvirt] [PATCH v2] Init script for handling guests on shutdown/boot

Jiri Denemark jdenemar at redhat.com
Tue May 18 18:35:59 UTC 2010


> > +    while read uri list; do
> > +        if $suspending; then
> > +            echo $"Suspending guests on $uri URI..."
> > +        else
> > +            echo $"Shutting down guests on $uri URI..."
> > +        fi
> > +
> > +        for guest in $list; do
> > +            if $suspending; then
> > +                suspend_guest $uri $guest
> > +            else
> > +                shutdown_guest $uri $guest
> > +            fi
> > +        done
> > +    done <$LISTFILE
> > +}
> 
> This works as is, so need to change it.
Nice typo :-P

> > +    shutdown)
> > +        ON_SHUTDOWN=shutdown
> > +        stop
> > +        ;;
> 
> If someone calls 'service libvirt-guests shutdown', but...
> 
> > +# action taken on host shutdown
> > +# - suspend   all running guests are suspended using virsh managedsave
> > +# - shutdown  all running guests are asked to shutdown. Please be careful with
> > +#             this settings since there is no way to distinguish between a
> > +#             guest which is stuck or ignores shutdown requests and a guest
> > +#             which just needs a long time to shutdown. When setting
> > +#             ON_SHUTDOWN=shutdown, you must also set SHUTDOWN_TIMEOUT to a
> > +#             value suitable for your guests.
> > +#ON_SHUTDOWN=suspend
> > +
> > +# number of seconds we're willing to wait for a guest to shut down
> > +#SHUTDOWN_TIMEOUT=0
> 
> ...left their config with the defaults, then the shutdown will fail
> because SHUTDOWN_TIMEOUT is still 0.  I guess that makes sense, though.

Yeah, that's the intent. We want to force users to set their own shutdown
timeout if they want to use this functionality.

>  Are we sure that init scripts called during '/sbin/shutdown' are
> normally called with 'stop' rather than 'shutdown' argument?

Hmm, I don't think anything calls init scripts with 'shutdown' argument, but
it might probably be better to rename as 'guestshutdown' to match
'gueststatus' and to avoid any confusion.

> Looks nicer!  ACK.

Thanks for the review.

Jirka




More information about the libvir-list mailing list