Introduction of SA Forum information model for AMF as specified in

SAI-Overview-B.02.01.pdf. Other AMF changes as specified in
SAI-AIS-AMF-B.02.01.

Summary:

- SA Forum B.02 Information model for AMF
- groups.conf renamed to amf.conf
- amf.conf syntax changed heavily to follow SA Forum specs.
- AMF works when daemon.
- linux lists removed from AMF
- component cmd environment variables support
- component argv support
- multi value csi attributes



git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@1026 fd59a12c-fef9-0310-b244-a6a79926bd2f
This commit is contained in:
Hans Feldt 2006-05-17 07:22:43 +00:00
parent 29bdf6bcdc
commit 5b30c0a120
18 changed files with 1980 additions and 3636 deletions

View File

@ -105,7 +105,7 @@ install:
install -m 755 exec/aisexec $(SBINDIR)
install -m 755 exec/keygen $(SBINDIR)/ais-keygen
install -m 755 conf/openais.conf $(ETCDIR)
install -m 755 conf/groups.conf $(ETCDIR)
install -m 755 conf/amf.conf $(ETCDIR)
install -m 644 include/saAis.h $(INCLUDEDIR)
install -m 644 include/saAmf.h $(INCLUDEDIR)

View File

@ -94,7 +94,7 @@ a message count. Until the man page is done you'll have to check the code and th
totem spec for the function and usage of the timeouts.
The directory conf contains the file groups.conf which specifies the failover
The directory conf contains the file amf.conf which specifies the failover
groups, service units, components, and policies to be used by the AMF. The
configuration file matches the testamf1-6 programs in the test directory and
can be copied directly.
@ -212,7 +212,7 @@ su to ais user
The test/testamf{1-6} implement three seperate service units (SU). SU #1
consists of testamf1, testamf2. SU #2 consists of testamf3, testamf4.
SU #3 consists of testamf5, testamf6. The active and backup directives
in groups.conf define how many SU's become active and how many
in amf.conf define how many SU's become active and how many
become standby in the service group (SG).
To test the openais AMF, run testamf3 and testamf4 on one node. Both

133
conf/amf.conf Normal file
View File

