|
|
@@ -1,10 +1,12 @@
|
|
|
/*
|
|
|
* Copyright (c) 2002-2005 MontaVista Software, Inc.
|
|
|
- *
|
|
|
- * All rights reserved.
|
|
|
- *
|
|
|
* Author: Steven Dake (sdake@mvista.com)
|
|
|
*
|
|
|
+ * Copyright (c) 2006 Ericsson AB.
|
|
|
+ * Author: Hans Feldt
|
|
|
+ * Description: Reworked to match AMF B.02 information model
|
|
|
+ *
|
|
|
+ * All rights reserved.
|
|
|
* This software licensed under BSD license, the text of which follows:
|
|
|
*
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
@@ -31,7 +33,8 @@
|
|
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
|
|
* THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
*/
|
|
|
-#include <netinet/in.h>
|
|
|
+
|
|
|
+#include <limits.h>
|
|
|
#include "../include/saAis.h"
|
|
|
#include "../include/saAmf.h"
|
|
|
#include "../include/list.h"
|
|
|
@@ -40,13 +43,6 @@
|
|
|
#ifndef AMFCONFIG_H_DEFINED
|
|
|
#define AMFCONFIG_H_DEFINED
|
|
|
|
|
|
-struct amf_healthcheck {
|
|
|
- SaAmfHealthcheckKeyT key;
|
|
|
- SaTimeT period;
|
|
|
- SaTimeT maximum_duration;
|
|
|
- struct amf_comp *comp;
|
|
|
- struct list_head list;
|
|
|
-};
|
|
|
|
|
|
enum escalation_levels {
|
|
|
ESCALATION_LEVEL_NO_ESCALATION = 1, /* execute component restart */
|
|
|
@@ -55,145 +51,328 @@ enum escalation_levels {
|
|
|
ESCALATION_LEVEL_THREE = 4 /* escalate to node failover */
|
|
|
};
|
|
|
|
|
|
-struct amf_unit {
|
|
|
+enum clc_component_types {
|
|
|
+ clc_component_sa_aware = 0, /* sa aware */
|
|
|
+ clc_component_proxied_pre = 1, /* proxied, pre-instantiable */
|
|
|
+ clc_component_proxied_non_pre = 2, /* proxied, non pre-instantiable */
|
|
|
+ clc_component_non_proxied_non_sa_aware = 3 /* non-proxied, non sa aware */
|
|
|
+};
|
|
|
+
|
|
|
+struct amf_si_assignment;
|
|
|
+struct amf_csi_assignment;
|
|
|
+struct amf_healthcheck;
|
|
|
+
|
|
|
+struct amf_cluster {
|
|
|
+ /* Configuration Attributes */
|
|
|
SaNameT name;
|
|
|
- struct list_head comp_head;
|
|
|
- struct list_head unit_list;
|
|
|
- struct amf_group *amf_group;
|
|
|
- struct list_head si_head;
|
|
|
- int si_count;
|
|
|
- SaAmfPresenceStateT presence_state;
|
|
|
- SaAmfOperationalStateT operational_state;
|
|
|
- SaAmfReadinessStateT readiness_state;
|
|
|
- SaAmfHAStateT assigned_ha_state;
|
|
|
- SaAmfHAStateT requested_ha_state;
|
|
|
-
|
|
|
- char clccli_path[1024];
|
|
|
- char binary_path[1024];
|
|
|
-
|
|
|
- poll_timer_handle restart_timer;
|
|
|
- int restart_count;
|
|
|
- enum escalation_levels escalation_level;
|
|
|
+ int saAmfClusterStartupTimeout;
|
|
|
+ SaNameT saAmfClusterClmCluster;
|
|
|
+
|
|
|
+ /* Runtime Attributes */
|
|
|
+ SaAmfAdminStateT saAmfClusterAdminState;
|
|
|
+
|
|
|
+ /* Relations */
|
|
|
+ struct amf_node *node_head;
|
|
|
+ struct amf_application *application_head;
|
|
|
+
|
|
|
+ /* Implementation */
|
|
|
+ poll_timer_handle timeout_handle;
|
|
|
};
|
|
|
|
|
|
-struct amf_csi_name_value {
|
|
|
- struct list_head csi_name_list;
|
|
|
- char name[128];
|
|
|
- char value[128];
|
|
|
+struct amf_node {
|
|
|
+ /* Configuration Attributes */
|
|
|
+ SaNameT name;
|
|
|
+ SaNameT saAmfNodeClmNode;
|
|
|
+ int saAmfNodeSuFailOverProb;
|
|
|
+ SaUint32T saAmfNodeSuFailoverMax;
|
|
|
+ SaBoolT saAmfNodeAutoRepair;
|
|
|
+ SaBoolT saAmfNodeRebootOnInstantiationFailure;
|
|
|
+ SaBoolT saAmfNodeRebootOnTerminationFailure;
|
|
|
+
|
|
|
+ /* Runtime Attributes */
|
|
|
+ SaAmfAdminStateT saAmfNodeAdminState;
|
|
|
+ SaAmfOperationalStateT saAmfNodeOperState;
|
|
|
+
|
|
|
+ /* Relations */
|
|
|
+ struct amf_cluster *cluster;
|
|
|
+
|
|
|
+ /* Implementation */
|
|
|
+ struct amf_node *next;
|
|
|
};
|
|
|
|
|
|
-struct amf_si;
|
|
|
-struct amf_csi {
|
|
|
+struct amf_application {
|
|
|
+ /* Configuration Attributes */
|
|
|
SaNameT name;
|
|
|
- SaNameT type_name;
|
|
|
- struct amf_unit *unit;
|
|
|
- struct list_head csi_list;
|
|
|
- struct list_head unit_head;
|
|
|
- struct list_head name_value_head;
|
|
|
- struct amf_si *si;
|
|
|
- int pg_set;
|
|
|
+
|
|
|
+ /* Runtime Attributes */
|
|
|
+ SaAmfAdminStateT saAmfApplicationAdminState;
|
|
|
+ SaUint32T saAmfApplicationCurrNumSG;
|
|
|
+
|
|
|
+ /* Relations */
|
|
|
+ struct amf_cluster *cluster;
|
|
|
+ struct amf_sg *sg_head;
|
|
|
+ struct amf_si *si_head;
|
|
|
+
|
|
|
+ /* Implementation */
|
|
|
+ char clccli_path[PATH_MAX];
|
|
|
+ char binary_path[PATH_MAX];
|
|
|
+ struct amf_application *next;
|
|
|
};
|
|
|
|
|
|
-struct amf_si {
|
|
|
+struct amf_sg {
|
|
|
+ /* Configuration Attributes */
|
|
|
SaNameT name;
|
|
|
- int csi_count;
|
|
|
- struct list_head si_list;
|
|
|
- struct amf_group *group;
|
|
|
- struct list_head csi_head;
|
|
|
- struct list_head pg_head;
|
|
|
- struct list_head unit_list;
|
|
|
- SaAmfAdminStateT administrative_state;
|
|
|
- SaAmfOperationalStateT operational_state;
|
|
|
+ saAmfRedundancyModelT saAmfSGRedundancyModel;
|
|
|
+ SaBoolT saAmfSGAutoAdjust;
|
|
|
+ SaUint32T saAmfSGNumPrefActiveSUs;
|
|
|
+ SaUint32T saAmfSGNumPrefStandbySUs;
|
|
|
+ SaUint32T saAmfSGNumPrefInserviceSUs;
|
|
|
+ SaUint32T saAmfSGNumPrefAssignedSUs;
|
|
|
+ SaUint32T saAmfSGMaxActiveSIsperSUs;
|
|
|
+ SaUint32T saAmfSGMaxStandbySIsperSUs;
|
|
|
+ SaTimeT saAmfSGCompRestartProb;
|
|
|
+ SaUint32T saAmfSGCompRestartMax;
|
|
|
+ SaTimeT saAmfSGSuRestartProb;
|
|
|
+ SaUint32T saAmfSGSuRestartMax;
|
|
|
+ SaTimeT saAmfSGAutoAdjustProb;
|
|
|
+ SaBoolT saAmfSGAutoRepair;
|
|
|
+
|
|
|
+ /* Runtime Attributes */
|
|
|
+ SaAmfAdminStateT saAmfSGAdminState;
|
|
|
+ SaUint32T saAmfSGNumCurrAssignedSUs;
|
|
|
+ SaUint32T saAmfSGNumCurrNonInstantiatedSpareSUs;
|
|
|
+ SaUint32T saAmfSGNumCurrInstantiatedSpareSUs;
|
|
|
+
|
|
|
+ /* Relations */
|
|
|
+ struct amf_application *application;
|
|
|
+ struct amf_su *su_head;
|
|
|
+
|
|
|
+ /* Implementation */
|
|
|
+ char clccli_path[PATH_MAX];
|
|
|
+ char binary_path[PATH_MAX];
|
|
|
+ struct amf_sg *next;
|
|
|
};
|
|
|
|
|
|
-struct amf_pg {
|
|
|
+struct amf_su {
|
|
|
+ /* Configuration Attributes */
|
|
|
SaNameT name;
|
|
|
- struct amf_comp *comp;
|
|
|
- struct list_head pg_list;
|
|
|
- struct list_head pg_comp_head;
|
|
|
+ SaUint32T saAmfSURank;
|
|
|
+ SaUint32T saAmfSUNumComponents;
|
|
|
+ SaBoolT saAmfSUIsExternal;
|
|
|
+ SaBoolT saAmfSUFailover;
|
|
|
+
|
|
|
+ /* Runtime Attributes */
|
|
|
+ SaBoolT saAmfSUPreInstantiable;
|
|
|
+ SaAmfOperationalStateT saAmfSUOperState;
|
|
|
+ SaAmfAdminStateT saAmfSUAdminState;
|
|
|
+ SaAmfReadinessStateT saAmfSUReadinessState;
|
|
|
+ SaAmfPresenceStateT saAmfSUPresenceState;
|
|
|
+ SaNameT saAmfSUAssignedSIs;
|
|
|
+ SaNameT saAmfSUHostedByNode;
|
|
|
+ SaUint32T saAmfSUNumCurrActiveSIs;
|
|
|
+ SaUint32T saAmfSUNumCurrStandbySIs;
|
|
|
+ SaUint32T saAmfSURestartCount;
|
|
|
+
|
|
|
+ /* Relations */
|
|
|
+ struct amf_sg *sg;
|
|
|
+ struct amf_comp *comp_head;
|
|
|
+ struct amf_si_assignment *assigned_sis;
|
|
|
+
|
|
|
+ /* Implementation */
|
|
|
+ char clccli_path[PATH_MAX];
|
|
|
+ char binary_path[PATH_MAX];
|
|
|
+ SaUint32T su_failover_cnt; /* missing in SAF specs? */
|
|
|
+ enum escalation_levels escalation_level;
|
|
|
+ SaAmfHAStateT requested_ha_state;
|
|
|
+ struct amf_su *next;
|
|
|
};
|
|
|
|
|
|
-struct amf_pg_comp {
|
|
|
+struct amf_comp {
|
|
|
+ /* Configuration Attributes */
|
|
|
+ SaNameT name;
|
|
|
+ SaNameT **saAmfCompCsTypes;
|
|
|
+ saAmfCompCategoryT saAmfCompCategory;
|
|
|
+ saAmfCompCapabilityModelT saAmfCompCapability;
|
|
|
+ SaUint32T saAmfCompNumMaxActiveCsi;
|
|
|
+ SaUint32T saAmfCompNumMaxStandbyCsi;
|
|
|
+ SaStringT *saAmfCompCmdEnv;
|
|
|
+ int saAmfCompDefaultClcCliTimeout;
|
|
|
+ int saAmfCompDefaultCallbackTimeOut;
|
|
|
+ SaStringT saAmfCompInstantiateCmd;
|
|
|
+ SaStringT saAmfCompInstantiateCmdArgv;
|
|
|
+ int saAmfCompInstantiateTimeout;
|
|
|
+ SaUint32T saAmfCompInstantiationLevel;
|
|
|
+ SaUint32T saAmfCompNumMaxInstantiateWithoutDelay;
|
|
|
+ SaUint32T saAmfCompNumMaxInstantiateWithDelay;
|
|
|
+ int saAmfCompDelayBetweenInstantiateAttempts;
|
|
|
+ SaStringT saAmfCompTerminateCmd;
|
|
|
+ int saAmfCompTerminateTimeout;
|
|
|
+ SaStringT saAmfCompTerminateCmdArgv;
|
|
|
+ SaStringT saAmfCompCleanupCmd;
|
|
|
+ int saAmfCompCleanupTimeout;
|
|
|
+ SaStringT saAmfCompCleanupCmdArgv;
|
|
|
+ SaStringT saAmfCompAmStartCmd;
|
|
|
+ int saAmfCompAmStartTimeout;
|
|
|
+ SaStringT saAmfCompAmStartCmdArgv;
|
|
|
+ SaUint32T saAmfCompNumMaxAmStartAttempt;
|
|
|
+ SaStringT saAmfCompAmStopCmd;
|
|
|
+ int saAmfCompAmStopTimeout;
|
|
|
+ SaStringT saAmfCompAmStopCmdArgv;
|
|
|
+ SaUint32T saAmfCompNumMaxAmStopAttempt;
|
|
|
+ int saAmfCompTerminateCallbackTimeout;
|
|
|
+ int saAmfCompCSISetCallbackTimeout;
|
|
|
+ int saAmfCompQuiescingCompleteTimeout;
|
|
|
+ int saAmfCompCSIRmvCallbackTimeout;
|
|
|
+ SaAmfRecommendedRecoveryT saAmfCompRecoveryOnError;
|
|
|
+ SaBoolT saAmfCompDisableRestart;
|
|
|
+ SaNameT saAmfCompProxyCsi;
|
|
|
+
|
|
|
+ /* Runtime Attributes */
|
|
|
+ SaAmfOperationalStateT saAmfCompOperState;
|
|
|
+ SaAmfReadinessStateT saAmfCompReadinessState;
|
|
|
+ SaAmfPresenceStateT saAmfCompPresenceState;
|
|
|
+ SaUint32T saAmfCompRestartCount;
|
|
|
+ SaUint32T saAmfCompNumCurrActiveCsi;
|
|
|
+ SaUint32T saAmfCompNumCurrStandbyCsi;
|
|
|
+ SaNameT saAmfCompAssignedCsi;
|
|
|
+ SaNameT saAmfCompCurrProxyName;
|
|
|
+ SaNameT saAmfCompCurrProxiedNames;
|
|
|
+
|
|
|
+ /* Relations */
|
|
|
+ struct amf_comp *proxy_comp;
|
|
|
+ struct amf_su *su;
|
|
|
+ struct amf_csi_assignment *assigned_csis;
|
|
|
+
|
|
|
+ /* Implementation */
|
|
|
+ char clccli_path[PATH_MAX];
|
|
|
+ char binary_path[PATH_MAX];
|
|
|
+ struct amf_comp *next;
|
|
|
+ void *conn;
|
|
|
+ enum clc_component_types comptype;
|
|
|
+ struct amf_healthcheck *healthcheck_head;
|
|
|
+};
|
|
|
+
|
|
|
+struct amf_healthcheck {
|
|
|
+ /* Configuration Attributes */
|
|
|
+ SaAmfHealthcheckKeyT safHealthcheckKey;
|
|
|
+ int saAmfHealthcheckMaxDuration;
|
|
|
+ int saAmfHealthcheckPeriod;
|
|
|
+
|
|
|
+ /* Relations */
|
|
|
struct amf_comp *comp;
|
|
|
- struct amf_csi *csi;
|
|
|
- struct list_head list;
|
|
|
+
|
|
|
+ /* Implementation */
|
|
|
+ struct amf_healthcheck *next;
|
|
|
+ SaAmfHealthcheckInvocationT invocationType;
|
|
|
+ poll_timer_handle timer_handle_duration;
|
|
|
+ poll_timer_handle timer_handle_period;
|
|
|
+ int active;
|
|
|
};
|
|
|
|
|
|
-struct amf_group {
|
|
|
+struct amf_si {
|
|
|
+ /* Configuration Attributes */
|
|
|
SaNameT name;
|
|
|
- saAmfRedundancyModelT model;
|
|
|
- SaUint32T preferred_active_units;
|
|
|
- SaUint32T preferred_standby_units;
|
|
|
- SaUint32T maximum_active_instances;
|
|
|
- SaUint32T maximum_standby_instances;
|
|
|
- SaAmfAdminStateT administrative_state;
|
|
|
- struct list_head group_list;
|
|
|
- struct list_head unit_head;
|
|
|
- struct list_head si_head;
|
|
|
+ SaNameT saAmfSIProtectedbySG;
|
|
|
+ SaUint32T saAmfSIRank;
|
|
|
+ SaUint32T saAmfSINumCSIs;
|
|
|
+ SaUint32T saAmfSIPrefActiveAssignments;
|
|
|
+ SaUint32T saAmfSIPrefStandbyAssignments;
|
|
|
|
|
|
- char clccli_path[1024];
|
|
|
- char binary_path[1024];
|
|
|
+ /* Runtime Attributes */
|
|
|
+ SaAmfAdminStateT saAmfSIAdminState;
|
|
|
+ SaAmfAssignmentStateT saAmfSIAssignmentState;
|
|
|
+ SaUint32T saAmfSINumCurrActiveAssignments;
|
|
|
+ SaUint32T saAmfSINumICurrStandbyAssignments;
|
|
|
|
|
|
- unsigned int component_restart_probation;
|
|
|
- unsigned int component_restart_max;
|
|
|
+ /* Relations */
|
|
|
+ struct amf_application *application;
|
|
|
+ struct amf_sg *protects_sg;
|
|
|
+ struct amf_csi *csi_head;
|
|
|
+ struct amf_si_assignment *si_assignments;
|
|
|
+ struct amf_si_dependency *depends_on;
|
|
|
+ struct amf_si_ranked_su *ranked_sus;
|
|
|
|
|
|
- unsigned int unit_restart_probation;
|
|
|
- unsigned int unit_restart_max;
|
|
|
+ /* Implementation */
|
|
|
+ struct amf_si *next;
|
|
|
};
|
|
|
|
|
|
-enum clc_component_types {
|
|
|
- clc_component_sa_aware = 0, /* sa aware */
|
|
|
- clc_component_proxied_pre = 1, /* proxied, pre-instantiable */
|
|
|
- clc_component_proxied_non_pre = 2, /* proxied, non pre-instantiable */
|
|
|
- clc_component_non_proxied_non_sa_aware = 3 /* non-proxied, non sa aware */
|
|
|
+struct amf_si_ranked_su {
|
|
|
+ /* Configuration Attributes */
|
|
|
+ SaNameT name;
|
|
|
+ SaUint32T saAmfRank;
|
|
|
+
|
|
|
+ /* Relations */
|
|
|
+ struct amf_si *si;
|
|
|
+ struct amf_su *su;
|
|
|
+
|
|
|
+ /* Implementation */
|
|
|
+ struct amf_si_ranked_su *su_next;
|
|
|
+ struct amf_si_ranked_su *si_next;
|
|
|
};
|
|
|
|
|
|
-struct amf_comp {
|
|
|
- int registered;
|
|
|
- int local;
|
|
|
- void *conn;
|
|
|
+struct amf_si_dependency {
|
|
|
+ /* Configuration Attributes */
|
|
|
SaNameT name;
|
|
|
- struct in_addr source_addr;
|
|
|
- struct amf_comp *proxy_comp;
|
|
|
- struct amf_unit *unit;
|
|
|
- struct amf_pg *pg;
|
|
|
- struct amf_csi *csi;
|
|
|
+ int saAmfToleranceTime;
|
|
|
|
|
|
- struct list_head comp_list;
|
|
|
- struct list_head healthcheck_list;
|
|
|
- struct list_head csi_type_name_head;
|
|
|
+ /* Relations */
|
|
|
|
|
|
- enum clc_component_types comptype;
|
|
|
+ /* Implementation */
|
|
|
+ struct amf_si_dependency *next;
|
|
|
+};
|
|
|
+
|
|
|
+struct amf_si_assignment {
|
|
|
+ /* Runtime Attributes */
|
|
|
+ SaNameT name;
|
|
|
+ SaAmfHAStateT saAmfSISUHAState;
|
|
|
|
|
|
- char clccli_path[1024];
|
|
|
- char binary_path[1024];
|
|
|
- char binary_name[1024];
|
|
|
+ /* Relations */
|
|
|
|
|
|
- char instantiate_cmd[1024];
|
|
|
- char terminate_cmd[1024];
|
|
|
- char cleanup_cmd[1024];
|
|
|
- char am_start_cmd[1024];
|
|
|
- char am_stop_cmd[1024];
|
|
|
-
|
|
|
- SaAmfOperationalStateT operational_state;
|
|
|
- SaAmfReadinessStateT readiness_state;
|
|
|
- SaAmfHAStateT ha_state;
|
|
|
- SaAmfPresenceStateT presence_state;
|
|
|
+ /* Implementation */
|
|
|
};
|
|
|
|
|
|
-struct amf_comp_csi_type_name {
|
|
|
- struct list_head list;
|
|
|
+struct amf_csi {
|
|
|
+ /* Configuration Attributes */
|
|
|
SaNameT name;
|
|
|
+ SaNameT saAmfCSTypeName;
|
|
|
+ SaNameT **saAmfCSIDependencies;
|
|
|
+
|
|
|
+ /* Relations */
|
|
|
+ struct amf_si *si;
|
|
|
+ struct amf_csi_assignment *csi_assignments;
|
|
|
+ struct amf_csi_attribute *attributes_head;
|
|
|
+
|
|
|
+ /* Implementation */
|
|
|
+ struct amf_csi *next;
|
|
|
+ int pg_set;
|
|
|
};
|
|
|
|
|
|
-extern struct list_head amf_group_head;
|
|
|
+struct amf_csi_attribute {
|
|
|
+ /* Configuration Attributes */
|
|
|
+ SaStringT name;
|
|
|
+ SaStringT *value;
|
|
|
|
|
|
-extern struct amf_comp *find_comp (SaNameT *name);
|
|
|
+ /* Implementation */
|
|
|
+ struct amf_csi_attribute *next;
|
|
|
+};
|
|
|
|
|
|
-extern struct amf_unit *find_unit (SaNameT *name);
|
|
|
+struct amf_csi_assignment {
|
|
|
+ /* Runtime Attributes */
|
|
|
+ SaNameT name;
|
|
|
+ SaAmfHAStateT saAmfCSICompHASate;
|
|
|
|
|
|
-extern struct amf_healthcheck *find_healthcheck (SaAmfHealthcheckKeyT *key);
|
|
|
+ /* Relations */
|
|
|
+ struct amf_csi *csi;
|
|
|
+ struct amf_comp *comp;
|
|
|
+
|
|
|
+ /* Implementation */
|
|
|
+ struct amf_csi_assignment *comp_next;
|
|
|
+ struct amf_csi_assignment *csi_next;
|
|
|
+};
|
|
|
|
|
|
-extern int openais_amf_config_read (char **error_string);
|
|
|
+extern struct amf_comp *amf_find_comp (struct amf_cluster *cluster, SaNameT *name);
|
|
|
+extern struct amf_su *amf_find_unit (struct amf_cluster *cluster, SaNameT *name);
|
|
|
+extern struct amf_healthcheck *amf_find_healthcheck (struct amf_comp *comp, SaAmfHealthcheckKeyT *key);
|
|
|
+extern int amf_config_read (struct amf_cluster *cluster, char **error_string);
|
|
|
|
|
|
#endif /* AMFCONFIG_H_DEFINED */
|