renamed method script, externalized DELAY to a service property and won't override svc:/system/zones any longer since it is now declared in guesthandler-disarm as a dependent

This commit is contained in:
Tamás Gérczei 2016-04-19 09:27:23 +02:00
parent fd121dace5
commit 711946cb72
4 changed files with 27 additions and 45 deletions

View File

@ -7,7 +7,10 @@
<dependency name='fs' grouping='require_all' restart_on='none' type='service'>
<service_fmri value='svc:/system/filesystem/local'/>
</dependency>
<exec_method name='start' type='method' exec='/opt/custom/bin/guesthandler.sh disarm' timeout_seconds='0'/>
<dependent name='zones' grouping='require_all' restart_on='none'>
<service_fmri value='svc:/system/zones'/>
</dependent>
<exec_method name='start' type='method' exec='/opt/custom/bin/svc-guesthandler disarm' timeout_seconds='0'/>
<exec_method name='stop' type='method' exec=':true' timeout_seconds='100'/>
<property_group name='startd' type='framework'>
<propval name='duration' type='astring' value='transient'/>

View File

@ -7,11 +7,20 @@
<dependency name='vmadmd' grouping='require_all' restart_on='none' type='service'>
<service_fmri value='svc:/system/smartdc/vmadmd:default'/>
</dependency>
<exec_method name='start' type='method' exec='/opt/custom/bin/guesthandler.sh %m' timeout_seconds='0'/>
<exec_method name='stop' type='method' exec='/opt/custom/bin/guesthandler.sh %m' timeout_seconds='0'/>
<exec_method name='start' type='method' exec='/opt/custom/bin/svc-guesthandler %m' timeout_seconds='0'>
<method_context>
<method_environment>
<envvar name='DELAY' value='%{config/delay}'/>
</method_environment>
</method_context>
</exec_method>
<exec_method name='stop' type='method' exec='/opt/custom/bin/svc-guesthandler %m' timeout_seconds='0'/>
<property_group name='startd' type='framework'>
<propval name='duration' type='astring' value='transient'/>
</property_group>
<property_group name='config' type='eu.gerczei,guesthandler_configuration'>
<propval name='delay' type='integer' value='30'/>
</property_group>
<stability value='Unstable'/>
<template>
<common_name>

View File

@ -4,15 +4,13 @@
. /lib/svc/share/smf_include.sh
if [ -z "$SMF_FMRI" ]; then
echo "this script can only be invoked by smf(5)"
exit $SMF_EXIT_ERR_NOSMF
if [ -z $SMF_FMRI ];
then
print "this script can only be invoked by smf(5)"
exit $SMF_EXIT_ERR_NOSMF
fi
ME=$(basename ${0%.sh})
# start-up delay between VMs
DELAY=30
ME=$(basename ${0#svc-})
function log {
# helper function to log arbitrary messages via syslog
@ -34,7 +32,7 @@ case $1 in
then
# successful start, log and wait
log $UUID managed to $1
sleep $DELAY
sleep ${DELAY:-0}
else
# failed to start guest
log $UUID failed to $1
@ -75,7 +73,11 @@ case $1 in
;;
*)
exit $SMF_EXIT_ERR;
if smf_present;
then
exit $SMF_EXIT_ERR_CONFIG;
else
print
esac
exit $SMF_EXIT_OK
exit $SMF_EXIT_NODAEMON

View File

@ -1,32 +0,0 @@
<?xml version='1.0'?>
<!DOCTYPE service_bundle SYSTEM '/usr/share/lib/xml/dtd/service_bundle.dtd.1'>
<service_bundle type='manifest' name='export'>
<service name='system/zones' type='service' version='0'>
<create_default_instance enabled='true'/>
<single_instance/>
<dependency name='multi-user-server' grouping='require_all' restart_on='none' type='service'>
<service_fmri value='svc:/milestone/multi-user-server'/>
</dependency>
<dependency name='metadata' grouping='require_all' restart_on='none' type='service'>
<service_fmri value='svc:/system/smartdc/metadata'/>
</dependency>
<dependency name='guesthandler-disarm' grouping='require_all' restart_on='none' type='service'>
<service_fmri value='svc:/system/guesthandler-disarm'/>
</dependency>
<exec_method name='start' type='method' exec='/lib/svc/method/svc-zones %m' timeout_seconds='0'/>
<exec_method name='stop' type='method' exec='/lib/svc/method/svc-zones %m' timeout_seconds='100'/>
<property_group name='startd' type='framework'>
<propval name='duration' type='astring' value='transient'/>
</property_group>
<stability value='Unstable'/>
<template>
<common_name>
<loctext xml:lang='C'>Zones autoboot and graceful shutdown</loctext>
</common_name>
<documentation>
<manpage title='zones' section='5' manpath='/usr/share/man'/>
<manpage title='zonecfg' section='1M' manpath='/usr/share/man'/>
</documentation>
</template>
</service>
</service_bundle>