@ -0,0 +1,133 @@
# AMF Test configuration file
# - Times in milliseconds
# - clccli_path can be set on any level from application and down and will be
# added to the CLI commands if they are not already specified with an absolute
# path (begins with /).
safAmfCluster = test_cluster {
saAmfClusterStartupTimeout=10000
safAmfNode = seasc0036 {
saAmfNodeSuFailOverProb=2000
saAmfNodeSuFailoverMax=2
}
safApp = test_app1 {
clccli_path=/tmp/ais/test
safSg = raid {
saAmfSGRedundancyModel=nplusm
saAmfSGNumPrefActiveSUs=1
saAmfSGMaxActiveSIsperSUs=2
saAmfSGNumPrefStandbySUs=1
saAmfSGMaxStandbySIsperSUs=2
saAmfSGCompRestartProb=100000
saAmfSGCompRestartMax=3
saAmfSGSuRestartProb=20000
saAmfSGSuRestartMax=6
saAmfSGAutoAdjustProb=5000
safSu = SU_1 {
saAmfSUNumComponents=1
safComp = comp_a_in_su_1 {
saAmfCompCategory=sa_aware
saAmfCompCapability=x_active_or_y_standby
saAmfCompNumMaxActiveCsi=1
saAmfCompNumMaxStandbyCsi=1
saAmfCompDefaultClcCliTimeout = 500
saAmfCompDefaultCallbackTimeOut = 500
saAmfCompInstantiateCmd = /tmp/ais/test/clc_cli_script
saAmfCompInstantiateCmdArgv= instantiate /tmp/ais/test/testamf1
saAmfCompTerminateCmd = /tmp/ais/test/clc_cli_script
saAmfCompTerminateCmdArgv = terminate
saAmfCompCleanupCmd = /tmp/ais/test/clc_cli_script
saAmfCompCleanupCmdArgv = cleanup
saAmfCompCsTypes {
for_comp_a_x
for_comp_a_y
}
saAmfCompCmdEnv {
var1=val1
var2=val2
}
saAmfCompRecoveryOnError=component_restart
safHealthcheckKey = key1 {
saAmfHealthcheckPeriod = 3000
saAmfHealthcheckMaxDuration = 350
}
}
}
safSu = SU_2 {
saAmfSUNumComponents=1
safComp = comp_a_in_su_2 {
saAmfCompCategory=sa_aware
saAmfCompCapability=x_active_or_y_standby
saAmfCompNumMaxActiveCsi=1
saAmfCompNumMaxStandbyCsi=1
saAmfCompDefaultClcCliTimeout = 500
saAmfCompDefaultCallbackTimeOut = 500
saAmfCompInstantiateCmd = /tmp/ais/test/clc_cli_script
saAmfCompInstantiateCmdArgv= instantiate
saAmfCompTerminateCmd = /tmp/ais/test/clc_cli_script
saAmfCompTerminateCmdArgv = terminate
saAmfCompCleanupCmd = /tmp/ais/test/clc_cli_script
saAmfCompCleanupCmdArgv = cleanup
saAmfCompCsTypes {
for_comp_a_x
for_comp_a_y
}
saAmfCompCmdEnv {
COMP_BINARY_PATH=/tmp/ais/test
COMP_BINARY_NAME=testamf1
}
saAmfCompRecoveryOnError=component_restart
safHealthcheckKey = key1 {
saAmfHealthcheckPeriod = 3000
saAmfHealthcheckMaxDuration = 350
}
safHealthcheckKey = key2 {
saAmfHealthcheckPeriod = 3000
saAmfHealthcheckMaxDuration = 350
}
}
}
}
safSi = SI_1 {
saAmfSINumCSIs=2
safCsi = csi_ax_in_si_1 {
saAmfCSTypeName=for_comp_a_x
}
safCsi = csi_ay_in_si_1 {
saAmfCSTypeName = for_comp_a_y
saAmfCsiDependencies {
saAmfCSIDependency = csi_ax_in_si_1
}
safCSIAttr = attr1 {
val1
val2
}
safCSIAttr = good_health_limit {
10
}
}
safRankedSu = SU_1 {
saAmfRank = 1
}
safRankedSu = SU_2 {
saAmfRank = 2
}
}
safSi = SI_2 {
saAmfSINumCSIs=1
safCsi = csi_b_in_si_2 {
saAmfCSTypeName=for_comp_a_x
}
safDepend = SI_1 {
saAmfToleranceTime=10000
}
}
safCSType = for_comp_a_y {
safAmfCSAttrName = attr1
safAmfCSAttrName = good_health_limit
}
safCSType = for_comp_a_x {
}
}
}

View File

