Startup behavior for nwamd and services
---------------------------------------

This is a summary of the discussions at
http://www.opensolaris.org/jive/thread.jspa?messageID=305725.

"Location" refers to NWAM Locations, not to be confused with the SMF
service network/location.

The problem:
------------

When nwamd starts up after a hard reset, the No-Net Location is
installed.  Installation means copying configuration files to the
appropirate place so that other services (like ipfilter) can access
them.  This installation, however, is not possible because the
filesystem is read-only at this time.  filesystem/* services
(in)directly depend on network/physical.


The original proposal (using nwamadm):
--------------------------------------

network/physical:nwam will start nwamd.  It cannot do much at this
time because the filesystem is read-only.  network/location will have
a dependency on filesystem/usr, so it will start only after the
filesytem has been mounted read-write.  network/location will trigger
nwamd to install the Location identified by the current network
conditions (no need for the installation No-Net Location during boot).

How will network/location trigger nwamd to install a location?
nwamadm will do the trick.  Include a private sub-command to nwamadm
(lets call it "install_init").  nwamadm will make a libnwam library
call which would create an appropriate event for nwamd.  When nwamd
received this event, it would figure out which location needed to be
installed (through some magic of activation-modes and conditions) and
install it.  Another modification is needed for this - the
install_init sub-command would have to be synchronous, so that when it
returned, a Location has been installed.  Also, if nwamd determines
that a Location has already been installed, then this sub-command
should have no effect.  Finally, other services that depended on
network/location can now start as the configuration files they need
are in place.

During the course of the discussion, Alan proposed a different
solution, which has since been implemented.


The final/implemented solution (nwamd starts network/location):
---------------------------------------------------------------

network/location will not be "enabled" by default on boot.  Its
dependencies and dependents still stay the same.  nwamd periodically
checks for events.  When it does this, it checks to see that if no
Location has been installed, whether the filesystem has been mounted
read-write (by checking the state of the filesystem/usr service).

When the filesystem does get mounted read-write, nwamd will install
the Location depending on the activation-modes and conditions.  Then,
nwamd will "enable -t" the network/location service.  Finally, other
services that depend on network/location can start and find the
configuration files in place.

When NWAM is not enabled, network/physical:default will enable
network/location as part of its start method.


Sections 7.2 and 8.2
-------------------

Going through the text/steps in Section 7.2, here's what I see is
different with the currently implemented solution:

* /var/run is /etc/svc/volatile throughout the spec.

* During hard reset, the current Location is set to No-Net.  This step
  is not possible during boot because the filesystem is read-only at
  this point.  This can be determined by a check on the state of the
  filesystem/usr service, during boot it hasn't started yet because it
  depends on network/physical.  If nwamd is doing a hard reset after a
  clean shutdown (svcadm disable nwam; svcadm enable nwam), then
  filesystem/usr is online and the No-Net Location can be installed.

* After the NCP comes online, check if the filesystem/usr is online.
  If so, install the current location.

* Then, if network/location is running,
  "svcadm refresh network/location"; otherwise,
  "svcadm enable -t network/location".


Addition to the beginning of the nwamd event loop:

* If no Location has been installed (during boot), check if
  filesystem/usr is online.  If so, do a Location installation.


The most significant change I see is that rather than being started by
svc.startd, the network/location service is being started by nwamd (or
network/physical:default).  The other changes are simply checking if
filesystem/usr is online.

Contrasting this with the proposed solution - that would need to make
one event synchronous.


Reply via email to