diff --git a/include/crm/cib.h b/include/crm/cib.h index 05081939dd..74321336b1 100644 --- a/include/crm/cib.h +++ b/include/crm/cib.h @@ -1,68 +1,70 @@ -/* $Id: cib.h,v 1.2 2004/03/25 17:06:08 andrew Exp $ */ +/* $Id: cib.h,v 1.3 2004/06/01 11:45:39 andrew Exp $ */ /* * Copyright (C) 2004 Andrew Beekhof * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef CIB__H #define CIB__H +#include + enum cib_op { CIB_OP_NONE = 0, CIB_OP_ADD, CIB_OP_MODIFY, CIB_OP_DELETE, CIB_OP_MAX }; enum cib_result { CIBRES_OK = 0, CIBRES_MISSING_ID, CIBRES_MISSING_TYPE, CIBRES_MISSING_FIELD, CIBRES_OBJTYPE_MISMATCH, CIBRES_CORRUPT, CIBRES_OTHER, CIBRES_FAILED, CIBRES_FAILED_STALE, CIBRES_FAILED_EXISTS, CIBRES_FAILED_NOTEXISTS, CIBRES_FAILED_ACTIVATION, CIBRES_FAILED_NOSECTION, CIBRES_FAILED_NOOBJECT, CIBRES_FAILED_NOPARENT, CIBRES_FAILED_NODECOPY, CIBRES_FAILED_NOTSUPPORTED, }; /* Core functions */ extern gboolean startCib(const char *filename); extern xmlNodePtr get_cib_copy(void); extern xmlNodePtr process_cib_message(xmlNodePtr message, gboolean auto_reply); extern xmlNodePtr process_cib_request(const char *op, const xmlNodePtr options, const xmlNodePtr fragment); /* Utility functions */ extern xmlNodePtr get_object_root(const char *object_type,xmlNodePtr the_root); extern xmlNodePtr create_cib_fragment(xmlNodePtr update, const char *section); extern char *pluralSection(const char *a_section); /* Error Interpretation*/ extern const char *cib_error2string(enum cib_result); extern const char *cib_op2string(enum cib_op); #endif diff --git a/include/crm/crm.h b/include/crm/crm.h index 7bf0192459..afd6a7a3f3 100644 --- a/include/crm/crm.h +++ b/include/crm/crm.h @@ -1,112 +1,136 @@ -/* $Id: crm.h,v 1.7 2004/05/23 18:13:09 andrew Exp $ */ +/* $Id: crm.h,v 1.8 2004/06/01 11:45:39 andrew Exp $ */ /* * Copyright (C) 2004 Andrew Beekhof * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef CRM__H #define CRM__H #include #include #include +#include +#include +#include +#include + /* Clean these up at some point, some probably should be runtime options */ #define WORKING_DIR HA_VARLIBDIR"/heartbeat/crm" #define BIN_DIR "/usr/lib/heartbeat" #define MAXDATASIZE 65535 // ipc comms #define SOCKET_LEN 1024 #define APPNAME_LEN 256 #define LOG_DIR "/var/log" #define MAX_IPC_FAIL 5 #define CIB_FILENAME WORKING_DIR"/cib.xml" #define CIB_BACKUP WORKING_DIR"/cib_backup.xml" #define MSG_LOG 1 #define INTEGRATED_CIB 1 #define DOT_FSA_ACTIONS 1 #define DOT_ALL_FSA_INPUTS 1 //#define FSA_TRACE 1 #define USE_FAKE_LRM 1 +/* Throttle announce messages to work around what appears to be a bug in + * the send_ordered_*_message() code. node messages are taking approx 15s + * longer to be sent than their cluster counterparts + */ +#define THROTTLE_ANNOUNCE 1 -#include -#include -#include + +/* Sub-systems */ +#define CRM_SYSTEM_DC "dc" +#define CRM_SYSTEM_DCIB "dcib" // The master CIB +#define CRM_SYSTEM_CIB "cib" +#define CRM_SYSTEM_CRMD "crmd" +#define CRM_SYSTEM_LRMD "lrmd" +#define CRM_SYSTEM_PENGINE "pengine" +#define CRM_SYSTEM_TENGINE "tengine" + +/* Valid operations */ +#define CRM_OP_BUMP "bump" +#define CRM_OP_QUERY "query" +#define CRM_OP_CREATE "create" +#define CRM_OP_UPDATE "update" +#define CRM_OP_DELETE "delete" +#define CRM_OP_ERASE "erase" +#define CRM_OP_STORE "store" +#define CRM_OP_REPLACE "replace" +#define CRM_OP_FORWARD "forward" +#define CRM_OP_JOINACK "join_ack" +#define CRM_OP_WELCOME "welcome" +#define CRM_OP_PING "ping" +#define CRM_OP_VOTE "vote" +#define CRM_OP_HELLO "hello" +#define CRM_OP_ANNOUNCE "announce" +#define CRM_OP_HBEAT "dc_beat" +#define CRM_OP_PECALC "pe_calc" +#define CRM_OP_ABORT "abort" +#define CRM_OP_QUIT "quit" +#define CRM_OP_SHUTDOWN "shutdown_crm" +#define CRM_OP_EVENTCC "event_cc" +#define CRM_OP_TEABORT "te_abort" +#define CRM_OP_TRANSITION "transition" +#define CRM_OP_TECOMPLETE "te_complete" +#define CRM_OP_SHUTDOWN_REQ "req_shutdown" + +#define CRMD_STATE_ACTIVE "active" +#define CRMD_STATE_INACTIVE "inactive" + +#define CRMD_JOINSTATE_DOWN "down" +#define CRMD_JOINSTATE_PENDING "pending" +#define CRMD_JOINSTATE_MEMBER "member" + +typedef GSList* GSListPtr; #define safe_str_eq(x, y) x!=NULL && y!=NULL && strcmp(x,y) == 0 #define safe_str_neq(x, y) x != y && (x==NULL || y==NULL || strcmp(x,y) != 0) +#define slist_iter(w, x, y, z, a) for(z = 0; z < g_slist_length(y); z++) { \ + x *w = (x*)g_slist_nth_data(y, z); \ + a; \ + } + /* Developmental debug stuff */ -#if 1 -# define CRM_DEBUG(w...) cl_log(LOG_DEBUG, w) -#else -/* these wont work yet, need to cast to void */ -# define CRM_DEBUG(w...) if(0) { cl_log(LOG_DEBUG, w); } -#endif +#define CRM_DEBUG(w...) cl_log(LOG_DEBUG, w) + +extern gboolean crm_debug_state; +#define crm_debug(w...) if(crm_debug_state) { \ + cl_log(LOG_DEBUG, w); \ + } + +#define crm_debug_action(x) if(crm_debug_state) { \ + x; \ + } /* Seriously detailed debug stuff */ #if 0 # define FNIN() cl_log(LOG_DEBUG, "#---#---# Entering %s...", __FUNCTION__) # define FNOUT() { cl_log(LOG_DEBUG, "#---#---# Leaving %s...", __FUNCTION__); return; } # define FNRET(x) { cl_log(LOG_DEBUG, "#---#---# Leaving %s...", __FUNCTION__); return x; } #else # define FNIN() ; # define FNOUT() return; # define FNRET(x) return x; #endif -/* Sub-systems */ -#define CRM_SYSTEM_DC "dc" -#define CRM_SYSTEM_DCIB "dcib" // The master CIB -#define CRM_SYSTEM_CIB "cib" -#define CRM_SYSTEM_CRMD "crmd" -#define CRM_SYSTEM_LRMD "lrmd" -#define CRM_SYSTEM_PENGINE "pengine" -#define CRM_SYSTEM_TENGINE "tengine" - -/* Valid operations */ -#define CRM_OPERATION_BUMP "bump" -#define CRM_OPERATION_QUERY "query" -#define CRM_OPERATION_CREATE "create" -#define CRM_OPERATION_UPDATE "update" -#define CRM_OPERATION_DELETE "delete" -#define CRM_OPERATION_ERASE "erase" -#define CRM_OPERATION_STORE "store" -#define CRM_OPERATION_REPLACE "replace" -#define CRM_OPERATION_FORWARD "forward" -#define CRM_OPERATION_JOINACK "join_ack" -#define CRM_OPERATION_WELCOME "welcome" -#define CRM_OPERATION_PING "ping" -#define CRM_OPERATION_VOTE "vote" -#define CRM_OPERATION_ANNOUNCE "announce" -#define CRM_OPERATION_HBEAT "dc_beat" -#define CRM_OPERATION_SHUTDOWN "shutdown" -#define CRM_OPERATION_SHUTDOWN_REQ "req_shutdown" - - -typedef GSList* GSListPtr; - -#define slist_iter(w, x, y, z, a) for(z = 0; z < g_slist_length(y); z++) { \ - x *w = (x*)g_slist_nth_data(y, z); \ - a; \ - } - -#define crm_malloc(x) cl_malloc(x) -#define crm_free(x) if(x) { cl_free(x); x=NULL; } -#define crm_strdup(x) cl_strdup(x) -#include +#define crm_malloc(x) malloc(x) +#define crm_free(x) if(x) { free(x); x=NULL; } +#define crm_strdup(x) strdup(x) #endif diff --git a/include/crm/msg_xml.h b/include/crm/msg_xml.h index fa866b3bf3..94998328a4 100644 --- a/include/crm/msg_xml.h +++ b/include/crm/msg_xml.h @@ -1,118 +1,143 @@ -/* $Id: msg_xml.h,v 1.2 2004/04/02 12:11:47 andrew Exp $ */ +/* $Id: msg_xml.h,v 1.3 2004/06/01 11:45:39 andrew Exp $ */ /* * Copyright (C) 2004 Andrew Beekhof * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef XML_TAGS__H #define XML_TAGS__H #define CRM_VERSION "0.1" //---- Common tags/attrs #define XML_TAG_CIB "cib" #define XML_TAG_FAILED "failed" #define XML_ATTR_GENERATION "generation" #define XML_ATTR_TIMEOUT "timeout" #define XML_ATTR_TSTAMP "timestamp" #define XML_ATTR_VERSION "version" #define XML_ATTR_DESC "description" #define XML_ATTR_ID "id" +#define XML_ATTR_TYPE "type" #define XML_ATTR_FILTER_TYPE "type_filter" #define XML_ATTR_FILTER_ID "id_filter" #define XML_ATTR_FILTER_PRIORITY "priority_filter" #define XML_ATTR_VERBOSE "verbose" -#define XML_ATTR_OP "operation" +#define XML_ATTR_OP "op" +#define XML_ATTR_TRUEOP "true_op" + +#define XML_BOOLEAN_TRUE "true" +#define XML_BOOLEAN_FALSE "false" +#define XML_BOOLEAN_NO XML_BOOLEAN_TRUE +#define XML_BOOLEAN_YES XML_BOOLEAN_FALSE #define XML_TAG_OPTIONS "options" //---- top level tags/attrs #define XML_MSG_TAG "crm_message" #define XML_ATTR_REQUEST "request" #define XML_ATTR_RESPONSE "response" #define XML_ATTR_MSGTYPE "message_type" #define XML_ATTR_SYSFROM "sys_from" #define XML_ATTR_SYSTO "sys_to" #define XML_ATTR_SYSCC "sys_cc" #define XML_ATTR_HOSTFROM "host_from" #define XML_ATTR_HOSTTO "host_to" #define XML_ATTR_REFERENCE "crm_msg_reference" #define XML_FAIL_TAG_RESOURCE "failed_resource" #define XML_FAILRES_ATTR_RESID "resource_id" #define XML_FAILRES_ATTR_REASON "reason" #define XML_FAILRES_ATTR_RESSTATUS "resource_status" #define XML_CRM_TAG_PING "ping_response" #define XML_PING_ATTR_STATUS "ping_result" #define XML_PING_ATTR_SYSFROM "crm_subsystem" #define XML_TAG_FRAGMENT "cib_fragment" #define XML_ATTR_RESULT "cib_action_result" #define XML_ATTR_SECTION "section" #define XML_FAIL_TAG_CIB "failed_update" #define XML_FAILCIB_ATTR_ID "id" #define XML_FAILCIB_ATTR_OBJTYPE "object_type" #define XML_FAILCIB_ATTR_OP "operation" #define XML_FAILCIB_ATTR_REASON "reason" //---- CIB specific tags/attrs -#define XML_CIB_TAG_CONFIGURATION "configuration" -#define XML_CIB_TAG_STATUS "status" -#define XML_CIB_TAG_RESOURCES "resources" -#define XML_CIB_TAG_NODES "nodes" -#define XML_CIB_TAG_CONSTRAINTS "constraints" - -#define XML_CIB_TAG_STATE "node_state" -#define XML_CIB_TAG_RESOURCE "resource" -#define XML_CIB_TAG_NODE "node" -#define XML_CIB_TAG_CONSTRAINT "constraint" -#define XML_CIB_TAG_NVPAIR "nv_pair" - -#define XML_CIB_ATTR_HEALTH "health" -#define XML_CIB_ATTR_WEIGHT "weight" -#define XML_CIB_ATTR_PRIORITY "priority" -#define XML_CIB_ATTR_RESTIMEOUT "res_timeout" -#define XML_CIB_ATTR_MAXINSTANCE "max_instances" -#define XML_CIB_ATTR_INSTANCE "instance" -#define XML_CIB_ATTR_RESID "res_id" -#define XML_CIB_ATTR_RESID1 "res_id_1" -#define XML_CIB_ATTR_RESID2 "res_id_2" -#define XML_CIB_ATTR_CLEAR "clear_on" -#define XML_CIB_ATTR_SOURCE "source" -#define XML_CIB_ATTR_CONTYPE "type" -#define XML_CIB_ATTR_RESTYPE "type" -#define XML_CIB_ATTR_RESSTATUS "resource_status" -#define XML_CIB_ATTR_NODEID "node_id" -#define XML_CIB_ATTR_NODETYPE "type" -#define XML_CIB_ATTR_NODESTATUS "node_status" -#define XML_CIB_ATTR_VARTYPE "var_type" -#define XML_CIB_ATTR_VARVALUE "var_value" -#define XML_CIB_ATTR_NODEREF "node_crm_msg_reference" -#define XML_CIB_ATTR_ACTION "action" +#define XML_CIB_TAG_CONFIGURATION "configuration" +#define XML_CIB_TAG_STATUS "status" +#define XML_CIB_TAG_RESOURCES "resources" +#define XML_CIB_TAG_NODES "nodes" +#define XML_CIB_TAG_CONSTRAINTS "constraints" + +#define XML_CIB_TAG_STATE "node_state" +#define XML_CIB_TAG_RESOURCE "resource" +#define XML_CIB_TAG_NODE "node" +#define XML_CIB_TAG_CONSTRAINT "constraint" +#define XML_CIB_TAG_NVPAIR "nv_pair" + +#define XML_CIB_TAG_LRM "lrm" +#define XML_LRM_TAG_RESOURCES "lrm_resources" + +#define XML_CIB_ATTR_HEALTH "health" +#define XML_CIB_ATTR_WEIGHT "weight" +#define XML_CIB_ATTR_PRIORITY "priority" +#define XML_CIB_ATTR_RESTIMEOUT "res_timeout" +#define XML_CIB_ATTR_MAXINSTANCE "max_instances" +#define XML_CIB_ATTR_INSTANCE "instance" +#define XML_CIB_ATTR_CLEAR "clear_on" +#define XML_CIB_ATTR_SOURCE "source" + +#define XML_CIB_ATTR_JOINSTATE "join" +#define XML_CIB_ATTR_EXPSTATE "expected" +#define XML_CIB_ATTR_INCCM "in_ccm" +#define XML_CIB_ATTR_CRMDSTATE "crmd" + +#define XML_CIB_ATTR_SHUTDOWN "shutdown" +#define XML_CIB_ATTR_CLEAR_SHUTDOWN "clear_shutdown" +#define XML_CIB_ATTR_STONITH "stonith" +#define XML_CIB_ATTR_CLEAR_STONITH "clear_stonith" + +#define XML_LRM_ATTR_TASK "task" +#define XML_LRM_ATTR_TARGET "target" +#define XML_LRM_ATTR_DISCARD "discard" +#define XML_LRM_ATTR_RUNNABLE "runnable" +#define XML_LRM_ATTR_OPTIONAL "optional" + +#define XML_LRM_ATTR_LASTOP "last_op" +#define XML_LRM_ATTR_OPSTATE "op_state" +#define XML_LRM_ATTR_OPCODE "op_code" + +#define XML_NVPAIR_ATTR_NAME "name" +#define XML_NVPAIR_ATTR_VALUE "value" + +#define XML_STRENGTH_VAL_MUST "must" +#define XML_STRENGTH_VAL_SHOULD "should" +#define XML_STRENGTH_VAL_SHOULDNOT "should_not" +#define XML_STRENGTH_VAL_MUSTNOT "must_not" #include #define ID(x) xmlGetProp(x, XML_ATTR_ID) #define INSTANCE(x) xmlGetProp(x, XML_CIB_ATTR_INSTANCE) #define TSTAMP(x) xmlGetProp(x, XML_ATTR_TSTAMP) #define TYPE(x) x != NULL ? x->name : NULL #endif