Browse Source

introduced the environment variable WAIT_INTERVAL for the grace period in the stop method

master
Tamás Gérczei 4 years ago
parent
commit
0b8bbd8ed9
3 changed files with 3 additions and 2 deletions
  1. +1
    -1
      README.md
  2. +1
    -0
      guesthandler.xml
  3. +1
    -1
      svc-guesthandler

+ 1
- 1
README.md View File

@@ -10,6 +10,6 @@ This will tag all VMs with the priority of 0 which will leave them <strong>stopp

...and so on. Informational messages are logged via the syslog facility as '<i>daemon.notice</i>' entries tracking the determined order as well as the outcome for every step taken. The solution comprises two services backed by the same single method script: one activated before <i>svc:/system/zones</i> in order to convince it not to start any guests and the actual payload starting once vmadmd is available to evaluate the tags and complete the sequence.

SMF will import the manifests for the services upon boot-up when it initializes its repository. The location of the method script is configurable via the service property <i>config/method_prefix</i>, defaulting to <strong><i>/opt/custom/bin</i></strong>. The start-up delay defaults to <strong><i>30</i></strong> seconds, also configurable via the context environment variable <i>DELAY</i> for the method <i>start</i>. A grace period of <strong>5</strong> minutes is granted for shut-down, configurable via the context environment variable <i>GRACE_PERIOD</i> in the <i>stop</i> method.
SMF will import the manifests for the services upon boot-up when it initializes its repository. The location of the method script is configurable via the service property <i>config/method_prefix</i>, defaulting to <strong><i>/opt/custom/bin</i></strong>. The start-up delay defaults to <strong><i>30</i></strong> seconds, also configurable via the context environment variable <i>DELAY</i> for the method <i>start</i>. A grace period of <strong>5</strong> minutes is granted for shut-down, configurable via the context environment variables <i>GRACE_PERIOD</i> and <i>WAIT_INTERVAL</i> in the <i>stop</i> method.

In the future the method script might get re-written in node.js in order to make a more human-friendly dependency notation/handling possible. This is merely the shortest path.

+ 1
- 0
guesthandler.xml View File

@@ -18,6 +18,7 @@
<method_context>
<method_environment>
<envvar name='GRACE_PERIOD' value='300'/>
<envvar name='WAIT_INTERVAL' value='10'/>
</method_environment>
</method_context>
</exec_method>


+ 1
- 1
svc-guesthandler View File

@@ -65,7 +65,7 @@ case $1 in
do
if [ $(date +%s) -le $WAIT_UNTIL ];
then
sleep 1
sleep ${WAIT_INTERVAL:-10}
else
exit $SMF_EXIT_ERR_FATAL
fi


Loading…
Cancel
Save