[OpenIndiana-discuss] Bug or feature in SMF? "svcadm restart" vs "disable+enable"

Gary Mills gary_mills at fastmail.fm
Wed Nov 20 04:15:24 UTC 2013


On Mon, Nov 18, 2013 at 09:12:17PM +0100, Jim Klimov wrote:
> On 2013-11-18 20:02, Gary Mills wrote:
> >On Mon, Nov 18, 2013 at 03:27:42PM +0100, Jim Klimov wrote:
> >>
> >>   While testing my works on SMF inter-dependencies (such as with my
> >>recent write-up on SMFization of local zones), I discovered that if
> >>I run svcadm restart, then the dependency service (a zone) stops
> >>first, and only when its state changes to "offline", the dependent
> >>services (zones) begin to shut down. In the meanwhile, the dependency
> >>service begins to start-up, allowing the dependents to restart later.
> >
> >Are you restarting the entire zone, or a service running within the
> >zone?  According to svcadm(1M), a restart is equivalent to a full
> >service "stop" followed by a "start".  Is `restart' mentioned in your
> >manifest?  What do the logs say?
> 
> I am restarting the zone, which in the eyes of global zone's SMF
> is now (after SMFization of the zones) jsut a slowly starting and
> slowly stopping instance which displays the timing of interactions
> with dependencies quite noticeably.

I'm still trying to get a picture of what you are doing.  My
understanding is that a local zone can only be started or stopped from
the global zone, with the `zoneadm' command, and that the
svc:/system/zones:default service takes care of starting and stopping
local zones when the global zone starts up or shuts down.

As well, all of the services in a local zone have a dependancy tree
that causes them to start or stop in an orderly fashion when the zone
itself is started or stopped.  This is analogous to booting and
halting a physical machine, except that the number of services running
in a local zone is much smaller.

> Yes, of course. Being a service under its local zone's SMF control,
> the database starts and stops correctly. And so does the appserver
> in its zone. The problem is that when the appserver-zone depends on
> the database-zone, and I do "svcadm restart database-zone" - this
> zone does stop, and only afterwards does the appserver-zone begin
> to stop (and the database-zone begins to start in the meanwhile).
> This is different from "svcadm disable (-t) database-zone" which
> stops the appserver-zone first and then begins the shutdown of
> database-zone, and then restarts them both from cold state.

Oh, so you have a service running in one zone that's dependant on
a service running in another zone.  That's a hard problem, almost
as hard as for services running on separate machines.  I suppose
you'd have to make one zone dependant on the other zone.  That
could only be done in the global zone.

The method script, /lib/svc/method/svc-zones, for the
svc:/system/zones:default service seems to start and stop all the
local zones in the background, waiting for them all to finish.
It also contains this interesting comment:

			# zoneadmd puts itself into its own contract so
			# this service will lose sight of it.  We don't
			# support restart so it is OK for zoneadmd to
			# to be in an orphaned contract.

You'd have to disable this service and replace it with another one
if you wanted the zones to start and stop based on inter-zone
dependancies.  You might also want to remove the autoboot property
from some zones so that this service wouldn't start them.

-- 
-Gary Mills-		-refurb-		-Winnipeg, Manitoba, Canada-



More information about the OpenIndiana-discuss mailing list