OpenVZ Forum


Home » General » Support » Stopping puppet on hn stops it in all VE
Stopping puppet on hn stops it in all VE [message #14704] Fri, 06 July 2007 16:15 Go to next message
ugob is currently offline  ugob
Messages: 271
Registered: March 2007
Senior Member
HN: centos4
VE: centos4

[root@hn init.d]# vzctl exec 101 /etc/init.d/puppet status
puppetd (pid 5994) is running...

[root@hn init.d]# service puppet stop
Stopping puppet: [ OK ]
[root@hn init.d]# vzctl exec 101 /etc/init.d/puppet status
puppetd is stopped

Please let me know if you need more info.

Here is the puppet init script:

#!/bin/bash
# puppet        Init script for running the puppet client daemon
#
# Author:       Duane Griffin <d.griffin@psenterprise.com>
#               David Lutterkort <dlutter@redhat.com>
#
# chkconfig: - 98 02
#
# description: Enables periodic system configuration checks through puppet.
# processname: puppet
# config: /etc/sysconfig/puppet

PATH=/usr/bin:/sbin:/bin:/usr/sbin
export PATH

[ -f /etc/sysconfig/puppet ] && . /etc/sysconfig/puppet
lockfile=${LOCKFILE-/var/lock/subsys/puppet}
pidfile=${PIDFILE-/var/run/puppet.pid}
puppetd=${PUPPETD-/usr/sbin/puppetd}
RETVAL=0

# Source function library.
. /etc/rc.d/init.d/functions

PUPPET_OPTS=""
[ -n "${PUPPET_SERVER}" ] && PUPPET_OPTS="--server=${PUPPET_SERVER}"
[ -n "$PUPPET_LOG" ] && PUPPET_OPTS="${PUPPET_OPTS} --logdest=${PUPPET_LOG}"
[ -n "$PUPPET_PORT" ] && PUPPET_OPTS="${PUPPET_OPTS} --port=${PUPPET_PORT}"

# Figure out if the system just booted. Let's assume
# boot doesn't take longer than 5 minutes
## Not used for now
##[ -n "$INIT_VERSION" ] && PUPPET_OPTS="${PUPPET_OPTS} --fullrun"

start() {
        echo -n $"Starting puppet: "
        daemon $puppetd ${PUPPET_OPTS} ${PUPPET_EXTRA_OPTS}
        RETVAL=$?
        echo
        [ $RETVAL = 0 ] && touch ${lockfile}
        return $RETVAL
}

stop() {
        echo -n $"Stopping puppet: "
        killproc $puppetd
        RETVAL=$?
        echo
        [ $RETVAL = 0 ] && rm -f ${lockfile} ${pidfile}
}

reload() {
        echo -n $"Restarting puppet: "
        killproc $puppetd -HUP
        RETVAL=$?
        echo
        return $RETVAL
}

restart() {
    stop
    start
}

case "$1" in
  start)
        start
        ;;
  stop)
        stop
        ;;
  restart)
        restart
        ;;
  reload|force-reload)
        reload
        ;;
  condrestart|try-restart)
        [ -f "$pidfile" ] && restart
        ;;
  status)
        status $puppetd
        ;;
  once)
        shift
        $puppetd -o ${PUPPET_OPTS} ${PUPPET_EXTRA_OPTS} $@
        ;;
  *)
        echo $"Usage: $0 {start|stop|status|restart|reload|force-reload|condrestart|once}"
        exit 1
esac

exit $RETVAL


Please read the manual before asking questions:
http://download.openvz.org/doc/OpenVZ-Users-Guide.pdf

