"Narendra Kumar S.S" writes: > On 9/17/07, Tomas Heran <Tomas.Heran at sun.com> wrote: > > > > > > > > Narendra Kumar S.S wrote: > > > Hi, > > > > > > In my code I am calling smf_enable_instance() to enable and > > > smf_disable_instance() to disable the filesystem/local service. > > > > > > Now, if the previous state is either "Uninitialized" or > > > "Maintenance" or "Degraded", will the above calls to get the service > > > enabled/disabled will have any effect? > > > > > The smf_restore_instance() function brings an instance cur- > > rently in the maintenance to the uninitialized state, so > > that it can be brought back online. For a service in the > > degraded state, smf_restore_instance() brings the specified > > instance back to the online state. > > > That means, if the state is "Maintenance", then we must call > smf_restore_instance() followed by smf_enable_instance(). > And if the state is "Degraded", then if we call smf_restore_instance(), that > itself will bring the service to "Enabled". > Is my understanding correct?
It isn't entirely correct. There is no 'enabled' state. 'enabled' reflects the administrator's intent for the service. The state (online, offline, maintenance, etc.) reflects the actual current, well, state of the service as evaluated by the service's restarter. smf_restore_instance() will take the service out of maintenance, at which point its restarter will evaluate the value of 'enabled', and attempt to bring the service online if the service was enabled. Another failure could occur which puts the service right back into maintenance. However, if the service is already enabled, no extra _enable() call is required. (If the current manpage wording is unclear, please do file a bug so that we know we need to improve it.) smf_disable_instance() will transition the service out of its current state and put it into the disabled state. The degraded state is not currently implemented for filesystem/local's restarter, so nothing will put the service there to begin with. liane