@ -1,239 +0,0 @@
# Test configuration file
group {
name=raid
model=nplusm
preferred-active-units=2
maximum-active-instances=2
preferred-standby-units=2
maximum-standby-instances=4
clccli_path=/tmp/trunktest/test
binary_path=/tmp/trunktest/test
component_restart_probation=100000
component_restart_max=4
unit_restart_probation=200000
unit_restart_max=6
unit {
name=SU_1
component {
name=comp_a_in_su_1
comptype=sa_aware
bn=testamf1
instantiate=clc_cli_script
terminate=clc_cli_script
cleanup=clc_cli_script
csi_type_name {
name=for_comp_a_x
}
csi_type_name {
name=for_comp_a_y
}
}
component {
name=comp_b_in_su_1
comptype=sa_aware
bn=testamf1
instantiate=clc_cli_script
terminate=clc_cli_script
cleanup=clc_cli_script
csi_type_name {
name=for_comp_b
}
}
}
unit {
name=SU_2
component {
name=comp_a_in_su_2
comptype=sa_aware
bn=testamf1
instantiate=clc_cli_script
terminate=clc_cli_script
cleanup=clc_cli_script
csi_type_name {
name=for_comp_a_x
}
csi_type_name {
name=for_comp_a_y
}
}
component {
name=comp_b_in_su_2
comptype=sa_aware
bn=testamf1
instantiate=clc_cli_script
terminate=clc_cli_script
cleanup=clc_cli_script
csi_type_name {
name=for_comp_b
}
}
}
unit {
name=SU_3
component {
name=comp_a_in_su_3
comptype=sa_aware
bn=testamf1
instantiate=clc_cli_script
terminate=clc_cli_script
cleanup=clc_cli_script
csi_type_name {
name=for_comp_a_x
}
csi_type_name {
name=for_comp_a_y
}
}
component {
name=comp_b_in_su_3
comptype=sa_aware
bn=testamf1
instantiate=clc_cli_script
terminate=clc_cli_script
cleanup=clc_cli_script
csi_type_name {
name=for_comp_b
}
}
}
unit {
name=SU_4
component {
name=comp_a_in_su_4
comptype=sa_aware
bn=testamf1
instantiate=clc_cli_script
terminate=clc_cli_script
cleanup=clc_cli_script
csi_type_name {
name=for_comp_a_x
}
csi_type_name {
name=for_comp_a_y
}
}
component {
name=comp_b_in_su_4
comptype=sa_aware
bn=testamf1
instantiate=clc_cli_script
terminate=clc_cli_script
cleanup=clc_cli_script
csi_type_name {
name=for_comp_b
}
}
}
serviceinstance {
name = SI_1
csi_descriptor {
csi_name=csi_ax_in_si_1
type_name=for_comp_a_x
name_value {
name=good_health_limit
value=0
}
name_value {
name=ax_attr2
value=ax1_val2
}
}
csi_descriptor {
csi_name=csi_ay_in_si_1
type_name=for_comp_a_y
name_value {
name=ay_attr1
value=ay1_val1
}
name_value {
name=ay_attr2
value=ay1_val2
}
}
csi_descriptor {
csi_name=csi_b_in_si_1
type_name=for_comp_b
name_value {
name=good_health_limit
value=0
}
name_value {
name=b_attr2
value=b1_val2
}
}
}
serviceinstance {
name = SI_2
csi_descriptor {
csi_name=csi_ax_in_si_2
type_name=for_comp_a_x
name_value {
name=good_health_limit
value=10
}
name_value {
name=ax_attr2
value=ax2_val2
}
}
csi_descriptor {
csi_name=csi_b_in_si_2
type_name=for_comp_b
name_value {
name=good_health_limit
value=0
}
name_value {
name=b_attr2
value=b2_val2
}
}
csi_descriptor {
csi_name=csi_ay_in_si_2
type_name=for_comp_a_y
name_value {
name=ay_attr1
value=ay2_val1
}
name_value {
name=ay_attr2
value=ay2_val2
}
}
}
# serviceinstance {
# name = sibb
# }
# serviceinstance {
# name = sicc
# }
# serviceinstance {
# name = sidd
# }
# serviceinstance {
# name = side
# }
# serviceinstance {
# name = sidf
# }
}
healthcheck {
key = key1
period = 500
maximum_duration = 550
}
healthcheck {
key = key2
period = 2000
maximum_duration = 250
}
healthcheck {
key = key3
period = 3000
maximum_duration = 350
}

View File