Please have a look at the wiki before asking questions:
http://wiki.openvz.org/Main_Page
Re: Stopping puppet on hn stops it in all VE [message #14732 is a reply to message #14704] Mon, 09 July 2007 10:16 Go to previous messageGo to next message
n00b_admin is currently offline  n00b_admin
Messages: 77
Registered: July 2006
Location: Romania
Member
This is a "problem" i also ran into.

You do not run any services on the hn that you run on the ve's.

I don't know how the puppet daemon works but i presume it works as a client-server (as far as i understood from their wiki), so you run the master on the hn and the clients on the ve's.

That should not pose any problems. Again if i understood correctly how puppet works.
Re: Stopping puppet on hn stops it in all VE [message #14746 is a reply to message #14732] Mon, 09 July 2007 13:48 Go to previous messageGo to next message
ugob is currently offline  ugob
Messages: 271
Registered: March 2007
Senior Member
n00b_admin wrote on Mon, 09 July 2007 06:16

This is a "problem" i also ran into.

You do not run any services on the hn that you run on the ve's.



I know we should not run any real services on the HN, but I still need to monitor/configure it. For example, crond works perfectly on the HN and when I do a 'service crond stop' on the HN, it only stops the instance on the HN, not in the VEs.

n00b_admin wrote on Mon, 09 July 2007 06:16



I don't know how the puppet daemon works but i presume it works as a client-server (as far as i understood from their wiki), so you run the master on the hn and the clients on the ve's.

That should not pose any problems. Again if i understood correctly how puppet works.


There is no problem running puppet on the HN, except for this problem. Well, the service tests on the HN are not done correctly, because if you tell puppet to make sure crond runs on the HN, it will say it is running even if it is not, because it sees all the VE's instances. I'll try monitoring the HN with nagios instead, but I'll still be configuring the HN with puppet.

Thanks,


Please read the manual before asking questions:
http://download.openvz.org/doc/OpenVZ-Users-Guide.pdf

Please have a look at the wiki before asking questions:
http://wiki.openvz.org/Main_Page
Re: Stopping puppet on hn stops it in all VE [message #14748 is a reply to message #14704] Mon, 09 July 2007 13:54 Go to previous messageGo to next message
n00b_admin is currently offline  n00b_admin
Messages: 77
Registered: July 2006
Location: Romania
Member
The actual problem lies in the initd script that kills all instances of puppetd.

You can hack the initd script to kill only the processid of the HN puppetd daemon Wink
Re: Stopping puppet on hn stops it in all VE [message #14749 is a reply to message #14748] Mon, 09 July 2007 13:59 Go to previous messageGo to next message
ugob is currently offline  ugob
Messages: 271
Registered: March 2007
Senior Member
I don't see how the script is different from crond's:

(stop parts only)

Puppet:
stop() {
        echo -n $"Stopping puppet: "
        killproc $puppetd
        RETVAL=$?
        echo
        [ $RETVAL = 0 ] && rm -f ${lockfile} ${pidfile}
}


Crond:
stop() {
        echo -n $"Stopping $prog: "
        if [ ! -e /var/lock/subsys/crond ]; then
            echo -n $"cannot stop crond: crond is not running."
            failure $"cannot stop crond: crond is not running."
            echo
            return 1;
        fi
        killproc crond
        RETVAL=$?
        echo
        [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/crond;
        return $RETVAL
}


I'd gladly submit this to the puppet's developpers, but I can't see how the behaviour is different.


Please read the manual before asking questions:
http://download.openvz.org/doc/OpenVZ-Users-Guide.pdf

Please have a look at the wiki before asking questions:
http://wiki.openvz.org/Main_Page
Re: Stopping puppet on hn stops it in all VE [message #14818 is a reply to message #14749] Wed, 11 July 2007 09:49 Go to previous messageGo to next message
Vasily Tarasov is currently offline  Vasily Tarasov
Messages: 1345
Registered: January 2006
Senior Member
Hello,

Well, as you know, beeing on HN you can see _all_ the processes on HN: even that one which are in VE. Consequently, in certain cercumstances killproc on HN can kill processes in VEs, because it doesn't now, that these processes are in VEs, but not on HN.

I suppose you to modify killproc procedure on HN in such way: check that the process to kill - is on HN (in VE0). You can use vzpid tool for it:
# vzpid 307
Pid     VEID    Name
307     0       bash
# vzpid 519
Pid     VEID    Name
519     101     atd

HTH,
Vasily
Re: Stopping puppet on hn stops it in all VE [message #15199 is a reply to message #14818] Fri, 20 July 2007 20:18 Go to previous message
ugob is currently offline  ugob
Messages: 271
Registered: March 2007
Senior Member
I don't understand why crond is resistant to this while puppetd isn't... they use the same function (killproc).

Please read the manual before asking questions:
http://download.openvz.org/doc/OpenVZ-Users-Guide.pdf

Please have a look at the wiki before asking questions:
http://wiki.openvz.org/Main_Page
Previous Topic: VE Kernel Version
Next Topic: VZDUMP Not Working
Goto Forum:
  


Current Time: Fri Nov 08 15:54:57 GMT 2024

Total time taken to generate the page: 0.03376 seconds