pcp
[Top] [All Lists]

Re: pcp updates: qa, containers

To: Nathan Scott <nathans@xxxxxxxxxx>
Subject: Re: pcp updates: qa, containers
From: fche@xxxxxxxxxx (Frank Ch. Eigler)
Date: Tue, 17 Mar 2015 14:15:10 -0400
Cc: pcp <pcp@xxxxxxxxxxx>
Delivered-to: pcp@xxxxxxxxxxx
In-reply-to: <1452631543.7808485.1426575023285.JavaMail.zimbra@xxxxxxxxxx> (Nathan Scott's message of "Tue, 17 Mar 2015 02:50:23 -0400 (EDT)")
References: <839234551.7808463.1426575003930.JavaMail.zimbra@xxxxxxxxxx> <1452631543.7808485.1426575023285.JavaMail.zimbra@xxxxxxxxxx>
User-agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.4 (gnu/linux)
Nathan Scott <nathans@xxxxxxxxxx> writes:

> Nathan Scott (6):
>       docker: switch to using Marks env var suggestion
> [...]

By the way, have y'all considered using the daemons in foreground mode
("pmcd -f" et al.) as the contained pid-1 process, instead of
inventions such as pmsleep?  Something like the patches below
[1] or even [2] (untested!).

Beyond removing an unnecessary part, another benefit would be that the
container pid-1 would actually exit when the daemon does, so that the
orchestrator could possibly restart the thing.

- FChE


[1]

diff --git a/src/pmcd/rc_pmcd b/src/pmcd/rc_pmcd
index 635919ac8484..83edfef108d8 100644
--- a/src/pmcd/rc_pmcd
+++ b/src/pmcd/rc_pmcd
@@ -484,7 +484,11 @@ Error: pmcd control file '"$PCP_PMCDCONF_PATH"' is 
missing, cannot start pmcd.'
                            -e 's/ $//' \
                    | tr '\012' ' ' `
 
-           $PMCD $OPTS
+            if [ -z "$PCP_CONTAINER_IMAGE" ]; then
+               $PMCD $OPTS
+            else
+                $PMCD -f $OPTS &
+            fi
             _start_pmcheck
            $RC_STATUS -v
 
@@ -502,7 +506,7 @@ Error: pmcd control file '"$PCP_PMCDCONF_PATH"' is missing, 
cannot start pmcd.'
            [ -x $PCPLOCAL ] && $PCPLOCAL $VFLAG start
 
            # finally, stop here if running in a container
-           [ -z "$PCP_CONTAINER_IMAGE" ] || exec $PCP_BINADM_DIR/pmpause
+           [ -z "$PCP_CONTAINER_IMAGE" ] || wait
        fi
        status=0
         ;;



[2]

diff --git a/src/pmcd/rc_pmcd b/src/pmcd/rc_pmcd
index 635919ac8484..d56a89d6928c 100644
--- a/src/pmcd/rc_pmcd
+++ b/src/pmcd/rc_pmcd
@@ -484,7 +484,7 @@ Error: pmcd control file '"$PCP_PMCDCONF_PATH"' is missing, 
cannot start pmcd.'
                            -e 's/ $//' \
                    | tr '\012' ' ' `
 
-           $PMCD $OPTS
+            ( # start this in background, in anticipation of pmcd start
             _start_pmcheck
            $RC_STATUS -v
 
@@ -500,9 +500,14 @@ Error: pmcd control file '"$PCP_PMCDCONF_PATH"' is 
missing, cannot start pmcd.'
 
            # site-local customisations after PMCD startup
            [ -x $PCPLOCAL ] && $PCPLOCAL $VFLAG start
-
-           # finally, stop here if running in a container
-           [ -z "$PCP_CONTAINER_IMAGE" ] || exec $PCP_BINADM_DIR/pmpause
+            ) &
+
+           if [ -n "$PCP_CONTAINER_IMAGE" ]; then
+               exec $PMCD -f $OPTS   # stay in foreground
+            else
+                $PMCD $OPTS
+                wait # for subshell
+            fi
        fi
        status=0
         ;;

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