[libvirt] [PATCH] Fix libvirt-guests init script

Eric Blake eblake at redhat.com
Fri May 28 15:29:14 UTC 2010


On 05/28/2010 09:16 AM, Jiri Denemark wrote:
> Firstly, the init script has to touch its file under /var/lock/subsys
> when started, otherwise system would think it's not running and won't
> stop it during shutdown.
> 
> Secondly, for some reason there is a policy to automatically enable
> init scripts when they are installed, so let the specfile do this. We
> also need to start the init script to ensure it will be stopped during
> the first shutdown after installing the package.

Makes sense.

>  LISTFILE="$localstatedir"/lib/libvirt/libvirt-guests
> +VAR_SUBSYS_LIBVIRT_GUESTS="$localstatedir"/lock/subsys/libvirt-guests
>  
>  RETVAL=0
>  
> @@ -117,12 +118,17 @@ guest_is_on() {
>      return 0
>  }
>  
> +started() {
> +    touch $VAR_SUBSYS_LIBVIRT_GUESTS

touch "$VAR_SUBSYS_LIBVIRT_GUESTS"

> +}
> +
>  start() {
> -    [ -f $LISTFILE ] || return 0
> +    [ -f $LISTFILE ] || { started; return 0; }

Do we want to detect failures in started (that is, failure to touch the
lock file)?  Then again, failure to touch the lock file merely means
that stop won't be called automatically, but doesn't affect whether we
actually started and can call stop manually, so blindly succeeding seems
okay to me.

> +
> +    rm -f $VAR_SUBSYS_LIBVIRT_GUESTS

rm -f "$VAR_SUBSYS_LIBVIRT_GUESTS"

ACK with those tweaks.

-- 
Eric Blake   eblake at redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 619 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20100528/045388bf/attachment-0001.sig>


More information about the libvir-list mailing list