[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH] Fix initscript to check daemon pidfile



On Thu, Nov 12, 2009 at 07:33:30PM +0000, Daniel P. Berrange wrote:
> The libvirtd initscript could get confused between the system and
> session instances of the daemon. To avoid this it is neccessary
> to check the pidfile explicitly.
> 
> * daemon/libvirtd.init.in: Always check the pidfile of the system
>   daemon to avoid confusion with the session daemons
> ---
>  daemon/libvirtd.init.in |   11 ++++++-----
>  1 files changed, 6 insertions(+), 5 deletions(-)
> 
> diff --git a/daemon/libvirtd.init.in b/daemon/libvirtd.init.in
> index 43c2d68..071fe2c 100644
> --- a/daemon/libvirtd.init.in
> +++ b/daemon/libvirtd.init.in
> @@ -40,6 +40,7 @@
>  
>  SERVICE=libvirtd
>  PROCESS=libvirtd
> +PIDFILE= localstatedir@/run/$SERVICE.pid
>  
>  LIBVIRTD_CONFIG=
>  LIBVIRTD_ARGS=
> @@ -59,7 +60,7 @@ start() {
>      echo -n $"Starting $SERVICE daemon: "
>      mkdir -p @localstatedir@/cache/libvirt
>      rm -rf @localstatedir@/cache/libvirt/*
> -    KRB5_KTNAME=$KRB5_KTNAME daemon --check $SERVICE $PROCESS --daemon $LIBVIRTD_CONFIG_ARGS $LIBVIRTD_ARGS
> +    KRB5_KTNAME=$KRB5_KTNAME daemon --pidfile $PIDFILE --check $SERVICE $PROCESS --daemon $LIBVIRTD_CONFIG_ARGS $LIBVIRTD_ARGS
>      RETVAL=$?
>      echo
>      [ $RETVAL -eq 0 ] && touch @localstatedir@/lock/subsys/$SERVICE
> @@ -68,12 +69,12 @@ start() {
>  stop() {
>      echo -n $"Stopping $SERVICE daemon: "
>  
> -    killproc $PROCESS
> +    killproc -p $PIDFILE $PROCESS
>      RETVAL=$?
>      echo
>      if [ $RETVAL -eq 0 ]; then
>          rm -f @localstatedir@/lock/subsys/$SERVICE
> -        rm -f @localstatedir@/run/$SERVICE.pid
> +        rm -f $PIDFILE
>  	rm -rf @localstatedir@/cache/libvirt/*
>      fi
>  }
> @@ -86,7 +87,7 @@ restart() {
>  reload() {
>      echo -n $"Reloading $SERVICE configuration: "
>  
> -    killproc $PROCESS -HUP
> +    killproc -p $PIDFILE $PROCESS -HUP
>      RETVAL=$?
>      echo
>      return $RETVAL
> @@ -98,7 +99,7 @@ case "$1" in
>          $1
>          ;;
>      status)
> -        status $PROCESS
> +        status -p $PIDFILE $PROCESS
>          RETVAL=$?
>          ;;
>      force-reload)

  ACK, fairly annoying !

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel veillard com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]