introduced a shutdown grace period defaulting to 5 minutes
This commit is contained in:
parent
17801e9c20
commit
8f9e0ef6ae
|
@ -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>.
|
||||
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.
|
||||
|
||||
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.
|
||||
|
|
|
@ -14,7 +14,13 @@
|
|||
</method_environment>
|
||||
</method_context>
|
||||
</exec_method>
|
||||
<exec_method name='stop' type='method' exec='%{config/method_prefix}/svc-guesthandler %m' timeout_seconds='0'/>
|
||||
<exec_method name='stop' type='method' exec='%{config/method_prefix}/svc-guesthandler %m' timeout_seconds='0'>
|
||||
<method_context>
|
||||
<method_environment>
|
||||
<envvar name='GRACE_PERIOD' value='300'/>
|
||||
</method_environment>
|
||||
</method_context>
|
||||
</exec_method>
|
||||
<property_group name='startd' type='framework'>
|
||||
<propval name='duration' type='astring' value='transient'/>
|
||||
</property_group>
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
|
||||
if [ -z $SMF_FMRI ];
|
||||
then
|
||||
print "this script can only be invoked by smf(5)"
|
||||
exit $SMF_EXIT_ERR_NOSMF
|
||||
print "this script can only be invoked by smf(5)"
|
||||
exit $SMF_EXIT_ERR_NOSMF
|
||||
fi
|
||||
|
||||
ME=${0##*/svc-}
|
||||
|
@ -58,6 +58,18 @@ case $1 in
|
|||
log $UUID failed to $1
|
||||
fi
|
||||
done
|
||||
|
||||
# grant the guests some time to shut down
|
||||
WAIT_UNTIL=$(($(date +%s) + ${GRACE_PERIOD:-300}))
|
||||
while [ $(zoneadm list | wc -l) -gt 1 ];
|
||||
do
|
||||
if [ $(date +%s) -le $WAIT_UNTIL ];
|
||||
then
|
||||
sleep 1
|
||||
else
|
||||
exit $SMF_EXIT_ERR_FATAL
|
||||
fi
|
||||
done
|
||||
;;
|
||||
|
||||
disarm)
|
||||
|
|
Loading…
Reference in New Issue