@ -49,6 +49,7 @@
#include "objdb.h"
#include "config.h"
#include "mempool.h"
#include "util.h"
static int read_config_file_into_objdb(
struct objdb_iface_ver0 *objdb,
@ -66,7 +67,7 @@ static int aisparser_readconfig (struct objdb_iface_ver0 *objdb, char **error_st
}
char *remove_whitespace(char *string)
static char *remove_whitespace(char *string)
{
char *start = string+strspn(string, " \t");
char *end = start+(strlen(start))-1;
@ -79,34 +80,6 @@ char *remove_whitespace(char *string)
return start;
}
char *strstr_rs (const char *haystack, const char *needle)
{
char *end_address;
char *new_needle;
new_needle = (char *)mempool_strdup (needle);
new_needle[strlen(new_needle) - 1] = '\0';
end_address = strstr (haystack, new_needle);
if (end_address) {
end_address += strlen (new_needle);
end_address = strstr (end_address, needle + strlen (new_needle));
}
if (end_address) {
end_address += 1; /* skip past { or = */
do {
if (*end_address == '\t' || *end_address == ' ') {
end_address++;
} else {
break;
}
} while (*end_address != '\0');
}
mempool_free (new_needle);
return (end_address);
}
static int parse_section(FILE *fp,
struct objdb_iface_ver0 *objdb,
unsigned int parent_handle,

View File

@ -295,13 +295,13 @@ int poll_timer_add (
goto error_exit;
}
timerlist_add_future (&poll_instance->timerlist,
timer_fn, data, msec_in_future, timer_handle_out);
if (timer_handle_out == 0) {
res = -ENOENT;
}
timerlist_add_future (&poll_instance->timerlist,
timer_fn, data, msec_in_future, timer_handle_out);
hdb_handle_put (&poll_instance_database, handle);
error_exit:
return (res);

3429
exec/amf.c

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -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,92 +51,6 @@ enum escalation_levels {
ESCALATION_LEVEL_THREE = 4 /* escalate to node failover */
};
struct amf_unit {
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;
};
struct amf_csi_name_value {
struct list_head csi_name_list;
char name[128];
char value[128];
};
struct amf_si;
struct amf_csi {
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;
};
struct amf_si {
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;
};
struct amf_pg {
SaNameT name;
struct amf_comp *comp;
struct list_head pg_list;
struct list_head pg_comp_head;
};
struct amf_pg_comp {
struct amf_comp *comp;
struct amf_csi *csi;
struct list_head list;
};
struct amf_group {
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;
char clccli_path[1024];
char binary_path[1024];
unsigned int component_restart_probation;
unsigned int component_restart_max;
unsigned int unit_restart_probation;
unsigned int unit_restart_max;
};
enum clc_component_types {
clc_component_sa_aware = 0, /* sa aware */
clc_component_proxied_pre = 1, /* proxied, pre-instantiable */
@ -148,52 +58,321 @@ enum clc_component_types {
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;
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_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_application {
/* Configuration Attributes */
SaNameT name;
/* 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_sg {
/* Configuration Attributes */
SaNameT name;
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_su {
/* Configuration Attributes */
SaNameT name;
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_comp {
int registered;
int local;
void *conn;
/* Configuration Attributes */
SaNameT name;
struct in_addr source_addr;
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_unit *unit;
struct amf_pg *pg;
struct amf_csi *csi;
struct list_head comp_list;
struct list_head healthcheck_list;
struct list_head csi_type_name_head;
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;
char clccli_path[1024];
char binary_path[1024];
char binary_name[1024];
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;
struct amf_healthcheck *healthcheck_head;
};
struct amf_comp_csi_type_name {
struct list_head list;
struct amf_healthcheck {
/* Configuration Attributes */
SaAmfHealthcheckKeyT safHealthcheckKey;
int saAmfHealthcheckMaxDuration;
int saAmfHealthcheckPeriod;
/* Relations */
struct amf_comp *comp;
/* Implementation */
struct amf_healthcheck *next;
SaAmfHealthcheckInvocationT invocationType;
poll_timer_handle timer_handle_duration;
poll_timer_handle timer_handle_period;
int active;
};
struct amf_si {
/* Configuration Attributes */
SaNameT name;
SaNameT saAmfSIProtectedbySG;
SaUint32T saAmfSIRank;
SaUint32T saAmfSINumCSIs;
SaUint32T saAmfSIPrefActiveAssignments;
SaUint32T saAmfSIPrefStandbyAssignments;
/* Runtime Attributes */
SaAmfAdminStateT saAmfSIAdminState;
SaAmfAssignmentStateT saAmfSIAssignmentState;
SaUint32T saAmfSINumCurrActiveAssignments;
SaUint32T saAmfSINumICurrStandbyAssignments;
/* 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;
/* Implementation */
struct amf_si *next;
};
extern struct list_head amf_group_head;
struct amf_si_ranked_su {
/* Configuration Attributes */
SaNameT name;
SaUint32T saAmfRank;
extern struct amf_comp *find_comp (SaNameT *name);
/* Relations */
struct amf_si *si;
struct amf_su *su;
extern struct amf_unit *find_unit (SaNameT *name);
/* Implementation */
struct amf_si_ranked_su *su_next;
struct amf_si_ranked_su *si_next;
};
extern struct amf_healthcheck *find_healthcheck (SaAmfHealthcheckKeyT *key);
struct amf_si_dependency {
/* Configuration Attributes */
SaNameT name;
int saAmfToleranceTime;
extern int openais_amf_config_read (char **error_string);
/* Relations */
/* Implementation */
struct amf_si_dependency *next;
};
struct amf_si_assignment {
/* Runtime Attributes */
SaNameT name;
SaAmfHAStateT saAmfSISUHAState;
/* Relations */
/* Implementation */
};
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;
};
struct amf_csi_attribute {
/* Configuration Attributes */
SaStringT name;
SaStringT *value;
/* Implementation */
struct amf_csi_attribute *next;
};
struct amf_csi_assignment {
/* Runtime Attributes */
SaNameT name;
SaAmfHAStateT saAmfCSICompHASate;
/* Relations */
struct amf_csi *csi;
struct amf_comp *comp;
/* Implementation */
struct amf_csi_assignment *comp_next;
struct amf_csi_assignment *csi_next;
};
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 */

View File

@ -75,8 +75,6 @@ struct main_config {
struct logger_config *logger;
};
extern char *strstr_rs (const char *haystack, const char *needle);
extern int openais_main_config_read (
struct objdb_iface_ver0 *objdb,
char **error_string,

View File

@ -84,6 +84,7 @@ void openais_exit_error (enum e_ais_done err)
char *getSaNameT (SaNameT *name)
{
#if 0
static char ret_name[300];
memset (ret_name, 0, sizeof (ret_name));
@ -94,4 +95,53 @@ char *getSaNameT (SaNameT *name)
memcpy (ret_name, name->value, name->length);
}
return (ret_name);
#endif
return name->value;
}
char *strstr_rs (const char *haystack, const char *needle)
{
char *end_address;
char *new_needle;
new_needle = (char *)strdup (needle);
new_needle[strlen (new_needle) - 1] = '\0';
end_address = strstr (haystack, new_needle);
if (end_address) {
end_address += strlen (new_needle);
end_address = strstr (end_address, needle + strlen (new_needle));
}
if (end_address) {
end_address += 1; /* skip past { or = */
do {
if (*end_address == '\t' || *end_address == ' ') {
end_address++;
} else {
break;
}
} while (*end_address != '\0');
}
free (new_needle);
return (end_address);
}
void setSaNameT (SaNameT *name, char *str) {
strncpy ((char *)name->value, str, SA_MAX_NAME_LENGTH);
if (strlen ((char *)name->value) > SA_MAX_NAME_LENGTH) {
name->length = SA_MAX_NAME_LENGTH;
} else {
name->length = strlen (str);
}
}
int SaNameTisEqual (SaNameT *str1, char *str2) {
if (str1->length == strlen (str2)) {
return ((strncmp ((char *)str1->value, (char *)str2,
str1->length)) == 0);
} else {
return 0;
}
}

View File

@ -62,9 +62,12 @@ enum e_ais_done {
AIS_DONE_DYNAMICLOAD = -12,
AIS_DONE_OBJDB = -13,
AIS_DONE_INIT_SERVICES = -14,
AIS_DONE_OUT_OF_MEMORY = -15,
};
void openais_exit_error (enum e_ais_done err);
extern char *getSaNameT (SaNameT *name);
extern char *strstr_rs (const char *haystack, const char *needle);
extern void setSaNameT (SaNameT *name, char *str);
extern int SaNameTisEqual (SaNameT *str1, char *str2);
#endif /* UTIL_H_DEFINED */

View File

@ -49,7 +49,7 @@ enum req_lib_amf_types {
MESSAGE_REQ_AMF_HEALTHCHECKSTOP = 6,
MESSAGE_REQ_AMF_HASTATEGET = 7,
MESSAGE_REQ_AMF_CSIQUIESCINGCOMPLETE = 8,
MESSAGE_REQ_AMF_PROTECTIONGROUPTRACKSTART = 9,
MESSAGE_REQ_AMF_PROTECTIONGROUPTRACK = 9,
MESSAGE_REQ_AMF_PROTECTIONGROUPTRACKSTOP = 10,
MESSAGE_REQ_AMF_COMPONENTERRORREPORT = 11,
MESSAGE_REQ_AMF_COMPONENTERRORCLEAR = 12,
@ -66,7 +66,7 @@ enum res_lib_amf_types {
MESSAGE_RES_AMF_HEALTHCHECKSTOP = 6,
MESSAGE_RES_AMF_HASTATEGET = 7,
MESSAGE_RES_AMF_CSIQUIESCINGCOMPLETE = 8,
MESSAGE_RES_AMF_PROTECTIONGROUPTRACKSTART = 9,
MESSAGE_RES_AMF_PROTECTIONGROUPTRACK = 9,
MESSAGE_RES_AMF_PROTECTIONGROUPTRACKSTOP = 10,
MESSAGE_RES_AMF_COMPONENTERRORREPORT = 11,
MESSAGE_RES_AMF_COMPONENTERRORCLEAR = 12,
@ -176,14 +176,14 @@ struct res_lib_amf_csiquiescingcomplete {
struct res_header header;
};
struct req_lib_amf_protectiongrouptrackstart {
struct req_lib_amf_protectiongrouptrack {
struct req_header header;
SaNameT csiName;
SaUint8T trackFlags;
SaAmfProtectionGroupNotificationT *notificationBufferAddress;
};
struct res_lib_amf_protectiongrouptrackstart {
struct res_lib_amf_protectiongrouptrack {
struct res_header header;
};

View File

@ -328,10 +328,10 @@ saAmfDispatch (
int i;
for (i=0; i<csi_descriptor.csiAttr.number; i++) {
csi_attribute_array[i].attrName = p;
csi_attribute_array[i].attrName = (SaUint8T*)p;
p += strlen(p) + 1;
csi_attribute_array[i].attrValue = p;
csi_attribute_array[i].attrValue = (SaUint8T*)p;
p += strlen(p) + 1;
}
@ -873,16 +873,16 @@ saAmfProtectionGroupTrack (
const SaAmfProtectionGroupNotificationT *notificationBuffer)
{
struct amfInstance *amfInstance;
struct req_lib_amf_protectiongrouptrackstart req_lib_amf_protectiongrouptrackstart;
struct res_lib_amf_protectiongrouptrackstart res_lib_amf_protectiongrouptrackstart;
struct req_lib_amf_protectiongrouptrack req_lib_amf_protectiongrouptrack;
struct res_lib_amf_protectiongrouptrack res_lib_amf_protectiongrouptrack;
SaAisErrorT error;
req_lib_amf_protectiongrouptrackstart.header.size = sizeof (struct req_lib_amf_protectiongrouptrackstart);
req_lib_amf_protectiongrouptrackstart.header.id = MESSAGE_REQ_AMF_PROTECTIONGROUPTRACKSTART;
memcpy (&req_lib_amf_protectiongrouptrackstart.csiName, csiName,
req_lib_amf_protectiongrouptrack.header.size = sizeof (struct req_lib_amf_protectiongrouptrack);
req_lib_amf_protectiongrouptrack.header.id = MESSAGE_REQ_AMF_PROTECTIONGROUPTRACK;
memcpy (&req_lib_amf_protectiongrouptrack.csiName, csiName,
sizeof (SaNameT));
req_lib_amf_protectiongrouptrackstart.trackFlags = trackFlags;
req_lib_amf_protectiongrouptrackstart.notificationBufferAddress = (SaAmfProtectionGroupNotificationT *)notificationBuffer;
req_lib_amf_protectiongrouptrack.trackFlags = trackFlags;
req_lib_amf_protectiongrouptrack.notificationBufferAddress = (SaAmfProtectionGroupNotificationT *)notificationBuffer;
error = saHandleInstanceGet (&amfHandleDatabase, amfHandle,
(void *)&amfInstance);
@ -893,16 +893,16 @@ saAmfProtectionGroupTrack (
pthread_mutex_lock (&amfInstance->response_mutex);
error = saSendReceiveReply (amfInstance->response_fd,
&req_lib_amf_protectiongrouptrackstart,
sizeof (struct req_lib_amf_protectiongrouptrackstart),
&res_lib_amf_protectiongrouptrackstart,
sizeof (struct res_lib_amf_protectiongrouptrackstart));
&req_lib_amf_protectiongrouptrack,
sizeof (struct req_lib_amf_protectiongrouptrack),
&res_lib_amf_protectiongrouptrack,
sizeof (struct res_lib_amf_protectiongrouptrack));
pthread_mutex_unlock (&amfInstance->response_mutex);
saHandleInstancePut (&amfHandleDatabase, amfHandle);
return (error == SA_AIS_OK ? res_lib_amf_protectiongrouptrackstart.header.error : error);
return (error == SA_AIS_OK ? res_lib_amf_protectiongrouptrack.header.error : error);
}
SaAisErrorT

View File

@ -438,7 +438,7 @@ directive, there is one configuration option which is optional:
.TP
mode
This can either contain the value enabled or disabled. When enabled, AMF will
instantiate the service groups specified in the /etc/ais/groups.conf file.
start the applications specified in the /etc/ais/amf.conf file.
The default is disabled.
.SH "FILES"
@ -446,8 +446,8 @@ The default is disabled.
/etc/ais/openais.conf
The openais executive configuration file.
.TP
/etc/ais/groups.conf
The openais AMF service groups configuration file.
/etc/ais/amf.conf
The openais AMF configuration file.
.SH "SEE ALSO"
.BR openais_overview (8), README.amf

View File

@ -215,7 +215,7 @@ OPENAIS_AMF_CONFIG_FILE
This specifies the fully qualified path to the openais Availability Management
Framework configuration file.
The default is /etc/ais/groups.conf.
The default is /etc/ais/amf.conf.
.TP
OPENAIS_DEFAULT_CONFIG_IFACE

View File

@ -33,7 +33,8 @@
# It may be modified to do any action desired.
instantiate() {
./openais-instantiate $COMP_BINARY_PATH/$COMP_BINARY_NAME
echo clc_cli_script instantiating component $SA_AMF_COMPONENT_NAME $1
./openais-instantiate $1
RETVAL=$?
return $RETVAL
}
@ -62,13 +63,22 @@ cleanup() {
return $RETVAL
}
case "$CLC_CLI_INTERFACE" in
usage() {
echo $"Usage: $0 {instantiate|terminate|cleanup}"
}
case "$1" in
instantiate)
instantiate
if [ $# -gt 1 ]; then
instantiate $2
else
instantiate $COMP_BINARY_PATH/$COMP_BINARY_NAME
exit 1
fi
;;
terminate)
terminiate
terminate
;;
cleanup)
@ -76,9 +86,8 @@ case "$CLC_CLI_INTERFACE" in
;;
*)
echo $"Usage: $0 {instantiate|terminate}"
usage
exit 1
esac
exit 0

View File

@ -156,15 +156,16 @@ void CSISetCallback (
printf ("' for component ");
printSaNameT ((SaNameT *)compName);
printf ("'");
printf (" requested to enter hastate SA_AMF_ACTIVE.\n");
printf (" requested to enter hastate SA_AMF_ACTIVE for CSI %s\n",
csiDescriptor->csiName.value);
res = saAmfResponse (handle, invocation, SA_AIS_OK);
int i;
TR(TRU, csiDescriptor->csiAttr.number);
for(i=0; i<csiDescriptor->csiAttr.number; i++) {
if( strcmp(csiDescriptor->csiAttr.attr[i].attrName, "good_health_limit") == 0){
good_health = strcmp(csiDescriptor->csiAttr.attr[i].attrValue, "0") ? 0 : 1;
good_health_limit = atoi(csiDescriptor->csiAttr.attr[i].attrValue);
if( strcmp((char*)csiDescriptor->csiAttr.attr[i].attrName, "good_health_limit") == 0){
good_health = strcmp((char*)csiDescriptor->csiAttr.attr[i].attrValue, "0") ? 0 : 1;
good_health_limit = atoi((char*)csiDescriptor->csiAttr.attr[i].attrValue);
}
@ -188,13 +189,14 @@ void CSISetCallback (
printf ("' for component ");
printSaNameT ((SaNameT *)compName);
printf ("'");
printf (" requested to enter hastate SA_AMF_STANDBY.\n");
printf (" requested to enter hastate SA_AMF_STANDBY for CSI %s\n",
csiDescriptor->csiName.value);
res = saAmfResponse (handle, invocation, SA_AIS_OK);
TR(TRU,csiDescriptor->csiAttr.number);
for(i=0; i<csiDescriptor->csiAttr.number; i++) {
if(!strcmp(csiDescriptor->csiAttr.attr[i].attrName, "good_health") &&
!strcmp(csiDescriptor->csiAttr.attr[i].attrValue, "true")){
if(!strcmp((char*)csiDescriptor->csiAttr.attr[i].attrName, "good_health") &&
!strcmp((char*)csiDescriptor->csiAttr.attr[i].attrValue, "true")){
good_health = 1;
}
TR(TRS,csiDescriptor->csiAttr.attr[i].attrName);