pcp
[Top] [All Lists]

pidfile change breaks qa test which run non-root pmcd

To: pcp@xxxxxxxxxxx
Subject: pidfile change breaks qa test which run non-root pmcd
From: Michael Newton <kimbrr@xxxxxxx>
Date: Tue, 24 Jul 2007 11:32:17 +1000
Sender: pcp-bounce@xxxxxxxxxxx
Several QA tests run pmcd -f &
With the pidfile change, they break because they dont have
write permission on the pidfile. Here's a fix


===========================================================================
mgmt/pcp/qa/023
===========================================================================

--- a/mgmt/pcp/qa/023   2007-07-24 11:15:59.000000000 +1000
+++ b/mgmt/pcp/qa/023   2007-07-24 10:44:45.946768948 +1000
@@ -82,6 +82,7 @@
 SAVE_CONFIG=$tmp/pmcd.conf.save
 LOGCONTROL=$PCP_VAR_DIR/config/pmlogger/control
 SAVE_LOGCONTROL=$tmp/control.save
+PIDFILE=$PCP_RUN_DIR/pmcd.pid
 here=`pwd`
 sudo=$here/sudo
 _needclean=true
@@ -100,8 +101,7 @@
     if $_needclean
     then
        _needclean=false
-       $sudo "killall -TERM pmcd"
-
+       $sudo $PCP_RC_DIR/pcp stop | _filter_pcp_stop
         [ -f $SAVE_CONFIG ] && $sudo mv $SAVE_CONFIG $CONFIG
        [ -f $SAVE_LOGCONTROL ] && $sudo mv $SAVE_LOGCONTROL $LOGCONTROL
        [ ! -z "$SAVE_LOGGER" ] && _change_config pmlogger $SAVE_LOGGER
@@ -188,6 +188,8 @@

 # Note: start pmcd with -f so that its PID stays the same (no daemon)
 #
+$sudo touch $PIDFILE
+$sudo chmod a+w $PIDFILE
 PMCD_PORT=$port
 PATH=$PATH:$here/src-oss
 export PMCD_PORT PATH

===========================================================================
mgmt/pcp/qa/023.out.1
===========================================================================

--- a/mgmt/pcp/qa/023.out.1     2007-07-24 11:15:59.000000000 +1000
+++ b/mgmt/pcp/qa/023.out.1     2007-07-23 17:35:12.505588863 +1000
@@ -146,6 +146,7 @@
     inst [5 or "fake_cisco"] value 0
     inst [6 or "fake_six"] value 0

+Waiting for PMCD to terminate ...
 Restart and ping pmcd ...
 Performance Co-Pilot starting PMCD (logfile is $PCP_LOG_DIR/pmcd.log) ...
 Performance Co-Pilot starting archive loggers ...

===========================================================================
mgmt/pcp/qa/023.out.2
===========================================================================

--- a/mgmt/pcp/qa/023.out.2     2007-07-24 11:15:59.000000000 +1000
+++ b/mgmt/pcp/qa/023.out.2     2007-07-23 17:35:15.413211242 +1000
@@ -146,6 +146,7 @@
     inst [5 or "fake_cisco"] value 0
     inst [6 or "fake_six"] value 0

+Waiting for PMCD to terminate ...
 Restart and ping pmcd ...
 Performance Co-Pilot starting PMCD (logfile is $PCP_LOG_DIR/pmcd.log) ...
 Performance Co-Pilot starting archive loggers ...

===========================================================================
mgmt/pcp/qa/051
===========================================================================

--- a/mgmt/pcp/qa/051   2007-07-24 11:15:59.000000000 +1000
+++ b/mgmt/pcp/qa/051   2007-07-24 10:48:52.662690141 +1000
@@ -36,6 +36,7 @@
 oconfig=$config.O
 log=./pmcd.log
 me=`hostname`
+pidfile=$PCP_RUN_DIR/pmcd.pid

 rm -f $here/$seq.full

