Print this page
7267 SMF is fast and loose with optional dependencies (fixes)
Reviewed by: Dan McDonald <danmcd@omniti.com>
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
Reviewed by: Albert Lee <trisk@omniti.com>


 146                  * whether new dependents are satisfiable.
 147                  */
 148                 graph_transition_propagate(v, PROPAGATE_SAT, rerr);
 149         } else {
 150                 log_framework(LOG_DEBUG, "Propagating maintenance of %s.\n",
 151                     v->gv_name);
 152 
 153                 graph_transition_propagate(v, PROPAGATE_SAT, rerr);
 154         }
 155 
 156         graph_transition_sulogin(RESTARTER_STATE_MAINT, old_state);
 157         return (0);
 158 }
 159 
 160 /* ARGSUSED */
 161 static int
 162 gt_enter_offline(scf_handle_t *h, graph_vertex_t *v,
 163     restarter_instance_state_t old_state, restarter_error_t rerr)
 164 {
 165         int to_offline = v->gv_flags & GV_TOOFFLINE;

 166 
 167         v->gv_flags &= ~GV_TOOFFLINE;
 168 
 169         /*
 170          * If the instance should be enabled, see if we can start it.
 171          * Otherwise send a disable command.
 172          * If a instance has the GV_TOOFFLINE flag set then it must
 173          * remains offline until the disable process completes.
 174          */
 175         if (v->gv_flags & GV_ENABLED) {
 176                 if (to_offline == 0)
 177                         graph_start_if_satisfied(v);
 178         } else {
 179                 if (gt_running(old_state) && v->gv_post_disable_f)
 180                         v->gv_post_disable_f();
 181 
 182                 vertex_send_event(v, RESTARTER_EVENT_TYPE_DISABLE);
 183         }
 184 
 185         /*
 186          * If the service was running, propagate a stop event.  If the
 187          * service was not running the offline transition may satisfy
 188          * optional dependencies and should be propagated to determine
 189          * whether new dependents are satisfiable.
 190          * Instances that transition to offline and have the GV_TOOFFLINE flag
 191          * are special because they can expose new subtree leaves so propagate
 192          * the offline to the instance dependencies.
 193          */
 194         if (gt_running(old_state)) {
 195                 /*
 196                  * Handle state change during instance disabling.




 146                  * whether new dependents are satisfiable.
 147                  */
 148                 graph_transition_propagate(v, PROPAGATE_SAT, rerr);
 149         } else {
 150                 log_framework(LOG_DEBUG, "Propagating maintenance of %s.\n",
 151                     v->gv_name);
 152 
 153                 graph_transition_propagate(v, PROPAGATE_SAT, rerr);
 154         }
 155 
 156         graph_transition_sulogin(RESTARTER_STATE_MAINT, old_state);
 157         return (0);
 158 }
 159 
 160 /* ARGSUSED */
 161 static int
 162 gt_enter_offline(scf_handle_t *h, graph_vertex_t *v,
 163     restarter_instance_state_t old_state, restarter_error_t rerr)
 164 {
 165         int to_offline = v->gv_flags & GV_TOOFFLINE;
 166         int to_disable = v->gv_flags & GV_TODISABLE;
 167 
 168         v->gv_flags &= ~GV_TOOFFLINE;
 169 
 170         /*
 171          * If the instance should be enabled, see if we can start it.
 172          * Otherwise send a disable command.
 173          * If a instance has the GV_TOOFFLINE flag set then it must
 174          * remains offline until the disable process completes.
 175          */
 176         if (v->gv_flags & GV_ENABLED) {
 177                 if (to_offline == 0 && to_disable == 0)
 178                         graph_start_if_satisfied(v);
 179         } else {
 180                 if (gt_running(old_state) && v->gv_post_disable_f)
 181                         v->gv_post_disable_f();
 182 
 183                 vertex_send_event(v, RESTARTER_EVENT_TYPE_DISABLE);
 184         }
 185 
 186         /*
 187          * If the service was running, propagate a stop event.  If the
 188          * service was not running the offline transition may satisfy
 189          * optional dependencies and should be propagated to determine
 190          * whether new dependents are satisfiable.
 191          * Instances that transition to offline and have the GV_TOOFFLINE flag
 192          * are special because they can expose new subtree leaves so propagate
 193          * the offline to the instance dependencies.
 194          */
 195         if (gt_running(old_state)) {
 196                 /*
 197                  * Handle state change during instance disabling.