init: API

Gilboa Davara gilboada at netvision.net.il
Sat Nov 19 02:58:01 UTC 2005


On Fri, 2005-11-18 at 18:46 +0200, Răzvan Corneliu C.R. "d3vi1" VILT
wrote:
> 
> [Text block]

First, please don't HTML post. It drives my Evolution crazy. (I cannot
insert my answers into your text...)

"A. Depends on how the schema is created. XML files can be easy to read
or dificult. Identing the xml code always helps."

True. /But/ by design, but I've yet to see an XML configuration, that
isn't 4 times the size of its clear text source. I'd suggest you compare
GNOME configuration files to their KDE counter-parts.

"B. Colored syntax always helps. That's all you usually need. At least
it's enough for me. I must say that Midnight Commander seems to work
with XML a little better."

Might be true; but I use VIM; and while being able to color XML file
does work, navigating inside a 6000 lines XML file is far from being
fun. More-ever, I use automated scripts to generate/modify/patch my
configuration files once I install FC. I doubt that it'll work under
XML.

"C. Depends on the schema."

Which means: as complex as the schema; and if you decide to create a
single catch-all schema for all services, you'll end-up with huge
complex XML files that makes it almost impossible to recover a dead
machine using a single text editor. (vim/pico/etc)

"D. It does not require complex code, it requires well designed tools.
In a XML based init world, you would need chkconfig and other tools. XML
authoring should be done only by the package maintainers. The rest
should be doable by external tools which share a common API."

/Far/ from it.
Beside having my own init.d services (For instance, I have my own
iptables generator service, vpn, etc) which automatically breaks that
"only package maintainers do init.d scripts", I also tend to edit
scripts by hand. 
You cannot assume that something as basic as service management be be
handles by package maintainers only.

"XML could help major projects such as the directory server bypass the
limitations of the current sysvinit. Check the problems with the
currently proposed init scripts in the fedora-ds wiki.
I've included in this email a demo of a service configuration file for
Sun SMF. Don't worry, it's not CDDL-ed. You are not contaminated if you
read this.
The interesting stuff this file brings:
1) Internationalize the service descriptions (the xml:lang attribute is
a dream for i18n in this case).2) Include information about the
documentation.
3) Include dependency information.
4) Include the start-up and shutdown commands.
There are a lot of other things that can be done using this XML file.
These are just a few of the ones that I consider important. I've added
gEdit style syntax color in the HTML version 

<service name='system/coreadm' type='service' version='1'>
   <create_default_instance enabled='false' />
    <single_instance />
    <dependency name='usr' grouping='require_all' restart_on='none'
type='service'>
        <service_fmri value='svc:/system/filesystem/minimal'/>
    </dependency>
    <exec_method type='method' name='start' exec='/usr/bin/coreadm -u'
timeout_seconds='3' />
    <exec_method type='method' name='stop' exec=':true'
timeout_seconds='0' />
    <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'>
            System-wide core file configuration service.
        </loctext></common_name>
        <documentation>
            <manpage title='coreadm' section='1M'
manpath='/usr/share/man' />
        </documentation>
    </template>
</service>"

Let me do the text version of this.

#This is my version of things.

# General.
SERVICENAME=NFS_main
SERVICEGROUP=NFS
SERVICETYPE=fs_service
SERVICEVERSION=1
SERVICEDESCRIPTION_EN="NFS Service"
SERVICEDESCRIPTION_IL="NFS שרות"

# Dependencies.
DEPENDENCIES="mount_root mount_user network NFS_mountd NFS_quotas
RPC_portmap"

# Binary, configuration.
CONFIGURATION=/etc/exports
BINARY=/usr/sbin/rpc.nfsd

SERVICE_START_TIMEOUT=10s
SERVICE_START_PARAMETERS=""

SERVICE_STOP_TIMEOUT=5s
SERVICE_START_PARAMETERS=""

SERVICE_QUERY_TIMEOUT=1s
SERVICE_QUERY_PARAMETERS=""

Just compare the complexity of your XML files against mine and you'll
see why I find XML to be a lousy solution.

Cheers,
Gilboa




More information about the fedora-devel-list mailing list