@@ -84,6 +85,7 @@

 cleanup()
 {
+    $sudo rm -f $pidfile
     if [ -f $oconfig ]
     then
        $sudo "mv $oconfig $config"
@@ -119,6 +121,8 @@
     exit 1
 fi

+$sudo chmod a+w $pidfile
+
 echo "terminating pmcd..."
 $sudo $PCP_RC_DIR/pcp stop | _filter_pcp_stop
 if [ -f $config ]

===========================================================================
mgmt/pcp/qa/243
===========================================================================

--- a/mgmt/pcp/qa/243   2007-07-24 11:15:59.000000000 +1000
+++ b/mgmt/pcp/qa/243   2007-07-24 10:56:05.858359093 +1000
@@ -71,6 +71,7 @@
 tmp=/var/tmp/$$
 here=`pwd`
 sudo=$here/sudo
+pidfile=$PCP_RUN_DIR/pmcd.pid
 _needclean=true

 rm -rf $tmp
@@ -84,7 +85,6 @@
     if $_needclean
     then
        _needclean=false
-       $sudo "killall -TERM pmcd"
        echo "Restart and ping pmcd ..."
        $sudo $PCP_RC_DIR/pcp start | _filter_pcp_start
        _wait_for_pmcd
@@ -102,6 +102,8 @@

 # Note: start pmcd with -f so that its PID stays the same (no daemon)
 #
+$sudo touch $pidfile
+$sudo chmod a+w $pidfile
 $PCP_PMCD_PROG -f -x err1 &

 _wait_for_pmcd

===========================================================================
mgmt/pcp/qa/243.out.1
===========================================================================

--- a/mgmt/pcp/qa/243.out.1     2007-07-24 11:15:59.000000000 +1000
+++ b/mgmt/pcp/qa/243.out.1     2007-07-24 11:02:17.418092178 +1000
@@ -12,6 +12,7 @@
 ... boring stuff deleted
 Checking that log hasn't changed ...
 Restart and ping pmcd ...
+Waiting for PMCD to terminate ...
 Performance Co-Pilot starting PMCD (logfile is $PCP_LOG_DIR/pmcd.log) ...
 Performance Co-Pilot starting archive loggers ...
 pmcd.control.debug 1

===========================================================================
mgmt/pcp/qa/243.out.2
===========================================================================

--- a/mgmt/pcp/qa/243.out.2     2007-07-24 11:15:59.000000000 +1000
+++ b/mgmt/pcp/qa/243.out.2     2007-07-24 11:01:25.656816784 +1000
@@ -16,6 +16,7 @@
 ok FD 4321 0x00000000 INADDR_ANY
 Checking that log hasn't changed ...
 Restart and ping pmcd ...
+Waiting for PMCD to terminate ...
 Performance Co-Pilot starting PMCD (logfile is $PCP_LOG_DIR/pmcd.log) ...
 Performance Co-Pilot starting archive loggers ...
 pmcd.control.debug 1

===========================================================================
mgmt/pcp/qa/244
===========================================================================

--- a/mgmt/pcp/qa/244   2007-07-24 11:15:59.000000000 +1000
+++ b/mgmt/pcp/qa/244   2007-07-24 10:50:52.979045148 +1000
@@ -90,6 +90,7 @@
 CONFIGSAVE=$tmp/pmcd.conf.save
 LOGCONTROL=$PCP_VAR_DIR/config/pmlogger/control
 SAVE_LOGCONTROL=$tmp/control.save
+PIDFILE=$PCP_RUN_DIR/pmcd.pid
 here=`pwd`
 sudo=$here/sudo
 _needclean=true
@@ -113,9 +114,8 @@
     if $_needclean
     then
        _needclean=false
-       $sudo killall -TERM pmcd
-       $sudo rm -f $CONFIG
-       $sudo cp $CONFIGSAVE $CONFIG
+       $sudo $PCP_RC_DIR/pcp stop | _filter_pcp_stop
+       [ -f $CONFIGSAVE ] && $sudo mv $CONFIGSAVE $CONFIG
        $sudo chmod u-w $CONFIG
        [ -f $SAVE_LOGCONTROL ] && $sudo mv $SAVE_LOGCONTROL $LOGCONTROL
        _restore_loggers
@@ -171,6 +171,8 @@
 # Note: start pmcd with -f so that its PID stays the same (no daemon)
 # Sleep briefly to allow it time to start
 #
+$sudo touch $PIDFILE
+$sudo chmod a+w $PIDFILE
 PATH=$here/src-oss:$PATH
 export PATH
 $PCP_PMCD_PROG -f -t 2 &

===========================================================================
mgmt/pcp/qa/244.out.1
===========================================================================

--- a/mgmt/pcp/qa/244.out.1     2007-07-24 11:15:59.000000000 +1000
+++ b/mgmt/pcp/qa/244.out.1     2007-07-23 18:13:30.377635303 +1000
@@ -103,6 +103,7 @@
 Cleanup "fake_linux" agent (dom 60): unconfigured

 ...
+Waiting for PMCD to terminate ...
 Restart and ping pmcd ...
 Performance Co-Pilot starting PMCD (logfile is $PCP_LOG_DIR/pmcd.log) ...
 Performance Co-Pilot starting archive loggers ...

===========================================================================
mgmt/pcp/qa/244.out.2
===========================================================================

--- a/mgmt/pcp/qa/244.out.2     2007-07-24 11:15:59.000000000 +1000
+++ b/mgmt/pcp/qa/244.out.2     2007-07-23 18:13:32.673335406 +1000
@@ -103,6 +103,7 @@
 Cleanup "fake_linux" agent (dom 60): unconfigured

 ...
+Waiting for PMCD to terminate ...
 Restart and ping pmcd ...
 Performance Co-Pilot starting PMCD (logfile is $PCP_LOG_DIR/pmcd.log) ...
 Performance Co-Pilot starting archive loggers ...

===========================================================================
mgmt/pcp/qa/254
===========================================================================

--- a/mgmt/pcp/qa/254   2007-07-24 11:15:59.000000000 +1000
+++ b/mgmt/pcp/qa/254   2007-07-24 11:08:18.703150175 +1000
@@ -18,6 +18,7 @@
 sudo=$here/sudo
 _needclean=true
 pmns="nameall.pmns"
+pidfile=$PCP_RUN_DIR/pmcd.pid

 rm -rf $tmp
 mkdir $tmp
@@ -30,7 +31,6 @@
     if $_needclean
     then
         _needclean=false
-        $sudo "killall -TERM pmcd"
         echo "Restart and ping pmcd ..."
         $sudo $PCP_RC_DIR/pcp start | _filter_pcp_start
        _wait_for_pmcd
@@ -67,6 +67,8 @@

 # Note: start pmcd with -f so that its PID stays the same (no daemon)
 #
+$sudo touch $pidfile
+$sudo chmod a+w $pidfile
 $PCP_PMCD_PROG -f -n $pmns &
 _wait_for_pmcd


===========================================================================
mgmt/pcp/qa/254.out
===========================================================================

--- a/mgmt/pcp/qa/254.out       2007-07-24 11:15:59.000000000 +1000
+++ b/mgmt/pcp/qa/254.out       2007-07-24 11:11:52.643348569 +1000
@@ -18,5 +18,6 @@
 29.0.11 alias yet.again and another_ten
 29.0.11 alias yet.again and ten
 Restart and ping pmcd ...
+Waiting for PMCD to terminate ...
 Performance Co-Pilot starting PMCD (logfile is $PCP_LOG_DIR/pmcd.log) ...
 Performance Co-Pilot starting archive loggers ...

Dr.Michael("Kimba")Newton  kimbrr@xxxxxxx

<Prev in Thread] Current Thread [Next in Thread>