Print this page
7711 SMF: Finish implementing support for degraded state


   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 
  22 /*
  23  * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
  24  * Copyright (c) 2015, Syneto S.R.L. All rights reserved.
  25  * Copyright 2016 Toomas Soome <tsoome@me.com>
  26  * Copyright 2016 RackTop Systems.
  27  */
  28 
  29 /*
  30  * graph.c - master restarter graph engine
  31  *
  32  *   The graph engine keeps a dependency graph of all service instances on the
  33  *   system, as recorded in the repository.  It decides when services should
  34  *   be brought up or down based on service states and dependencies and sends
  35  *   commands to restarters to effect any changes.  It also executes
  36  *   administrator commands sent by svcadm via the repository.
  37  *
  38  *   The graph is stored in uu_list_t *dgraph and its vertices are
  39  *   graph_vertex_t's, each of which has a name and an integer id unique to
  40  *   its name (see dict.c).  A vertex's type attribute designates the type
  41  *   of object it represents: GVT_INST for service instances, GVT_SVC for
  42  *   service objects (since service instances may depend on another service,
  43  *   rather than service instance), GVT_FILE for files (which services may
  44  *   depend on), and GVT_GROUP for dependencies on multiple objects.  GVT_GROUP
  45  *   vertices are necessary because dependency lists may have particular
  46  *   grouping types (require any, require all, optional, or exclude) and


 884 
 885         case RESTARTER_EVENT_TYPE_DISABLE:
 886         case RESTARTER_EVENT_TYPE_ADMIN_DISABLE:
 887                 log_framework(LOG_DEBUG, "Disabling %s.\n", v->gv_name);
 888                 assert(v->gv_state != RESTARTER_STATE_DISABLED);
 889                 break;
 890 
 891         case RESTARTER_EVENT_TYPE_STOP_RESET:
 892         case RESTARTER_EVENT_TYPE_STOP:
 893                 log_framework(LOG_DEBUG, "Stopping %s.\n", v->gv_name);
 894                 assert(v->gv_state == RESTARTER_STATE_DEGRADED ||
 895                     v->gv_state == RESTARTER_STATE_ONLINE);
 896                 break;
 897 
 898         case RESTARTER_EVENT_TYPE_START:
 899                 log_framework(LOG_DEBUG, "Starting %s.\n", v->gv_name);
 900                 assert(v->gv_state == RESTARTER_STATE_OFFLINE);
 901                 break;
 902 
 903         case RESTARTER_EVENT_TYPE_REMOVE_INSTANCE:

 904         case RESTARTER_EVENT_TYPE_ADMIN_DEGRADED:

 905         case RESTARTER_EVENT_TYPE_ADMIN_REFRESH:
 906         case RESTARTER_EVENT_TYPE_ADMIN_RESTART:
 907         case RESTARTER_EVENT_TYPE_ADMIN_MAINT_OFF:
 908         case RESTARTER_EVENT_TYPE_ADMIN_MAINT_ON:
 909         case RESTARTER_EVENT_TYPE_ADMIN_MAINT_ON_IMMEDIATE:
 910         case RESTARTER_EVENT_TYPE_DEPENDENCY_CYCLE:
 911         case RESTARTER_EVENT_TYPE_INVALID_DEPENDENCY:
 912                 break;
 913 
 914         default:
 915 #ifndef NDEBUG
 916                 uu_warn("%s:%d: Bad event %d.\n", __FILE__, __LINE__, e);
 917 #endif
 918                 abort();
 919         }
 920 
 921         restarter_protocol_send_event(v->gv_name, v->gv_restarter_channel, e,
 922             v->gv_reason);
 923 }
 924 




   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 
  22 /*
  23  * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
  24  * Copyright (c) 2015, Syneto S.R.L. All rights reserved.
  25  * Copyright 2016 Toomas Soome <tsoome@me.com>
  26  * Copyright 2017 RackTop Systems.
  27  */
  28 
  29 /*
  30  * graph.c - master restarter graph engine
  31  *
  32  *   The graph engine keeps a dependency graph of all service instances on the
  33  *   system, as recorded in the repository.  It decides when services should
  34  *   be brought up or down based on service states and dependencies and sends
  35  *   commands to restarters to effect any changes.  It also executes
  36  *   administrator commands sent by svcadm via the repository.
  37  *
  38  *   The graph is stored in uu_list_t *dgraph and its vertices are
  39  *   graph_vertex_t's, each of which has a name and an integer id unique to
  40  *   its name (see dict.c).  A vertex's type attribute designates the type
  41  *   of object it represents: GVT_INST for service instances, GVT_SVC for
  42  *   service objects (since service instances may depend on another service,
  43  *   rather than service instance), GVT_FILE for files (which services may
  44  *   depend on), and GVT_GROUP for dependencies on multiple objects.  GVT_GROUP
  45  *   vertices are necessary because dependency lists may have particular
  46  *   grouping types (require any, require all, optional, or exclude) and


 884 
 885         case RESTARTER_EVENT_TYPE_DISABLE:
 886         case RESTARTER_EVENT_TYPE_ADMIN_DISABLE:
 887                 log_framework(LOG_DEBUG, "Disabling %s.\n", v->gv_name);
 888                 assert(v->gv_state != RESTARTER_STATE_DISABLED);
 889                 break;
 890 
 891         case RESTARTER_EVENT_TYPE_STOP_RESET:
 892         case RESTARTER_EVENT_TYPE_STOP:
 893                 log_framework(LOG_DEBUG, "Stopping %s.\n", v->gv_name);
 894                 assert(v->gv_state == RESTARTER_STATE_DEGRADED ||
 895                     v->gv_state == RESTARTER_STATE_ONLINE);
 896                 break;
 897 
 898         case RESTARTER_EVENT_TYPE_START:
 899                 log_framework(LOG_DEBUG, "Starting %s.\n", v->gv_name);
 900                 assert(v->gv_state == RESTARTER_STATE_OFFLINE);
 901                 break;
 902 
 903         case RESTARTER_EVENT_TYPE_REMOVE_INSTANCE:
 904         case RESTARTER_EVENT_TYPE_ADMIN_RESTORE:
 905         case RESTARTER_EVENT_TYPE_ADMIN_DEGRADED:
 906         case RESTARTER_EVENT_TYPE_ADMIN_DEGRADE_IMMEDIATE:
 907         case RESTARTER_EVENT_TYPE_ADMIN_REFRESH:
 908         case RESTARTER_EVENT_TYPE_ADMIN_RESTART:
 909         case RESTARTER_EVENT_TYPE_ADMIN_MAINT_OFF:
 910         case RESTARTER_EVENT_TYPE_ADMIN_MAINT_ON:
 911         case RESTARTER_EVENT_TYPE_ADMIN_MAINT_ON_IMMEDIATE:
 912         case RESTARTER_EVENT_TYPE_DEPENDENCY_CYCLE:
 913         case RESTARTER_EVENT_TYPE_INVALID_DEPENDENCY:
 914                 break;
 915 
 916         default:
 917 #ifndef NDEBUG
 918                 uu_warn("%s:%d: Bad event %d.\n", __FILE__, __LINE__, e);
 919 #endif
 920                 abort();
 921         }
 922 
 923         restarter_protocol_send_event(v->gv_name, v->gv_restarter_channel, e,
 924             v->gv_reason);
 925 }
 926