diff --git a/cib/callbacks.h b/cib/callbacks.h index e6097d6043..deca4e5458 100644 --- a/cib/callbacks.h +++ b/cib/callbacks.h @@ -1,84 +1,80 @@ /* * 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 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include #include #include #include #include #include #include -extern gboolean cib_is_master; +extern gboolean cib_is_master; extern GHashTable *client_list; extern GHashTable *peer_hash; extern GHashTable *config_hash; -typedef struct cib_client_s -{ - char *id; - char *name; - char *callback_id; - char *user; +typedef struct cib_client_s { + char *id; + char *name; + char *callback_id; + char *user; - const char *channel_name; + const char *channel_name; - IPC_Channel *channel; - GCHSource *source; - gboolean encrypted; - unsigned long num_calls; + IPC_Channel *channel; + GCHSource *source; + gboolean encrypted; + unsigned long num_calls; - int pre_notify; - int post_notify; - int confirmations; - int replace; - int diffs; - - GList *delegated_calls; + int pre_notify; + int post_notify; + int confirmations; + int replace; + int diffs; + + GList *delegated_calls; } cib_client_t; -typedef struct cib_operation_s -{ - const char* operation; - gboolean modifies_cib; - gboolean needs_privileges; - gboolean needs_quorum; - enum cib_errors (*prepare)(xmlNode *, xmlNode**, const char **); - enum cib_errors (*cleanup)(int, xmlNode**, xmlNode**); - enum cib_errors (*fn)( - const char *, int, const char *, xmlNode *, - xmlNode*, xmlNode*, xmlNode**, xmlNode**); +typedef struct cib_operation_s { + const char *operation; + gboolean modifies_cib; + gboolean needs_privileges; + gboolean needs_quorum; + enum cib_errors (*prepare) (xmlNode *, xmlNode **, const char **); + enum cib_errors (*cleanup) (int, xmlNode **, xmlNode **); + enum cib_errors (*fn) (const char *, int, const char *, xmlNode *, + xmlNode *, xmlNode *, xmlNode **, xmlNode **); } cib_operation_t; -extern gboolean cib_client_connect(IPC_Channel *channel, gpointer user_data); -extern gboolean cib_null_callback (IPC_Channel *channel, gpointer user_data); -extern gboolean cib_rw_callback (IPC_Channel *channel, gpointer user_data); -extern gboolean cib_ro_callback (IPC_Channel *channel, gpointer user_data); +extern gboolean cib_client_connect(IPC_Channel * channel, gpointer user_data); +extern gboolean cib_null_callback(IPC_Channel * channel, gpointer user_data); +extern gboolean cib_rw_callback(IPC_Channel * channel, gpointer user_data); +extern gboolean cib_ro_callback(IPC_Channel * channel, gpointer user_data); -extern void cib_ha_peer_callback(HA_Message * msg, void* private_data); -extern void cib_peer_callback(xmlNode * msg, void* private_data); -extern void cib_client_status_callback(const char * node, const char * client, - const char * status, void * private); +extern void cib_ha_peer_callback(HA_Message * msg, void *private_data); +extern void cib_peer_callback(xmlNode * msg, void *private_data); +extern void cib_client_status_callback(const char *node, const char *client, + const char *status, void *private); #if SUPPORT_HEARTBEAT extern gboolean cib_ccm_dispatch(int fd, gpointer user_data); -extern void cib_ccm_msg_callback( - oc_ed_t event, void *cookie, size_t size, const void *data); +extern void cib_ccm_msg_callback(oc_ed_t event, void *cookie, size_t size, const void *data); #endif diff --git a/cib/cibio.h b/cib/cibio.h index 0153ed5932..e082bfdcc5 100644 --- a/cib/cibio.h +++ b/cib/cibio.h @@ -1,53 +1,52 @@ /* * 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 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef CIB_IO__H -#define CIB_IO__H +# define CIB_IO__H -#include -#include -#include +# include +# include +# include -#include -#include -#include +# include +# include +# include -#include +# include extern gboolean initialized; extern xmlNode *the_cib; extern xmlNode *node_search; extern xmlNode *resource_search; extern xmlNode *constraint_search; extern xmlNode *status_search; - + extern xmlNode *get_the_CIB(void); -extern int initializeCib(xmlNode *cib); +extern int initializeCib(xmlNode * cib); extern gboolean uninitializeCib(void); extern xmlNode *createEmptyCib(void); -extern gboolean verifyCibXml(xmlNode *cib); +extern gboolean verifyCibXml(xmlNode * cib); extern xmlNode *readCibXml(char *buffer); -extern xmlNode *readCibXmlFile( - const char *dir, const char *file, gboolean discard_status); +extern xmlNode *readCibXmlFile(const char *dir, const char *file, gboolean discard_status); extern int activateCibBuffer(char *buffer, const char *filename); -extern int activateCibXml(xmlNode *doc, gboolean to_disk, const char *op); +extern int activateCibXml(xmlNode * doc, gboolean to_disk, const char *op); /* extern xmlNode *server_get_cib_copy(void); */ #endif diff --git a/cib/cibmessages.h b/cib/cibmessages.h index 6fc8852a7d..8795e3784c 100644 --- a/cib/cibmessages.h +++ b/cib/cibmessages.h @@ -1,67 +1,68 @@ /* * 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 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef CIB_MESSAGES__H -#define CIB_MESSAGES__H +# define CIB_MESSAGES__H -#include -extern xmlNode *createCibRequest( - gboolean isLocal, const char *operation, const char *section, - const char *verbose, xmlNode *data); +# include +extern xmlNode *createCibRequest(gboolean isLocal, const char *operation, const char *section, + const char *verbose, xmlNode * data); -extern enum cib_errors -cib_process_shutdown_req( - const char *op, int options, const char *section, xmlNode *req, xmlNode *input, - xmlNode *existing_cib, xmlNode **result_cib, xmlNode **answer); +extern enum cib_errors cib_process_shutdown_req(const char *op, int options, const char *section, + xmlNode * req, xmlNode * input, xmlNode * existing_cib, + xmlNode ** result_cib, xmlNode ** answer); -extern enum cib_errors cib_process_default( - const char *op, int options, const char *section, xmlNode *req, xmlNode *input, - xmlNode *existing_cib, xmlNode **result_cib, xmlNode **answer); +extern enum cib_errors cib_process_default(const char *op, int options, const char *section, + xmlNode * req, xmlNode * input, xmlNode * existing_cib, + xmlNode ** result_cib, xmlNode ** answer); -extern enum cib_errors cib_process_quit( - const char *op, int options, const char *section, xmlNode *req, xmlNode *input, - xmlNode *existing_cib, xmlNode **result_cib, xmlNode **answer); +extern enum cib_errors cib_process_quit(const char *op, int options, const char *section, + xmlNode * req, xmlNode * input, xmlNode * existing_cib, + xmlNode ** result_cib, xmlNode ** answer); -extern enum cib_errors cib_process_ping( - const char *op, int options, const char *section, xmlNode *req, xmlNode *input, - xmlNode *existing_cib, xmlNode **result_cib, xmlNode **answer); +extern enum cib_errors cib_process_ping(const char *op, int options, const char *section, + xmlNode * req, xmlNode * input, xmlNode * existing_cib, + xmlNode ** result_cib, xmlNode ** answer); -extern enum cib_errors cib_process_readwrite( - const char *op, int options, const char *section, xmlNode *req, xmlNode *input, - xmlNode *existing_cib, xmlNode **result_cib, xmlNode **answer); +extern enum cib_errors cib_process_readwrite(const char *op, int options, const char *section, + xmlNode * req, xmlNode * input, xmlNode * existing_cib, + xmlNode ** result_cib, xmlNode ** answer); -extern enum cib_errors cib_process_replace_svr( - const char *op, int options, const char *section, xmlNode *req, xmlNode *input, - xmlNode *existing_cib, xmlNode **result_cib, xmlNode **answer); +extern enum cib_errors cib_process_replace_svr(const char *op, int options, const char *section, + xmlNode * req, xmlNode * input, + xmlNode * existing_cib, xmlNode ** result_cib, + xmlNode ** answer); -extern enum cib_errors cib_server_process_diff( - const char *op, int options, const char *section, xmlNode *req, xmlNode *input, - xmlNode *existing_cib, xmlNode **result_cib, xmlNode **answer); +extern enum cib_errors cib_server_process_diff(const char *op, int options, const char *section, + xmlNode * req, xmlNode * input, + xmlNode * existing_cib, xmlNode ** result_cib, + xmlNode ** answer); -extern enum cib_errors cib_process_sync( - const char *op, int options, const char *section, xmlNode *req, xmlNode *input, - xmlNode *existing_cib, xmlNode **result_cib, xmlNode **answer); +extern enum cib_errors cib_process_sync(const char *op, int options, const char *section, + xmlNode * req, xmlNode * input, xmlNode * existing_cib, + xmlNode ** result_cib, xmlNode ** answer); -extern enum cib_errors cib_process_sync_one( - const char *op, int options, const char *section, xmlNode *req, xmlNode *input, - xmlNode *existing_cib, xmlNode **result_cib, xmlNode **answer); +extern enum cib_errors cib_process_sync_one(const char *op, int options, const char *section, + xmlNode * req, xmlNode * input, xmlNode * existing_cib, + xmlNode ** result_cib, xmlNode ** answer); -extern enum cib_errors cib_process_delete_absolute( - const char *op, int options, const char *section, xmlNode *req, xmlNode *input, - xmlNode *existing_cib, xmlNode **result_cib, xmlNode **answer); +extern enum cib_errors cib_process_delete_absolute(const char *op, int options, const char *section, + xmlNode * req, xmlNode * input, + xmlNode * existing_cib, xmlNode ** result_cib, + xmlNode ** answer); #endif diff --git a/cib/common.h b/cib/common.h index c31c86a1e6..ca1e6a1c13 100644 --- a/cib/common.h +++ b/cib/common.h @@ -1,33 +1,31 @@ /* * 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 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include "../lib/cib/cib_private.h" -extern xmlNode *cib_msg_copy(xmlNode *msg, gboolean with_data); -extern xmlNode *cib_construct_reply(xmlNode *request, xmlNode *output, int rc); +extern xmlNode *cib_msg_copy(xmlNode * msg, gboolean with_data); +extern xmlNode *cib_construct_reply(xmlNode * request, xmlNode * output, int rc); extern enum cib_errors cib_get_operation_id(const char *op, int *operation); extern cib_op_t *cib_op_func(int call_type); extern gboolean cib_op_modifies(int call_type); -extern int cib_op_prepare( - int call_type, xmlNode *request, xmlNode **input, const char **section); -extern int cib_op_cleanup(int call_type, int options, xmlNode **input, xmlNode **output); -extern int cib_op_can_run( - int call_type, int call_options, gboolean privileged, gboolean global_update); - +extern int cib_op_prepare(int call_type, xmlNode * request, xmlNode ** input, const char **section); +extern int cib_op_cleanup(int call_type, int options, xmlNode ** input, xmlNode ** output); +extern int cib_op_can_run(int call_type, int call_options, gboolean privileged, + gboolean global_update); diff --git a/cib/notify.h b/cib/notify.h index 762f961fd6..3b16b174e5 100644 --- a/cib/notify.h +++ b/cib/notify.h @@ -1,40 +1,38 @@ /* * 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 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include #include #include #include #include extern FILE *msg_cib_strm; -extern void cib_pre_notify( - int options, const char *op, xmlNode *existing, xmlNode *update); +extern void cib_pre_notify(int options, const char *op, xmlNode * existing, xmlNode * update); -extern void cib_post_notify(int options, const char *op, xmlNode *update, - enum cib_errors result, xmlNode *new_obj); +extern void cib_post_notify(int options, const char *op, xmlNode * update, + enum cib_errors result, xmlNode * new_obj); +extern void cib_diff_notify(int options, const char *client, const char *call_id, const char *op, + xmlNode * update, enum cib_errors result, xmlNode * old_cib); -extern void cib_diff_notify( - int options, const char *client, const char *call_id, const char *op, - xmlNode *update, enum cib_errors result, xmlNode *old_cib); - -extern void cib_replace_notify(const char *origin, xmlNode *update, enum cib_errors result, xmlNode *diff); +extern void cib_replace_notify(const char *origin, xmlNode * update, enum cib_errors result, + xmlNode * diff); diff --git a/crmd/crmd.h b/crmd/crmd.h index fcdf766719..195723ed54 100644 --- a/crmd/crmd.h +++ b/crmd/crmd.h @@ -1,31 +1,31 @@ /* * 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 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef CRMD__H -#define CRMD__H +# define CRMD__H -#define SYS_NAME CRM_SYSTEM_CRMD -#define PID_FILE WORKING_DIR "/"SYS_NAME".pid" -#define DAEMON_LOG DEVEL_DIR"/"SYS_NAME".log" -#define DAEMON_DEBUG DEVEL_DIR"/"SYS_NAME".debug" +# define SYS_NAME CRM_SYSTEM_CRMD +# define PID_FILE WORKING_DIR "/"SYS_NAME".pid" +# define DAEMON_LOG DEVEL_DIR"/"SYS_NAME".log" +# define DAEMON_DEBUG DEVEL_DIR"/"SYS_NAME".debug" -extern GMainLoop *crmd_mainloop; +extern GMainLoop *crmd_mainloop; extern GHashTable *ipc_clients; extern void crmd_metadata(void); #endif diff --git a/crmd/crmd_callbacks.h b/crmd/crmd_callbacks.h index e2a2e4388a..89c18b7e68 100644 --- a/crmd/crmd_callbacks.h +++ b/crmd/crmd_callbacks.h @@ -1,64 +1,57 @@ /* * 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 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include #if SUPPORT_HEARTBEAT -extern void ccm_event_detail(const oc_ev_membership_t *oc, oc_ed_t event); +extern void ccm_event_detail(const oc_ev_membership_t * oc, oc_ed_t event); extern gboolean ccm_dispatch(int fd, gpointer user_data); -extern void crmd_ccm_msg_callback( - oc_ed_t event, void *cookie, size_t size, const void *data); -extern gboolean crmd_ha_msg_dispatch( - ll_cluster_t *cluster_conn, gpointer user_data); +extern void crmd_ccm_msg_callback(oc_ed_t event, void *cookie, size_t size, const void *data); +extern gboolean crmd_ha_msg_dispatch(ll_cluster_t * cluster_conn, gpointer user_data); #endif /* * Apparently returning TRUE means "stay connected, keep doing stuff". * Returning FALSE means "we're all done, close the connection" */ extern void crmd_ipc_connection_destroy(gpointer user_data); - -extern void crmd_ha_msg_callback( - HA_Message *hamsg, void* private_data); -extern gboolean crmd_ipc_msg_callback( - IPC_Channel *client, gpointer user_data); +extern void crmd_ha_msg_callback(HA_Message * hamsg, void *private_data); -extern gboolean crmd_ipc_msg_callback( - IPC_Channel *client, gpointer user_data); +extern gboolean crmd_ipc_msg_callback(IPC_Channel * client, gpointer user_data); -extern gboolean lrm_dispatch(IPC_Channel*src, gpointer user_data); +extern gboolean crmd_ipc_msg_callback(IPC_Channel * client, gpointer user_data); -extern void lrm_op_callback (lrm_op_t* op); +extern gboolean lrm_dispatch(IPC_Channel * src, gpointer user_data); -extern void crmd_ha_status_callback( - const char *node, const char * status, void* private_data); +extern void lrm_op_callback(lrm_op_t * op); -extern void crmd_client_status_callback( - const char * node, const char * client, const char * status, void * private); +extern void crmd_ha_status_callback(const char *node, const char *status, void *private_data); -extern void msg_ccm_join(const xmlNode *msg, void *foo); +extern void crmd_client_status_callback(const char *node, const char *client, const char *status, + void *private); -extern gboolean crmd_client_connect( - IPC_Channel *newclient, gpointer user_data); +extern void msg_ccm_join(const xmlNode * msg, void *foo); + +extern gboolean crmd_client_connect(IPC_Channel * newclient, gpointer user_data); extern void crmd_cib_connection_destroy(gpointer user_data); extern gboolean crm_fsa_trigger(gpointer user_data); -extern void ais_status_callback(enum crm_status_type type, crm_node_t *node, const void *data); +extern void ais_status_callback(enum crm_status_type type, crm_node_t * node, const void *data); diff --git a/crmd/crmd_fsa.h b/crmd/crmd_fsa.h index 62527cd16e..5d69b023d2 100755 --- a/crmd/crmd_fsa.h +++ b/crmd/crmd_fsa.h @@ -1,136 +1,131 @@ /* * 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 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef CRMD_FSA__H -#define CRMD_FSA__H +# define CRMD_FSA__H -#include +# include -#include -#include -#include -#include -#include -#include +# include +# include +# include +# include +# include +# include -#if SUPPORT_HEARTBEAT -extern ll_cluster_t *fsa_cluster_conn; -#endif +# if SUPPORT_HEARTBEAT +extern ll_cluster_t *fsa_cluster_conn; +# endif /* copy from struct client_child in heartbeat.h * * Plus a couple of other things */ struct crm_subsystem_s { - pid_t pid; /* Process id of child process */ - const char* name; /* executable name */ - const char* path; /* Command location */ - const char* command; /* Command with path */ - const char* args; /* Command arguments */ - crmd_client_t* client; /* Client connection object */ - - gboolean sent_kill; - IPC_Channel *ipc; /* How can we communicate with it */ - long long flag_connected; /* */ - long long flag_required; /* */ + pid_t pid; /* Process id of child process */ + const char *name; /* executable name */ + const char *path; /* Command location */ + const char *command; /* Command with path */ + const char *args; /* Command arguments */ + crmd_client_t *client; /* Client connection object */ + + gboolean sent_kill; + IPC_Channel *ipc; /* How can we communicate with it */ + long long flag_connected; /* */ + long long flag_required; /* */ }; typedef struct fsa_timer_s fsa_timer_t; -struct fsa_timer_s -{ - guint source_id; /* timer source id */ - int period_ms; /* timer period */ - enum crmd_fsa_input fsa_input; - gboolean (*callback)(gpointer data); - gboolean repeat; +struct fsa_timer_s { + guint source_id; /* timer source id */ + int period_ms; /* timer period */ + enum crmd_fsa_input fsa_input; + gboolean(*callback) (gpointer data); + gboolean repeat; }; enum fsa_data_type { - fsa_dt_none, - fsa_dt_ha_msg, - fsa_dt_xml, - fsa_dt_lrm, + fsa_dt_none, + fsa_dt_ha_msg, + fsa_dt_xml, + fsa_dt_lrm, }; - typedef struct fsa_data_s fsa_data_t; -struct fsa_data_s -{ - int id; - enum crmd_fsa_input fsa_input; - enum crmd_fsa_cause fsa_cause; - long long actions; - const char *origin; - void *data; - enum fsa_data_type data_type; +struct fsa_data_s { + int id; + enum crmd_fsa_input fsa_input; + enum crmd_fsa_cause fsa_cause; + long long actions; + const char *origin; + void *data; + enum fsa_data_type data_type; }; - - extern enum crmd_fsa_state s_crmd_fsa(enum crmd_fsa_cause cause); /* Global FSA stuff */ extern volatile gboolean do_fsa_stall; extern volatile enum crmd_fsa_state fsa_state; extern volatile long long fsa_input_register; extern volatile long long fsa_actions; -extern ll_lrm_t *fsa_lrm_conn; -extern cib_t *fsa_cib_conn; +extern ll_lrm_t *fsa_lrm_conn; +extern cib_t *fsa_cib_conn; -extern char *fsa_our_uname; -extern char *fsa_our_uuid; -extern char *fsa_pe_ref; /* the last invocation of the PE */ -extern char *fsa_our_dc; -extern char *fsa_our_dc_version; -extern GListPtr fsa_message_queue; +extern char *fsa_our_uname; +extern char *fsa_our_uuid; +extern char *fsa_pe_ref; /* the last invocation of the PE */ +extern char *fsa_our_dc; +extern char *fsa_our_dc_version; +extern GListPtr fsa_message_queue; -extern fsa_timer_t *election_trigger; /* */ -extern fsa_timer_t *election_timeout; /* */ -extern fsa_timer_t *shutdown_escalation_timer; /* */ +extern fsa_timer_t *election_trigger; /* */ +extern fsa_timer_t *election_timeout; /* */ +extern fsa_timer_t *shutdown_escalation_timer; /* */ extern fsa_timer_t *transition_timer; extern fsa_timer_t *integration_timer; extern fsa_timer_t *finalization_timer; extern fsa_timer_t *wait_timer; extern fsa_timer_t *recheck_timer; extern crm_trigger_t *fsa_source; extern crm_trigger_t *config_read; extern struct crm_subsystem_s *cib_subsystem; extern struct crm_subsystem_s *te_subsystem; extern struct crm_subsystem_s *pe_subsystem; extern GHashTable *welcomed_nodes; extern GHashTable *integrated_nodes; extern GHashTable *finalized_nodes; extern GHashTable *confirmed_nodes; extern GHashTable *crmd_peer_state; /* these two should be moved elsewhere... */ extern void do_update_cib_nodes(gboolean overwrite, const char *caller); extern gboolean do_dc_heartbeat(gpointer data); -#define AM_I_DC is_set(fsa_input_register, R_THE_DC) -#define AM_I_OPERATIONAL (is_set(fsa_input_register, R_STARTING)==FALSE) +# define AM_I_DC is_set(fsa_input_register, R_THE_DC) +# define AM_I_OPERATIONAL (is_set(fsa_input_register, R_STARTING)==FALSE) extern unsigned long long saved_ccm_membership_id; extern gboolean ever_had_quorum; -#include -#include +# include +# include #endif diff --git a/crmd/crmd_messages.h b/crmd/crmd_messages.h index 97a865ed5f..9993a9322e 100755 --- a/crmd/crmd_messages.h +++ b/crmd/crmd_messages.h @@ -1,115 +1,106 @@ /* * 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 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef XML_CRM_MESSAGES__H -#define XML_CRM_MESSAGES__H +# define XML_CRM_MESSAGES__H +# include +# include +# include +# include +# include -#include -#include -#include -#include -#include +extern void *fsa_typed_data_adv(fsa_data_t * fsa_data, enum fsa_data_type a_type, + const char *caller); -extern void *fsa_typed_data_adv( - fsa_data_t *fsa_data, enum fsa_data_type a_type, const char *caller); +# define fsa_typed_data(x) fsa_typed_data_adv(msg_data, x, __FUNCTION__) -#define fsa_typed_data(x) fsa_typed_data_adv(msg_data, x, __FUNCTION__) +extern void register_fsa_error_adv(enum crmd_fsa_cause cause, enum crmd_fsa_input input, + fsa_data_t * cur_data, void *new_data, const char *raised_from); -extern void register_fsa_error_adv( - enum crmd_fsa_cause cause, enum crmd_fsa_input input, - fsa_data_t *cur_data, void *new_data, const char *raised_from); +# define register_fsa_error(cause, input, new_data) register_fsa_error_adv(cause, input, msg_data, new_data, __FUNCTION__) -#define register_fsa_error(cause, input, new_data) register_fsa_error_adv(cause, input, msg_data, new_data, __FUNCTION__) - -extern int register_fsa_input_adv( - enum crmd_fsa_cause cause, enum crmd_fsa_input input, - void *data, long long with_actions, - gboolean prepend, const char *raised_from); +extern int register_fsa_input_adv(enum crmd_fsa_cause cause, enum crmd_fsa_input input, + void *data, long long with_actions, + gboolean prepend, const char *raised_from); extern void fsa_dump_queue(int log_level); -extern void route_message(enum crmd_fsa_cause cause, xmlNode *input); +extern void route_message(enum crmd_fsa_cause cause, xmlNode * input); -#define crmd_fsa_stall(cur_input) if(cur_input != NULL) { \ +# define crmd_fsa_stall(cur_input) if(cur_input != NULL) { \ register_fsa_input_adv( \ ((fsa_data_t*)cur_input)->fsa_cause, I_WAIT_FOR_EVENT, \ ((fsa_data_t*)cur_input)->data, action, TRUE, __FUNCTION__); \ } else { \ register_fsa_input_adv( \ C_FSA_INTERNAL, I_WAIT_FOR_EVENT, \ NULL, action, TRUE, __FUNCTION__); \ } \ -#define register_fsa_input(cause, input, data) register_fsa_input_adv(cause, input, data, A_NOTHING, FALSE, __FUNCTION__) +# define register_fsa_input(cause, input, data) register_fsa_input_adv(cause, input, data, A_NOTHING, FALSE, __FUNCTION__) -#define register_fsa_action(action) { \ +# define register_fsa_action(action) { \ fsa_actions |= action; \ if(fsa_source) { \ mainloop_set_trigger(fsa_source); \ } \ crm_debug("%s added action %s to the FSA", \ __FUNCTION__, fsa_action2string(action)); \ } +# define register_fsa_input_before(cause, input, data) register_fsa_input_adv(cause, input, data, A_NOTHING, TRUE, __FUNCTION__) -#define register_fsa_input_before(cause, input, data) register_fsa_input_adv(cause, input, data, A_NOTHING, TRUE, __FUNCTION__) - -#define register_fsa_input_later(cause, input, data) register_fsa_input_adv(cause, input, data, A_NOTHING, FALSE, __FUNCTION__) +# define register_fsa_input_later(cause, input, data) register_fsa_input_adv(cause, input, data, A_NOTHING, FALSE, __FUNCTION__) -void delete_fsa_input(fsa_data_t *fsa_data); +void delete_fsa_input(fsa_data_t * fsa_data); -GListPtr put_message(fsa_data_t *new_message); +GListPtr put_message(fsa_data_t * new_message); fsa_data_t *get_message(void); gboolean is_message(void); gboolean have_wait_message(void); -extern gboolean relay_message( - xmlNode *relay_message, gboolean originated_locally); +extern gboolean relay_message(xmlNode * relay_message, gboolean originated_locally); -extern gboolean crmd_ipc_msg_callback(IPC_Channel *client, gpointer user_data); +extern gboolean crmd_ipc_msg_callback(IPC_Channel * client, gpointer user_data); -extern void process_message( - xmlNode *msg, gboolean originated_locally,const char *src_node_name); +extern void process_message(xmlNode * msg, gboolean originated_locally, const char *src_node_name); -extern gboolean crm_dc_process_message(xmlNode *whole_message, - xmlNode *action, - const char *host_from, - const char *sys_from, - const char *sys_to, - const char *op, - gboolean dc_mode); +extern gboolean crm_dc_process_message(xmlNode * whole_message, + xmlNode * action, + const char *host_from, + const char *sys_from, + const char *sys_to, const char *op, gboolean dc_mode); -extern gboolean send_msg_via_ipc(xmlNode *msg, const char *sys); +extern gboolean send_msg_via_ipc(xmlNode * msg, const char *sys); extern gboolean add_pending_outgoing_reply(const char *originating_node_name, - const char *crm_msg_reference, - const char *sys_to, - const char *sys_from); + const char *crm_msg_reference, + const char *sys_to, const char *sys_from); -extern gboolean crmd_authorize_message(xmlNode *client_msg, crmd_client_t *curr_client); +extern gboolean crmd_authorize_message(xmlNode * client_msg, crmd_client_t * curr_client); -extern gboolean send_request(xmlNode *msg, char **msg_reference); +extern gboolean send_request(xmlNode * msg, char **msg_reference); -extern enum crmd_fsa_input handle_message(xmlNode *stored_msg); +extern enum crmd_fsa_input handle_message(xmlNode * stored_msg); -extern void lrm_op_callback(lrm_op_t* op); +extern void lrm_op_callback(lrm_op_t * op); extern void msg_queue_helper(void); -extern ha_msg_input_t *copy_ha_msg_input(ha_msg_input_t *orig); +extern ha_msg_input_t *copy_ha_msg_input(ha_msg_input_t * orig); #endif diff --git a/crmd/crmd_utils.h b/crmd/crmd_utils.h index 5a7118f7e7..1747394f86 100644 --- a/crmd/crmd_utils.h +++ b/crmd/crmd_utils.h @@ -1,101 +1,96 @@ /* * 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 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef CRMD_UTILS__H -#define CRMD_UTILS__H +# define CRMD_UTILS__H -#include -#include +# include +# include -#define CLIENT_EXIT_WAIT 30 -#define FAKE_TE_ID "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" +# define CLIENT_EXIT_WAIT 30 +# define FAKE_TE_ID "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" -extern void process_client_disconnect(crmd_client_t *curr_client); +extern void process_client_disconnect(crmd_client_t * curr_client); -#define fsa_cib_update(section, data, options, call_id, user_name) \ +# define fsa_cib_update(section, data, options, call_id, user_name) \ if(fsa_cib_conn != NULL) { \ call_id = fsa_cib_conn->cmds->delegated_variant_op( \ fsa_cib_conn, CIB_OP_MODIFY, NULL, section, data, \ NULL, options, user_name); \ \ } else { \ crm_err("No CIB connection available"); \ } -#define fsa_cib_anon_update(section, data, options) \ +# define fsa_cib_anon_update(section, data, options) \ if(fsa_cib_conn != NULL) { \ fsa_cib_conn->cmds->modify( \ fsa_cib_conn, section, data, options); \ \ } else { \ crm_err("No CIB connection available"); \ } - extern gboolean fsa_has_quorum; extern int last_peer_update; -extern gboolean crm_timer_stop (fsa_timer_t *timer); -extern gboolean crm_timer_start(fsa_timer_t *timer); +extern gboolean crm_timer_stop(fsa_timer_t * timer); +extern gboolean crm_timer_start(fsa_timer_t * timer); extern gboolean crm_timer_popped(gpointer data); -extern xmlNode *create_node_state( - const char *uname, const char *ha_state, const char *ccm_state, - const char *crmd_state, const char *join_state, const char *exp_state, - gboolean clear_shutdown, const char *src); +extern xmlNode *create_node_state(const char *uname, const char *ha_state, const char *ccm_state, + const char *crmd_state, const char *join_state, + const char *exp_state, gboolean clear_shutdown, const char *src); -extern void create_node_entry( - const char *uuid, const char *uname, const char *type); +extern void create_node_entry(const char *uuid, const char *uname, const char *type); -extern gboolean stop_subsystem ( - struct crm_subsystem_s *centry, gboolean force_quit); +extern gboolean stop_subsystem(struct crm_subsystem_s *centry, gboolean force_quit); extern gboolean start_subsystem(struct crm_subsystem_s *centry); -extern lrm_op_t *copy_lrm_op(const lrm_op_t *op); -extern lrm_rsc_t *copy_lrm_rsc(const lrm_rsc_t *rsc); +extern lrm_op_t *copy_lrm_op(const lrm_op_t * op); +extern lrm_rsc_t *copy_lrm_rsc(const lrm_rsc_t * rsc); extern void fsa_dump_actions(long long action, const char *text); -extern void fsa_dump_inputs( - int log_level, const char *text, long long input_register); +extern void fsa_dump_inputs(int log_level, const char *text, long long input_register); -extern gboolean update_dc(xmlNode *msg); +extern gboolean update_dc(xmlNode * msg); extern void erase_node_from_join(const char *node); extern void populate_cib_nodes(gboolean with_client_status); extern void crm_update_quorum(gboolean quorum, gboolean force_update); extern void erase_status_tag(const char *uname, const char *tag, int options); -extern void update_attrd(const char *host, const char *name, const char *value, const char *user_name); +extern void update_attrd(const char *host, const char *name, const char *value, + const char *user_name); -extern const char *get_timer_desc(fsa_timer_t *timer); +extern const char *get_timer_desc(fsa_timer_t * timer); -#define start_transition(state) do { \ +# define start_transition(state) do { \ switch(state) { \ case S_TRANSITION_ENGINE: \ register_fsa_action(A_TE_CANCEL); \ break; \ case S_POLICY_ENGINE: \ case S_IDLE: \ register_fsa_input(C_FSA_INTERNAL, I_PE_CALC, NULL); \ break; \ default: \ crm_debug("NOT starting a new transition in state %s", \ fsa_state2string(fsa_state)); \ break; \ } \ } while(0) - #endif diff --git a/crmd/fsa_defines.h b/crmd/fsa_defines.h index 86abbe425d..b991863523 100644 --- a/crmd/fsa_defines.h +++ b/crmd/fsa_defines.h @@ -1,478 +1,492 @@ /* * 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 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef FSA_DEFINES__H -#define FSA_DEFINES__H +# define FSA_DEFINES__H /*====================================== * States the DC/CRMd can be in *======================================*/ enum crmd_fsa_state { - S_IDLE = 0, /* Nothing happening */ - - S_ELECTION, /* Take part in the election algorithm as - * described below - */ - S_INTEGRATION, /* integrate that status of new nodes (which is - * all of them if we have just been elected DC) - * to form a complete and up-to-date picture of - * the CIB - */ - S_FINALIZE_JOIN,/* integrate that status of new nodes (which is - * all of them if we have just been elected DC) - * to form a complete and up-to-date picture of - * the CIB - */ - S_NOT_DC, /* we are in crmd/slave mode */ - S_POLICY_ENGINE,/* Determin the next stable state of the cluster - */ - S_RECOVERY, /* Something bad happened, check everything is ok - * before continuing and attempt to recover if - * required - */ - S_RELEASE_DC, /* we were the DC, but now we arent anymore, - * possibly by our own request, and we should - * release all unnecessary sub-systems, finish - * any pending actions, do general cleanup and - * unset anything that makes us think we are - * special :) - */ - S_STARTING, /* we are just starting out */ - S_PENDING, /* we are not a full/active member yet */ - S_STOPPING, /* We are in the final stages of shutting down */ - S_TERMINATE, /* We are going to shutdown, this is the equiv of - * "Sending TERM signal to all processes" in Linux - * and in worst case scenarios could be considered - * a self STONITH - */ - S_TRANSITION_ENGINE,/* Attempt to make the calculated next stable - * state of the cluster a reality - */ - - S_HALT, /* Freeze - dont do anything - * Something ad happened that needs the admin to fix - * Wait for I_ELECTION - */ - - /* ----------- Last input found in table is above ---------- */ - S_ILLEGAL /* This is an illegal FSA state */ - /* (must be last) */ + S_IDLE = 0, /* Nothing happening */ + + S_ELECTION, /* Take part in the election algorithm as + * described below + */ + S_INTEGRATION, /* integrate that status of new nodes (which is + * all of them if we have just been elected DC) + * to form a complete and up-to-date picture of + * the CIB + */ + S_FINALIZE_JOIN, /* integrate that status of new nodes (which is + * all of them if we have just been elected DC) + * to form a complete and up-to-date picture of + * the CIB + */ + S_NOT_DC, /* we are in crmd/slave mode */ + S_POLICY_ENGINE, /* Determin the next stable state of the cluster + */ + S_RECOVERY, /* Something bad happened, check everything is ok + * before continuing and attempt to recover if + * required + */ + S_RELEASE_DC, /* we were the DC, but now we arent anymore, + * possibly by our own request, and we should + * release all unnecessary sub-systems, finish + * any pending actions, do general cleanup and + * unset anything that makes us think we are + * special :) + */ + S_STARTING, /* we are just starting out */ + S_PENDING, /* we are not a full/active member yet */ + S_STOPPING, /* We are in the final stages of shutting down */ + S_TERMINATE, /* We are going to shutdown, this is the equiv of + * "Sending TERM signal to all processes" in Linux + * and in worst case scenarios could be considered + * a self STONITH + */ + S_TRANSITION_ENGINE, /* Attempt to make the calculated next stable + * state of the cluster a reality + */ + + S_HALT, /* Freeze - dont do anything + * Something ad happened that needs the admin to fix + * Wait for I_ELECTION + */ + + /* ----------- Last input found in table is above ---------- */ + S_ILLEGAL /* This is an illegal FSA state */ + /* (must be last) */ }; -#define MAXSTATE S_ILLEGAL + +# define MAXSTATE S_ILLEGAL /* A state diagram can be constructed from the dc_fsa.dot with the following command: dot -Tpng crmd_fsa.dot > crmd_fsa.png Description: Once we start and do some basic sanity checks, we go into the S_NOT_DC state and await instructions from the DC or input from the CCM which indicates the election algorithm needs to run. If the election algorithm is triggered we enter the S_ELECTION state from where we can either go back to the S_NOT_DC state or progress to the S_INTEGRATION state (or S_RELEASE_DC if we used to be the DC but arent anymore). The election algorithm has been adapted from http://www.cs.indiana.edu/cgi-bin/techreports/TRNNN.cgi?trnum=TR521 Loosly known as the Bully Algorithm, its major points are: - Election is initiated by any node (N) notices that the coordinator is no longer responding - Concurrent multiple elections are possible - Algorithm + N sends ELECTION messages to all nodes that occur earlier in the CCM's membership list. + If no one responds, N wins and becomes coordinator + N sends out COORDINATOR messages to all other nodes in the partition + If one of higher-ups answers, it takes over. N is done. Once the election is complete, if we are the DC, we enter the S_INTEGRATION state which is a DC-in-waiting style state. We are the DC, but we shouldnt do anything yet because we may not have an up-to-date picture of the cluster. There may of course be times when this fails, so we should go back to the S_RECOVERY stage and check everything is ok. We may also end up here if a new node came online, since each node is authorative on itself and we would want to incorporate its information into the CIB. Once we have the latest CIB, we then enter the S_POLICY_ENGINE state where invoke the Policy Engine. It is possible that between invoking the Policy Engine and recieving an answer, that we recieve more input. In this case we would discard the orginal result and invoke it again. Once we are satisfied with the output from the Policy Engine we enter S_TRANSITION_ENGINE and feed the Policy Engine's output to the Transition Engine who attempts to make the Policy Engine's calculation a reality. If the transition completes successfully, we enter S_IDLE, otherwise we go back to S_POLICY_ENGINE with the current unstable state and try again. Of course we may be asked to shutdown at any time, however we must progress to S_NOT_DC before doing so. Once we have handed over DC duties to another node, we can then shut down like everyone else, that is by asking the DC for permission and waiting it to take all our resources away. The case where we are the DC and the only node in the cluster is a special case and handled as an escalation which takes us to S_SHUTDOWN. Similarly if any other point in the shutdown fails or stalls, this is escalated and we end up in S_TERMINATE. At any point, the CRMd/DC can relay messages for its sub-systems, but outbound messages (from sub-systems) should probably be blocked until S_INTEGRATION (for the DC case) or the join protocol has completed (for the CRMd case) */ /*====================================== * * Inputs/Events/Stimuli to be given to the finite state machine * * Some of these a true events, and others a synthesised based on * the "register" (see below) and the contents or source of messages. * * At this point, my plan is to have a loop of some sort that keeps * going until recieving I_NULL * *======================================*/ enum crmd_fsa_input { /* 0 */ - I_NULL, /* Nothing happened */ + I_NULL, /* Nothing happened */ /* 1 */ - - I_CIB_OP, /* An update to the CIB occurred */ - I_CIB_UPDATE, /* An update to the CIB occurred */ - I_DC_TIMEOUT, /* We have lost communication with the DC */ - I_ELECTION, /* Someone started an election */ - I_PE_CALC, /* The Policy Engine needs to be invoked */ - I_RELEASE_DC, /* The election completed and we were not - * elected, but we were the DC beforehand - */ - I_ELECTION_DC, /* The election completed and we were (re-)elected - * DC - */ - I_ERROR, /* Something bad happened (more serious than - * I_FAIL) and may not have been due to the action - * being performed. For example, we may have lost - * our connection to the CIB. - */ + + I_CIB_OP, /* An update to the CIB occurred */ + I_CIB_UPDATE, /* An update to the CIB occurred */ + I_DC_TIMEOUT, /* We have lost communication with the DC */ + I_ELECTION, /* Someone started an election */ + I_PE_CALC, /* The Policy Engine needs to be invoked */ + I_RELEASE_DC, /* The election completed and we were not + * elected, but we were the DC beforehand + */ + I_ELECTION_DC, /* The election completed and we were (re-)elected + * DC + */ + I_ERROR, /* Something bad happened (more serious than + * I_FAIL) and may not have been due to the action + * being performed. For example, we may have lost + * our connection to the CIB. + */ /* 9 */ - I_FAIL, /* The action failed to complete successfully */ - I_INTEGRATED, - I_FINALIZED, - I_NODE_JOIN, /* A node has entered the cluster */ - I_NOT_DC, /* We are not and were not the DC before or after - * the current operation or state - */ - I_RECOVERED, /* The recovery process completed successfully */ - I_RELEASE_FAIL, /* We could not give up DC status for some reason - */ - I_RELEASE_SUCCESS, /* We are no longer the DC */ - I_RESTART, /* The current set of actions needs to be - * restarted - */ - I_TE_SUCCESS, /* Some non-resource, non-ccm action is required - * of us, eg. ping - */ + I_FAIL, /* The action failed to complete successfully */ + I_INTEGRATED, + I_FINALIZED, + I_NODE_JOIN, /* A node has entered the cluster */ + I_NOT_DC, /* We are not and were not the DC before or after + * the current operation or state + */ + I_RECOVERED, /* The recovery process completed successfully */ + I_RELEASE_FAIL, /* We could not give up DC status for some reason + */ + I_RELEASE_SUCCESS, /* We are no longer the DC */ + I_RESTART, /* The current set of actions needs to be + * restarted + */ + I_TE_SUCCESS, /* Some non-resource, non-ccm action is required + * of us, eg. ping + */ /* 20 */ - I_ROUTER, /* Do our job as router and forward this to the - * right place - */ - I_SHUTDOWN, /* We are asking to shutdown */ - I_STOP, /* We have been told to shutdown */ - I_TERMINATE, /* Actually exit */ - I_STARTUP, - I_PE_SUCCESS, /* The action completed successfully */ - - I_JOIN_OFFER, /* The DC is offering membership */ - I_JOIN_REQUEST, /* The client is requesting membership */ - I_JOIN_RESULT, /* If not the DC: The result of a join request - * Else: A client is responding with its local state info - */ - - I_WAIT_FOR_EVENT, /* we may be waiting for an async task to "happen" - * and until it does, we cant do anything else - */ - - I_DC_HEARTBEAT, /* The DC is telling us that it is alive and well */ - - - I_LRM_EVENT, + I_ROUTER, /* Do our job as router and forward this to the + * right place + */ + I_SHUTDOWN, /* We are asking to shutdown */ + I_STOP, /* We have been told to shutdown */ + I_TERMINATE, /* Actually exit */ + I_STARTUP, + I_PE_SUCCESS, /* The action completed successfully */ + + I_JOIN_OFFER, /* The DC is offering membership */ + I_JOIN_REQUEST, /* The client is requesting membership */ + I_JOIN_RESULT, /* If not the DC: The result of a join request + * Else: A client is responding with its local state info + */ + + I_WAIT_FOR_EVENT, /* we may be waiting for an async task to "happen" + * and until it does, we cant do anything else + */ + + I_DC_HEARTBEAT, /* The DC is telling us that it is alive and well */ + + I_LRM_EVENT, /* 30 */ - I_PENDING, - I_HALT, - - /* ------------ Last input found in table is above ----------- */ - I_ILLEGAL /* This is an illegal value for an FSA input */ - /* (must be last) */ + I_PENDING, + I_HALT, + + /* ------------ Last input found in table is above ----------- */ + I_ILLEGAL /* This is an illegal value for an FSA input */ + /* (must be last) */ }; -#define MAXINPUT I_ILLEGAL -#define I_MESSAGE I_ROUTER +# define MAXINPUT I_ILLEGAL + +# define I_MESSAGE I_ROUTER /*====================================== * * actions * * Some of the actions below will always occur together for now, but I can * forsee that this may not always be the case. So I've spilt them up so * that if they ever do need to be called independantly in the future, it * wont be a problem. * * For example, separating A_LRM_CONNECT from A_STARTUP might be useful * if we ever try to recover from a faulty or disconnected LRM. * *======================================*/ - - /* Dont do anything */ -#define A_NOTHING 0x0000000000000000ULL + /* Dont do anything */ +# define A_NOTHING 0x0000000000000000ULL /* -- Startup actions -- */ - /* Hook to perform any actions (other than starting the CIB, - * connecting to HA or the CCM) that might be needed as part - * of the startup. - */ -#define A_STARTUP 0x0000000000000001ULL - /* Hook to perform any actions that might be needed as part - * after startup is successful. - */ -#define A_STARTED 0x0000000000000002ULL - /* Connect to Heartbeat */ -#define A_HA_CONNECT 0x0000000000000004ULL -#define A_HA_DISCONNECT 0x0000000000000008ULL - -#define A_INTEGRATE_TIMER_START 0x0000000000000010ULL -#define A_INTEGRATE_TIMER_STOP 0x0000000000000020ULL -#define A_FINALIZE_TIMER_START 0x0000000000000040ULL -#define A_FINALIZE_TIMER_STOP 0x0000000000000080ULL + /* Hook to perform any actions (other than starting the CIB, + * connecting to HA or the CCM) that might be needed as part + * of the startup. + */ +# define A_STARTUP 0x0000000000000001ULL + /* Hook to perform any actions that might be needed as part + * after startup is successful. + */ +# define A_STARTED 0x0000000000000002ULL + /* Connect to Heartbeat */ +# define A_HA_CONNECT 0x0000000000000004ULL +# define A_HA_DISCONNECT 0x0000000000000008ULL + +# define A_INTEGRATE_TIMER_START 0x0000000000000010ULL +# define A_INTEGRATE_TIMER_STOP 0x0000000000000020ULL +# define A_FINALIZE_TIMER_START 0x0000000000000040ULL +# define A_FINALIZE_TIMER_STOP 0x0000000000000080ULL /* -- Election actions -- */ -#define A_DC_TIMER_START 0x0000000000000100ULL -#define A_DC_TIMER_STOP 0x0000000000000200ULL -#define A_ELECTION_COUNT 0x0000000000000400ULL -#define A_ELECTION_VOTE 0x0000000000000800ULL +# define A_DC_TIMER_START 0x0000000000000100ULL +# define A_DC_TIMER_STOP 0x0000000000000200ULL +# define A_ELECTION_COUNT 0x0000000000000400ULL +# define A_ELECTION_VOTE 0x0000000000000800ULL -#define A_ELECTION_START 0x0000000000001000ULL +# define A_ELECTION_START 0x0000000000001000ULL /* -- Message processing -- */ - /* Process the queue of requests */ -#define A_MSG_PROCESS 0x0000000000002000ULL - /* Send the message to the correct recipient */ -#define A_MSG_ROUTE 0x0000000000004000ULL + /* Process the queue of requests */ +# define A_MSG_PROCESS 0x0000000000002000ULL + /* Send the message to the correct recipient */ +# define A_MSG_ROUTE 0x0000000000004000ULL - /* Send a welcome message to new node(s) */ -#define A_DC_JOIN_OFFER_ONE 0x0000000000008000ULL + /* Send a welcome message to new node(s) */ +# define A_DC_JOIN_OFFER_ONE 0x0000000000008000ULL /* -- Server Join protocol actions -- */ - /* Send a welcome message to all nodes */ -#define A_DC_JOIN_OFFER_ALL 0x0000000000010000ULL - /* Process the remote node's ack of our join message */ -#define A_DC_JOIN_PROCESS_REQ 0x0000000000020000ULL - /* Send out the reults of the Join phase */ -#define A_DC_JOIN_FINALIZE 0x0000000000040000ULL - /* Send out the reults of the Join phase */ -#define A_DC_JOIN_PROCESS_ACK 0x0000000000080000ULL - + /* Send a welcome message to all nodes */ +# define A_DC_JOIN_OFFER_ALL 0x0000000000010000ULL + /* Process the remote node's ack of our join message */ +# define A_DC_JOIN_PROCESS_REQ 0x0000000000020000ULL + /* Send out the reults of the Join phase */ +# define A_DC_JOIN_FINALIZE 0x0000000000040000ULL + /* Send out the reults of the Join phase */ +# define A_DC_JOIN_PROCESS_ACK 0x0000000000080000ULL /* -- Client Join protocol actions -- */ -#define A_CL_JOIN_QUERY 0x0000000000100000ULL -#define A_CL_JOIN_ANNOUNCE 0x0000000000200000ULL - /* Request membership to the DC list */ -#define A_CL_JOIN_REQUEST 0x0000000000400000ULL - /* Did the DC accept or reject the request */ -#define A_CL_JOIN_RESULT 0x0000000000800000ULL - +# define A_CL_JOIN_QUERY 0x0000000000100000ULL +# define A_CL_JOIN_ANNOUNCE 0x0000000000200000ULL + /* Request membership to the DC list */ +# define A_CL_JOIN_REQUEST 0x0000000000400000ULL + /* Did the DC accept or reject the request */ +# define A_CL_JOIN_RESULT 0x0000000000800000ULL /* -- Recovery, DC start/stop -- */ - /* Something bad happened, try to recover */ -#define A_RECOVER 0x0000000001000000ULL - /* Hook to perform any actions (apart from starting, the TE, PE - * and gathering the latest CIB) that might be necessary before - * giving up the responsibilities of being the DC. - */ -#define A_DC_RELEASE 0x0000000002000000ULL - /* */ -#define A_DC_RELEASED 0x0000000004000000ULL - /* Hook to perform any actions (apart from starting, the TE, PE - * and gathering the latest CIB) that might be necessary before - * taking over the responsibilities of being the DC. - */ -#define A_DC_TAKEOVER 0x0000000008000000ULL + /* Something bad happened, try to recover */ +# define A_RECOVER 0x0000000001000000ULL + /* Hook to perform any actions (apart from starting, the TE, PE + * and gathering the latest CIB) that might be necessary before + * giving up the responsibilities of being the DC. + */ +# define A_DC_RELEASE 0x0000000002000000ULL + /* */ +# define A_DC_RELEASED 0x0000000004000000ULL + /* Hook to perform any actions (apart from starting, the TE, PE + * and gathering the latest CIB) that might be necessary before + * taking over the responsibilities of being the DC. + */ +# define A_DC_TAKEOVER 0x0000000008000000ULL /* -- Shutdown actions -- */ -#define A_SHUTDOWN 0x0000000010000000ULL -#define A_STOP 0x0000000020000000ULL -#define A_EXIT_0 0x0000000040000000ULL -#define A_EXIT_1 0x0000000080000000ULL +# define A_SHUTDOWN 0x0000000010000000ULL +# define A_STOP 0x0000000020000000ULL +# define A_EXIT_0 0x0000000040000000ULL +# define A_EXIT_1 0x0000000080000000ULL -#define A_SHUTDOWN_REQ 0x0000000100000000ULL -#define A_ELECTION_CHECK 0x0000000200000000ULL -#define A_DC_JOIN_FINAL 0x0000000400000000ULL +# define A_SHUTDOWN_REQ 0x0000000100000000ULL +# define A_ELECTION_CHECK 0x0000000200000000ULL +# define A_DC_JOIN_FINAL 0x0000000400000000ULL /* -- CCM actions -- */ -#define A_CCM_CONNECT 0x0000001000000000ULL -#define A_CCM_DISCONNECT 0x0000002000000000ULL +# define A_CCM_CONNECT 0x0000001000000000ULL +# define A_CCM_DISCONNECT 0x0000002000000000ULL /* -- CIB actions -- */ -#define A_CIB_START 0x0000020000000000ULL -#define A_CIB_STOP 0x0000040000000000ULL +# define A_CIB_START 0x0000020000000000ULL +# define A_CIB_STOP 0x0000040000000000ULL /* -- Transition Engine actions -- */ - /* Attempt to reach the newly calculated cluster state. This is - * only called once per transition (except if it is asked to - * stop the transition or start a new one). - * Once given a cluster state to reach, the TE will determin - * tasks that can be performed in parallel, execute them, wait - * for replies and then determin the next set until the new - * state is reached or no further tasks can be taken. - */ -#define A_TE_INVOKE 0x0000100000000000ULL -#define A_TE_START 0x0000200000000000ULL -#define A_TE_STOP 0x0000400000000000ULL -#define A_TE_CANCEL 0x0000800000000000ULL -#define A_TE_HALT 0x0001000000000000ULL - + /* Attempt to reach the newly calculated cluster state. This is + * only called once per transition (except if it is asked to + * stop the transition or start a new one). + * Once given a cluster state to reach, the TE will determin + * tasks that can be performed in parallel, execute them, wait + * for replies and then determin the next set until the new + * state is reached or no further tasks can be taken. + */ +# define A_TE_INVOKE 0x0000100000000000ULL +# define A_TE_START 0x0000200000000000ULL +# define A_TE_STOP 0x0000400000000000ULL +# define A_TE_CANCEL 0x0000800000000000ULL +# define A_TE_HALT 0x0001000000000000ULL /* -- Policy Engine actions -- */ - /* Calculate the next state for the cluster. This is only - * invoked once per needed calculation. - */ -#define A_PE_INVOKE 0x0002000000000000ULL -#define A_PE_START 0x0004000000000000ULL -#define A_PE_STOP 0x0008000000000000ULL + /* Calculate the next state for the cluster. This is only + * invoked once per needed calculation. + */ +# define A_PE_INVOKE 0x0002000000000000ULL +# define A_PE_START 0x0004000000000000ULL +# define A_PE_STOP 0x0008000000000000ULL /* -- Misc actions -- */ - /* Add a system generate "block" so that resources arent moved - * to or are activly moved away from the affected node. This - * way we can return quickly even if busy with other things. - */ -#define A_NODE_BLOCK 0x0010000000000000ULL - /* Update our information in the local CIB */ -#define A_UPDATE_NODESTATUS 0x0020000000000000ULL -#define A_CIB_BUMPGEN 0x0040000000000000ULL -#define A_READCONFIG 0x0080000000000000ULL + /* Add a system generate "block" so that resources arent moved + * to or are activly moved away from the affected node. This + * way we can return quickly even if busy with other things. + */ +# define A_NODE_BLOCK 0x0010000000000000ULL + /* Update our information in the local CIB */ +# define A_UPDATE_NODESTATUS 0x0020000000000000ULL +# define A_CIB_BUMPGEN 0x0040000000000000ULL +# define A_READCONFIG 0x0080000000000000ULL /* -- LRM Actions -- */ - /* Connect to the Local Resource Manager */ -#define A_LRM_CONNECT 0x0100000000000000ULL - /* Disconnect from the Local Resource Manager */ -#define A_LRM_DISCONNECT 0x0200000000000000ULL -#define A_LRM_INVOKE 0x0400000000000000ULL -#define A_LRM_EVENT 0x0800000000000000ULL + /* Connect to the Local Resource Manager */ +# define A_LRM_CONNECT 0x0100000000000000ULL + /* Disconnect from the Local Resource Manager */ +# define A_LRM_DISCONNECT 0x0200000000000000ULL +# define A_LRM_INVOKE 0x0400000000000000ULL +# define A_LRM_EVENT 0x0800000000000000ULL /* -- Logging actions -- */ -#define A_LOG 0x1000000000000000ULL -#define A_ERROR 0x2000000000000000ULL -#define A_WARN 0x4000000000000000ULL - -#define O_EXIT (A_SHUTDOWN|A_STOP|A_CCM_DISCONNECT|A_LRM_DISCONNECT|A_HA_DISCONNECT|A_EXIT_0|A_CIB_STOP) -#define O_RELEASE (A_DC_TIMER_STOP|A_DC_RELEASE|A_PE_STOP|A_TE_STOP|A_DC_RELEASED) -#define O_PE_RESTART (A_PE_START|A_PE_STOP) -#define O_TE_RESTART (A_TE_START|A_TE_STOP) -#define O_CIB_RESTART (A_CIB_START|A_CIB_STOP) -#define O_DC_TIMER_RESTART (A_DC_TIMER_STOP|A_DC_TIMER_START) +# define A_LOG 0x1000000000000000ULL +# define A_ERROR 0x2000000000000000ULL +# define A_WARN 0x4000000000000000ULL + +# define O_EXIT (A_SHUTDOWN|A_STOP|A_CCM_DISCONNECT|A_LRM_DISCONNECT|A_HA_DISCONNECT|A_EXIT_0|A_CIB_STOP) +# define O_RELEASE (A_DC_TIMER_STOP|A_DC_RELEASE|A_PE_STOP|A_TE_STOP|A_DC_RELEASED) +# define O_PE_RESTART (A_PE_START|A_PE_STOP) +# define O_TE_RESTART (A_TE_START|A_TE_STOP) +# define O_CIB_RESTART (A_CIB_START|A_CIB_STOP) +# define O_DC_TIMER_RESTART (A_DC_TIMER_STOP|A_DC_TIMER_START) /*====================================== * * "register" contents * * Things we may want to remember regardless of which state we are in. * * These also count as inputs for synthesizing I_* * *======================================*/ -#define R_THE_DC 0x00000001ULL /* Are we the DC? */ -#define R_STARTING 0x00000002ULL /* Are we starting up? */ -#define R_SHUTDOWN 0x00000004ULL /* Are we trying to shut down? */ -#define R_STAYDOWN 0x00000008ULL /* Should we restart? */ - -#define R_JOIN_OK 0x00000010ULL /* Have we completed the join process */ -#define R_READ_CONFIG 0x00000040ULL -#define R_INVOKE_PE 0x00000080ULL /* Does the PE needed to be invoked at - the next appropriate point? */ - -#define R_CIB_CONNECTED 0x00000100ULL /* Is the CIB connected? */ -#define R_PE_CONNECTED 0x00000200ULL /* Is the Policy Engine connected? */ -#define R_TE_CONNECTED 0x00000400ULL /* Is the Transition Engine connected? */ -#define R_LRM_CONNECTED 0x00000800ULL /* Is the Local Resource Manager - connected? */ - -#define R_CIB_REQUIRED 0x00001000ULL /* Is the CIB required? */ -#define R_PE_REQUIRED 0x00002000ULL /* Is the Policy Engine required? */ -#define R_TE_REQUIRED 0x00004000ULL /* Is the Transition Engine required? */ -#define R_ST_REQUIRED 0x00008000ULL /* Is the Stonith daemon required? */ - -#define R_CIB_DONE 0x00010000ULL /* Have we calculated the CIB? */ -#define R_HAVE_CIB 0x00020000ULL /* Do we have an up-to-date CIB */ -#define R_CIB_ASKED 0x00040000ULL /* Have we asked for an up-to-date CIB */ - -#define R_CCM_DATA 0x00100000ULL /* Have we got CCM data yet */ -#define R_PEER_DATA 0x00200000ULL /* Have we got T_CL_STATUS data yet */ - -#define R_HA_DISCONNECTED 0x00400000ULL /* did we sign out of our own accord */ -#define R_CCM_DISCONNECTED 0x00800000ULL /* did we sign out of our own accord */ - -#define R_REQ_PEND 0x01000000ULL /* Are there Requests waiting for - processing? */ -#define R_PE_PEND 0x02000000ULL /* Has the PE been invoked and we're - awaiting a reply? */ -#define R_TE_PEND 0x04000000ULL /* Has the TE been invoked and we're - awaiting completion? */ -#define R_RESP_PEND 0x08000000ULL /* Do we have clients waiting on a - response? if so perhaps we shouldnt - stop yet */ - -#define R_IN_TRANSITION 0x10000000ULL /* */ -#define R_SENT_RSC_STOP 0x20000000ULL /* Have we sent a stop action to all - * resources in preparation for - * shutting down */ - -#define R_IN_RECOVERY 0x80000000ULL - -enum crmd_fsa_cause -{ - C_UNKNOWN = 0, - C_STARTUP, - C_IPC_MESSAGE, - C_HA_MESSAGE, - C_CCM_CALLBACK, - C_CRMD_STATUS_CALLBACK, - C_LRM_OP_CALLBACK, - C_LRM_MONITOR_CALLBACK, - C_TIMER_POPPED, - C_SHUTDOWN, - C_HEARTBEAT_FAILED, - C_SUBSYSTEM_CONNECT, - C_HA_DISCONNECT, - C_FSA_INTERNAL, - C_ILLEGAL +# define R_THE_DC 0x00000001ULL + /* Are we the DC? */ +# define R_STARTING 0x00000002ULL + /* Are we starting up? */ +# define R_SHUTDOWN 0x00000004ULL + /* Are we trying to shut down? */ +# define R_STAYDOWN 0x00000008ULL + /* Should we restart? */ + +# define R_JOIN_OK 0x00000010ULL /* Have we completed the join process */ +# define R_READ_CONFIG 0x00000040ULL +# define R_INVOKE_PE 0x00000080ULL + /* Does the PE needed to be invoked at + the next appropriate point? */ + +# define R_CIB_CONNECTED 0x00000100ULL + /* Is the CIB connected? */ +# define R_PE_CONNECTED 0x00000200ULL + /* Is the Policy Engine connected? */ +# define R_TE_CONNECTED 0x00000400ULL + /* Is the Transition Engine connected? */ +# define R_LRM_CONNECTED 0x00000800ULL + /* Is the Local Resource Manager + connected? */ + +# define R_CIB_REQUIRED 0x00001000ULL + /* Is the CIB required? */ +# define R_PE_REQUIRED 0x00002000ULL + /* Is the Policy Engine required? */ +# define R_TE_REQUIRED 0x00004000ULL + /* Is the Transition Engine required? */ +# define R_ST_REQUIRED 0x00008000ULL + /* Is the Stonith daemon required? */ + +# define R_CIB_DONE 0x00010000ULL + /* Have we calculated the CIB? */ +# define R_HAVE_CIB 0x00020000ULL /* Do we have an up-to-date CIB */ +# define R_CIB_ASKED 0x00040000ULL /* Have we asked for an up-to-date CIB */ + +# define R_CCM_DATA 0x00100000ULL /* Have we got CCM data yet */ +# define R_PEER_DATA 0x00200000ULL /* Have we got T_CL_STATUS data yet */ + +# define R_HA_DISCONNECTED 0x00400000ULL /* did we sign out of our own accord */ +# define R_CCM_DISCONNECTED 0x00800000ULL /* did we sign out of our own accord */ + +# define R_REQ_PEND 0x01000000ULL + /* Are there Requests waiting for + processing? */ +# define R_PE_PEND 0x02000000ULL + /* Has the PE been invoked and we're + awaiting a reply? */ +# define R_TE_PEND 0x04000000ULL + /* Has the TE been invoked and we're + awaiting completion? */ +# define R_RESP_PEND 0x08000000ULL + /* Do we have clients waiting on a + response? if so perhaps we shouldnt + stop yet */ + +# define R_IN_TRANSITION 0x10000000ULL + /* */ +# define R_SENT_RSC_STOP 0x20000000ULL /* Have we sent a stop action to all + * resources in preparation for + * shutting down */ + +# define R_IN_RECOVERY 0x80000000ULL + +enum crmd_fsa_cause { + C_UNKNOWN = 0, + C_STARTUP, + C_IPC_MESSAGE, + C_HA_MESSAGE, + C_CCM_CALLBACK, + C_CRMD_STATUS_CALLBACK, + C_LRM_OP_CALLBACK, + C_LRM_MONITOR_CALLBACK, + C_TIMER_POPPED, + C_SHUTDOWN, + C_HEARTBEAT_FAILED, + C_SUBSYSTEM_CONNECT, + C_HA_DISCONNECT, + C_FSA_INTERNAL, + C_ILLEGAL }; extern const char *fsa_input2string(enum crmd_fsa_input input); extern const char *fsa_state2string(enum crmd_fsa_state state); extern const char *fsa_cause2string(enum crmd_fsa_cause cause); extern const char *fsa_action2string(long long action); - #endif diff --git a/crmd/fsa_matrix.h b/crmd/fsa_matrix.h index 1dd87a0878..ab7b35ece9 100644 --- a/crmd/fsa_matrix.h +++ b/crmd/fsa_matrix.h @@ -1,1230 +1,1231 @@ /* * 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 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef XML_FSA_MATRIX__H -#define XML_FSA_MATRIX__H +# define XML_FSA_MATRIX__H /* * The state transition table. The rows are inputs, and * the columns are states. */ -const enum crmd_fsa_state crmd_fsa_state [MAXINPUT][MAXSTATE] = -{ +const enum crmd_fsa_state crmd_fsa_state[MAXINPUT][MAXSTATE] = { /* Got an I_NULL */ - { - /* S_IDLE ==> */ S_IDLE, - /* S_ELECTION ==> */ S_ELECTION, - /* S_INTEGRATION ==> */ S_INTEGRATION, - /* S_FINALIZE_JOIN ==> */ S_FINALIZE_JOIN, - /* S_NOT_DC ==> */ S_NOT_DC, - /* S_POLICY_ENGINE ==> */ S_POLICY_ENGINE, - /* S_RECOVERY ==> */ S_RECOVERY, - /* S_RELEASE_DC ==> */ S_RELEASE_DC, - /* S_STARTING ==> */ S_STARTING, - /* S_PENDING ==> */ S_PENDING, - /* S_STOPPING ==> */ S_STOPPING, - /* S_TERMINATE ==> */ S_TERMINATE, - /* S_TRANSITION_ENGINE ==> */ S_TRANSITION_ENGINE, - /* S_HALT ==> */ S_HALT, - }, + { + /* S_IDLE ==> */ S_IDLE, + /* S_ELECTION ==> */ S_ELECTION, + /* S_INTEGRATION ==> */ S_INTEGRATION, + /* S_FINALIZE_JOIN ==> */ S_FINALIZE_JOIN, + /* S_NOT_DC ==> */ S_NOT_DC, + /* S_POLICY_ENGINE ==> */ S_POLICY_ENGINE, + /* S_RECOVERY ==> */ S_RECOVERY, + /* S_RELEASE_DC ==> */ S_RELEASE_DC, + /* S_STARTING ==> */ S_STARTING, + /* S_PENDING ==> */ S_PENDING, + /* S_STOPPING ==> */ S_STOPPING, + /* S_TERMINATE ==> */ S_TERMINATE, + /* S_TRANSITION_ENGINE ==> */ S_TRANSITION_ENGINE, + /* S_HALT ==> */ S_HALT, + }, /* Got an I_CIB_OP */ - { - /* S_IDLE ==> */ S_IDLE, - /* S_ELECTION ==> */ S_ELECTION, - /* S_INTEGRATION ==> */ S_INTEGRATION, - /* S_FINALIZE_JOIN ==> */ S_FINALIZE_JOIN, - /* S_NOT_DC ==> */ S_NOT_DC, - /* S_POLICY_ENGINE ==> */ S_POLICY_ENGINE, - /* S_RECOVERY ==> */ S_RECOVERY, - /* S_RELEASE_DC ==> */ S_RELEASE_DC, - /* S_STARTING ==> */ S_STARTING, - /* S_PENDING ==> */ S_PENDING, - /* S_STOPPING ==> */ S_STOPPING, - /* S_TERMINATE ==> */ S_TERMINATE, - /* S_TRANSITION_ENGINE ==> */ S_TRANSITION_ENGINE, - /* S_HALT ==> */ S_HALT, - }, + { + /* S_IDLE ==> */ S_IDLE, + /* S_ELECTION ==> */ S_ELECTION, + /* S_INTEGRATION ==> */ S_INTEGRATION, + /* S_FINALIZE_JOIN ==> */ S_FINALIZE_JOIN, + /* S_NOT_DC ==> */ S_NOT_DC, + /* S_POLICY_ENGINE ==> */ S_POLICY_ENGINE, + /* S_RECOVERY ==> */ S_RECOVERY, + /* S_RELEASE_DC ==> */ S_RELEASE_DC, + /* S_STARTING ==> */ S_STARTING, + /* S_PENDING ==> */ S_PENDING, + /* S_STOPPING ==> */ S_STOPPING, + /* S_TERMINATE ==> */ S_TERMINATE, + /* S_TRANSITION_ENGINE ==> */ S_TRANSITION_ENGINE, + /* S_HALT ==> */ S_HALT, + }, /* Got an I_CIB_UPDATE */ - { - /* S_IDLE ==> */ S_IDLE, - /* S_ELECTION ==> */ S_ELECTION, - /* S_INTEGRATION ==> */ S_INTEGRATION, - /* S_FINALIZE_JOIN ==> */ S_FINALIZE_JOIN, - /* S_NOT_DC ==> */ S_RECOVERY, - /* S_POLICY_ENGINE ==> */ S_POLICY_ENGINE, - /* S_RECOVERY ==> */ S_RECOVERY, - /* S_RELEASE_DC ==> */ S_RELEASE_DC, - /* S_STARTING ==> */ S_RECOVERY, - /* S_PENDING ==> */ S_RECOVERY, - /* S_STOPPING ==> */ S_STOPPING, - /* S_TERMINATE ==> */ S_TERMINATE, - /* S_TRANSITION_ENGINE ==> */ S_TRANSITION_ENGINE, - /* S_HALT ==> */ S_HALT, - }, + { + /* S_IDLE ==> */ S_IDLE, + /* S_ELECTION ==> */ S_ELECTION, + /* S_INTEGRATION ==> */ S_INTEGRATION, + /* S_FINALIZE_JOIN ==> */ S_FINALIZE_JOIN, + /* S_NOT_DC ==> */ S_RECOVERY, + /* S_POLICY_ENGINE ==> */ S_POLICY_ENGINE, + /* S_RECOVERY ==> */ S_RECOVERY, + /* S_RELEASE_DC ==> */ S_RELEASE_DC, + /* S_STARTING ==> */ S_RECOVERY, + /* S_PENDING ==> */ S_RECOVERY, + /* S_STOPPING ==> */ S_STOPPING, + /* S_TERMINATE ==> */ S_TERMINATE, + /* S_TRANSITION_ENGINE ==> */ S_TRANSITION_ENGINE, + /* S_HALT ==> */ S_HALT, + }, /* Got an I_DC_TIMEOUT */ - { - /* S_IDLE ==> */ S_RECOVERY, - /* S_ELECTION ==> */ S_ELECTION, - /* S_INTEGRATION ==> */ S_RECOVERY, - /* S_FINALIZE_JOIN ==> */ S_RECOVERY, - /* S_NOT_DC ==> */ S_ELECTION, - /* S_POLICY_ENGINE ==> */ S_RECOVERY, - /* S_RECOVERY ==> */ S_RECOVERY, - /* S_RELEASE_DC ==> */ S_RECOVERY, - /* S_STARTING ==> */ S_STARTING, - /* S_PENDING ==> */ S_ELECTION, - /* S_STOPPING ==> */ S_STOPPING, - /* S_TERMINATE ==> */ S_TERMINATE, - /* S_TRANSITION_ENGINE ==> */ S_RECOVERY, - /* S_HALT ==> */ S_ELECTION, - }, + { + /* S_IDLE ==> */ S_RECOVERY, + /* S_ELECTION ==> */ S_ELECTION, + /* S_INTEGRATION ==> */ S_RECOVERY, + /* S_FINALIZE_JOIN ==> */ S_RECOVERY, + /* S_NOT_DC ==> */ S_ELECTION, + /* S_POLICY_ENGINE ==> */ S_RECOVERY, + /* S_RECOVERY ==> */ S_RECOVERY, + /* S_RELEASE_DC ==> */ S_RECOVERY, + /* S_STARTING ==> */ S_STARTING, + /* S_PENDING ==> */ S_ELECTION, + /* S_STOPPING ==> */ S_STOPPING, + /* S_TERMINATE ==> */ S_TERMINATE, + /* S_TRANSITION_ENGINE ==> */ S_RECOVERY, + /* S_HALT ==> */ S_ELECTION, + }, /* Got an I_ELECTION */ - { - /* S_IDLE ==> */ S_ELECTION, - /* S_ELECTION ==> */ S_ELECTION, - /* S_INTEGRATION ==> */ S_ELECTION, - /* S_FINALIZE_JOIN ==> */ S_ELECTION, - /* S_NOT_DC ==> */ S_ELECTION, - /* S_POLICY_ENGINE ==> */ S_ELECTION, - /* S_RECOVERY ==> */ S_RECOVERY, - /* S_RELEASE_DC ==> */ S_RELEASE_DC, - /* S_STARTING ==> */ S_STARTING, - /* S_PENDING ==> */ S_ELECTION, - /* S_STOPPING ==> */ S_STOPPING, - /* S_TERMINATE ==> */ S_TERMINATE, - /* S_TRANSITION_ENGINE ==> */ S_ELECTION, - /* S_HALT ==> */ S_HALT, - }, + { + /* S_IDLE ==> */ S_ELECTION, + /* S_ELECTION ==> */ S_ELECTION, + /* S_INTEGRATION ==> */ S_ELECTION, + /* S_FINALIZE_JOIN ==> */ S_ELECTION, + /* S_NOT_DC ==> */ S_ELECTION, + /* S_POLICY_ENGINE ==> */ S_ELECTION, + /* S_RECOVERY ==> */ S_RECOVERY, + /* S_RELEASE_DC ==> */ S_RELEASE_DC, + /* S_STARTING ==> */ S_STARTING, + /* S_PENDING ==> */ S_ELECTION, + /* S_STOPPING ==> */ S_STOPPING, + /* S_TERMINATE ==> */ S_TERMINATE, + /* S_TRANSITION_ENGINE ==> */ S_ELECTION, + /* S_HALT ==> */ S_HALT, + }, /* Got an I_PE_CALC */ - { - /* S_IDLE ==> */ S_POLICY_ENGINE, - /* S_ELECTION ==> */ S_ELECTION, - /* S_INTEGRATION ==> */ S_INTEGRATION, - /* S_FINALIZE_JOIN ==> */ S_FINALIZE_JOIN, - /* S_NOT_DC ==> */ S_NOT_DC, - /* S_POLICY_ENGINE ==> */ S_POLICY_ENGINE, - /* S_RECOVERY ==> */ S_RECOVERY, - /* S_RELEASE_DC ==> */ S_RELEASE_DC, - /* S_STARTING ==> */ S_RECOVERY, - /* S_PENDING ==> */ S_PENDING, - /* S_STOPPING ==> */ S_STOPPING, - /* S_TERMINATE ==> */ S_TERMINATE, - /* S_TRANSITION_ENGINE ==> */ S_POLICY_ENGINE, - /* S_HALT ==> */ S_HALT, - }, + { + /* S_IDLE ==> */ S_POLICY_ENGINE, + /* S_ELECTION ==> */ S_ELECTION, + /* S_INTEGRATION ==> */ S_INTEGRATION, + /* S_FINALIZE_JOIN ==> */ S_FINALIZE_JOIN, + /* S_NOT_DC ==> */ S_NOT_DC, + /* S_POLICY_ENGINE ==> */ S_POLICY_ENGINE, + /* S_RECOVERY ==> */ S_RECOVERY, + /* S_RELEASE_DC ==> */ S_RELEASE_DC, + /* S_STARTING ==> */ S_RECOVERY, + /* S_PENDING ==> */ S_PENDING, + /* S_STOPPING ==> */ S_STOPPING, + /* S_TERMINATE ==> */ S_TERMINATE, + /* S_TRANSITION_ENGINE ==> */ S_POLICY_ENGINE, + /* S_HALT ==> */ S_HALT, + }, /* Got an I_RELEASE_DC */ - { - /* S_IDLE ==> */ S_RELEASE_DC, - /* S_ELECTION ==> */ S_RELEASE_DC, - /* S_INTEGRATION ==> */ S_RELEASE_DC, - /* S_FINALIZE_JOIN ==> */ S_RELEASE_DC, - /* S_NOT_DC ==> */ S_NOT_DC, - /* S_POLICY_ENGINE ==> */ S_RELEASE_DC, - /* S_RECOVERY ==> */ S_RECOVERY, - /* S_RELEASE_DC ==> */ S_RELEASE_DC, - /* S_STARTING ==> */ S_RECOVERY, - /* S_PENDING ==> */ S_PENDING, - /* S_STOPPING ==> */ S_STOPPING, - /* S_TERMINATE ==> */ S_TERMINATE, - /* S_TRANSITION_ENGINE ==> */ S_RELEASE_DC, - /* S_HALT ==> */ S_HALT, - }, + { + /* S_IDLE ==> */ S_RELEASE_DC, + /* S_ELECTION ==> */ S_RELEASE_DC, + /* S_INTEGRATION ==> */ S_RELEASE_DC, + /* S_FINALIZE_JOIN ==> */ S_RELEASE_DC, + /* S_NOT_DC ==> */ S_NOT_DC, + /* S_POLICY_ENGINE ==> */ S_RELEASE_DC, + /* S_RECOVERY ==> */ S_RECOVERY, + /* S_RELEASE_DC ==> */ S_RELEASE_DC, + /* S_STARTING ==> */ S_RECOVERY, + /* S_PENDING ==> */ S_PENDING, + /* S_STOPPING ==> */ S_STOPPING, + /* S_TERMINATE ==> */ S_TERMINATE, + /* S_TRANSITION_ENGINE ==> */ S_RELEASE_DC, + /* S_HALT ==> */ S_HALT, + }, /* Got an I_ELECTION_DC */ - { - /* S_IDLE ==> */ S_INTEGRATION, - /* S_ELECTION ==> */ S_INTEGRATION, - /* S_INTEGRATION ==> */ S_INTEGRATION, - /* S_FINALIZE_JOIN ==> */ S_INTEGRATION, - /* S_NOT_DC ==> */ S_INTEGRATION, - /* S_POLICY_ENGINE ==> */ S_INTEGRATION, - /* S_RECOVERY ==> */ S_RECOVERY, - /* S_RELEASE_DC ==> */ S_RELEASE_DC, - /* S_STARTING ==> */ S_RECOVERY, - /* S_PENDING ==> */ S_PENDING, - /* S_STOPPING ==> */ S_STOPPING, - /* S_TERMINATE ==> */ S_TERMINATE, - /* S_TRANSITION_ENGINE ==> */ S_INTEGRATION, - /* S_HALT ==> */ S_HALT, - }, + { + /* S_IDLE ==> */ S_INTEGRATION, + /* S_ELECTION ==> */ S_INTEGRATION, + /* S_INTEGRATION ==> */ S_INTEGRATION, + /* S_FINALIZE_JOIN ==> */ S_INTEGRATION, + /* S_NOT_DC ==> */ S_INTEGRATION, + /* S_POLICY_ENGINE ==> */ S_INTEGRATION, + /* S_RECOVERY ==> */ S_RECOVERY, + /* S_RELEASE_DC ==> */ S_RELEASE_DC, + /* S_STARTING ==> */ S_RECOVERY, + /* S_PENDING ==> */ S_PENDING, + /* S_STOPPING ==> */ S_STOPPING, + /* S_TERMINATE ==> */ S_TERMINATE, + /* S_TRANSITION_ENGINE ==> */ S_INTEGRATION, + /* S_HALT ==> */ S_HALT, + }, /* Got an I_ERROR */ - { - /* S_IDLE ==> */ S_RECOVERY, - /* S_ELECTION ==> */ S_RECOVERY, - /* S_INTEGRATION ==> */ S_RECOVERY, - /* S_FINALIZE_JOIN ==> */ S_RECOVERY, - /* S_NOT_DC ==> */ S_RECOVERY, - /* S_POLICY_ENGINE ==> */ S_RECOVERY, - /* S_RECOVERY ==> */ S_RECOVERY, - /* S_RELEASE_DC ==> */ S_RECOVERY, - /* S_STARTING ==> */ S_RECOVERY, - /* S_PENDING ==> */ S_RECOVERY, - /* S_STOPPING ==> */ S_TERMINATE, - /* S_TERMINATE ==> */ S_TERMINATE, - /* S_TRANSITION_ENGINE ==> */ S_RECOVERY, - /* S_HALT ==> */ S_RECOVERY, - }, + { + /* S_IDLE ==> */ S_RECOVERY, + /* S_ELECTION ==> */ S_RECOVERY, + /* S_INTEGRATION ==> */ S_RECOVERY, + /* S_FINALIZE_JOIN ==> */ S_RECOVERY, + /* S_NOT_DC ==> */ S_RECOVERY, + /* S_POLICY_ENGINE ==> */ S_RECOVERY, + /* S_RECOVERY ==> */ S_RECOVERY, + /* S_RELEASE_DC ==> */ S_RECOVERY, + /* S_STARTING ==> */ S_RECOVERY, + /* S_PENDING ==> */ S_RECOVERY, + /* S_STOPPING ==> */ S_TERMINATE, + /* S_TERMINATE ==> */ S_TERMINATE, + /* S_TRANSITION_ENGINE ==> */ S_RECOVERY, + /* S_HALT ==> */ S_RECOVERY, + }, /* Got an I_FAIL */ - { - /* S_IDLE ==> */ S_RECOVERY, - /* S_ELECTION ==> */ S_RELEASE_DC, - /* S_INTEGRATION ==> */ S_INTEGRATION, - /* S_FINALIZE_JOIN ==> */ S_INTEGRATION, - /* S_NOT_DC ==> */ S_RECOVERY, - /* S_POLICY_ENGINE ==> */ S_INTEGRATION, - /* S_RECOVERY ==> */ S_RECOVERY, - /* S_RELEASE_DC ==> */ S_RELEASE_DC, - /* S_STARTING ==> */ S_STOPPING, - /* S_PENDING ==> */ S_STOPPING, - /* S_STOPPING ==> */ S_STOPPING, - /* S_TERMINATE ==> */ S_TERMINATE, - /* S_TRANSITION_ENGINE ==> */ S_POLICY_ENGINE, - /* S_HALT ==> */ S_RELEASE_DC, - }, + { + /* S_IDLE ==> */ S_RECOVERY, + /* S_ELECTION ==> */ S_RELEASE_DC, + /* S_INTEGRATION ==> */ S_INTEGRATION, + /* S_FINALIZE_JOIN ==> */ S_INTEGRATION, + /* S_NOT_DC ==> */ S_RECOVERY, + /* S_POLICY_ENGINE ==> */ S_INTEGRATION, + /* S_RECOVERY ==> */ S_RECOVERY, + /* S_RELEASE_DC ==> */ S_RELEASE_DC, + /* S_STARTING ==> */ S_STOPPING, + /* S_PENDING ==> */ S_STOPPING, + /* S_STOPPING ==> */ S_STOPPING, + /* S_TERMINATE ==> */ S_TERMINATE, + /* S_TRANSITION_ENGINE ==> */ S_POLICY_ENGINE, + /* S_HALT ==> */ S_RELEASE_DC, + }, /* Got an I_INTEGRATED */ - { - /* S_IDLE ==> */ S_IDLE, - /* S_ELECTION ==> */ S_ELECTION, - /* S_INTEGRATION ==> */ S_FINALIZE_JOIN, - /* S_FINALIZE_JOIN ==> */ S_FINALIZE_JOIN, - /* S_NOT_DC ==> */ S_NOT_DC, - /* S_POLICY_ENGINE ==> */ S_POLICY_ENGINE, - /* S_RECOVERY ==> */ S_RECOVERY, - /* S_RELEASE_DC ==> */ S_RELEASE_DC, - /* S_STARTING ==> */ S_RECOVERY, - /* S_PENDING ==> */ S_RECOVERY, - /* S_STOPPING ==> */ S_STOPPING, - /* S_TERMINATE ==> */ S_TERMINATE, - /* S_TRANSITION_ENGINE ==> */ S_TRANSITION_ENGINE, - /* S_HALT ==> */ S_HALT, - }, + { + /* S_IDLE ==> */ S_IDLE, + /* S_ELECTION ==> */ S_ELECTION, + /* S_INTEGRATION ==> */ S_FINALIZE_JOIN, + /* S_FINALIZE_JOIN ==> */ S_FINALIZE_JOIN, + /* S_NOT_DC ==> */ S_NOT_DC, + /* S_POLICY_ENGINE ==> */ S_POLICY_ENGINE, + /* S_RECOVERY ==> */ S_RECOVERY, + /* S_RELEASE_DC ==> */ S_RELEASE_DC, + /* S_STARTING ==> */ S_RECOVERY, + /* S_PENDING ==> */ S_RECOVERY, + /* S_STOPPING ==> */ S_STOPPING, + /* S_TERMINATE ==> */ S_TERMINATE, + /* S_TRANSITION_ENGINE ==> */ S_TRANSITION_ENGINE, + /* S_HALT ==> */ S_HALT, + }, /* Got an I_FINALIZED */ - { - /* S_IDLE ==> */ S_IDLE, - /* S_ELECTION ==> */ S_ELECTION, - /* S_INTEGRATION ==> */ S_INTEGRATION, - /* S_FINALIZE_JOIN ==> */ S_POLICY_ENGINE, - /* S_NOT_DC ==> */ S_NOT_DC, - /* S_POLICY_ENGINE ==> */ S_POLICY_ENGINE, - /* S_RECOVERY ==> */ S_RECOVERY, - /* S_RELEASE_DC ==> */ S_RELEASE_DC, - /* S_STARTING ==> */ S_RECOVERY, - /* S_PENDING ==> */ S_RECOVERY, - /* S_STOPPING ==> */ S_STOPPING, - /* S_TERMINATE ==> */ S_TERMINATE, - /* S_TRANSITION_ENGINE ==> */ S_TRANSITION_ENGINE, - /* S_HALT ==> */ S_HALT, - }, + { + /* S_IDLE ==> */ S_IDLE, + /* S_ELECTION ==> */ S_ELECTION, + /* S_INTEGRATION ==> */ S_INTEGRATION, + /* S_FINALIZE_JOIN ==> */ S_POLICY_ENGINE, + /* S_NOT_DC ==> */ S_NOT_DC, + /* S_POLICY_ENGINE ==> */ S_POLICY_ENGINE, + /* S_RECOVERY ==> */ S_RECOVERY, + /* S_RELEASE_DC ==> */ S_RELEASE_DC, + /* S_STARTING ==> */ S_RECOVERY, + /* S_PENDING ==> */ S_RECOVERY, + /* S_STOPPING ==> */ S_STOPPING, + /* S_TERMINATE ==> */ S_TERMINATE, + /* S_TRANSITION_ENGINE ==> */ S_TRANSITION_ENGINE, + /* S_HALT ==> */ S_HALT, + }, /* Got an I_NODE_JOIN */ - { - /* S_IDLE ==> */ S_INTEGRATION, - /* S_ELECTION ==> */ S_ELECTION, - /* S_INTEGRATION ==> */ S_INTEGRATION, - /* S_FINALIZE_JOIN ==> */ S_INTEGRATION, - /* S_NOT_DC ==> */ S_NOT_DC, - /* S_POLICY_ENGINE ==> */ S_INTEGRATION, - /* S_RECOVERY ==> */ S_RECOVERY, - /* S_RELEASE_DC ==> */ S_RELEASE_DC, - /* S_STARTING ==> */ S_RECOVERY, - /* S_PENDING ==> */ S_PENDING, - /* S_STOPPING ==> */ S_STOPPING, - /* S_TERMINATE ==> */ S_TERMINATE, - /* S_TRANSITION_ENGINE ==> */ S_INTEGRATION, - /* S_HALT ==> */ S_HALT, - }, + { + /* S_IDLE ==> */ S_INTEGRATION, + /* S_ELECTION ==> */ S_ELECTION, + /* S_INTEGRATION ==> */ S_INTEGRATION, + /* S_FINALIZE_JOIN ==> */ S_INTEGRATION, + /* S_NOT_DC ==> */ S_NOT_DC, + /* S_POLICY_ENGINE ==> */ S_INTEGRATION, + /* S_RECOVERY ==> */ S_RECOVERY, + /* S_RELEASE_DC ==> */ S_RELEASE_DC, + /* S_STARTING ==> */ S_RECOVERY, + /* S_PENDING ==> */ S_PENDING, + /* S_STOPPING ==> */ S_STOPPING, + /* S_TERMINATE ==> */ S_TERMINATE, + /* S_TRANSITION_ENGINE ==> */ S_INTEGRATION, + /* S_HALT ==> */ S_HALT, + }, /* Got an I_NOT_DC */ - { - /* S_IDLE ==> */ S_RECOVERY, - /* S_ELECTION ==> */ S_ELECTION, - /* S_INTEGRATION ==> */ S_RECOVERY, - /* S_FINALIZE_JOIN ==> */ S_RECOVERY, - /* S_NOT_DC ==> */ S_NOT_DC, - /* S_POLICY_ENGINE ==> */ S_RECOVERY, - /* S_RECOVERY ==> */ S_RECOVERY, - /* S_RELEASE_DC ==> */ S_RELEASE_DC, - /* S_STARTING ==> */ S_RECOVERY, - /* S_PENDING ==> */ S_NOT_DC, - /* S_STOPPING ==> */ S_STOPPING, - /* S_TERMINATE ==> */ S_TERMINATE, - /* S_TRANSITION_ENGINE ==> */ S_RECOVERY, - /* S_HALT ==> */ S_HALT, - }, + { + /* S_IDLE ==> */ S_RECOVERY, + /* S_ELECTION ==> */ S_ELECTION, + /* S_INTEGRATION ==> */ S_RECOVERY, + /* S_FINALIZE_JOIN ==> */ S_RECOVERY, + /* S_NOT_DC ==> */ S_NOT_DC, + /* S_POLICY_ENGINE ==> */ S_RECOVERY, + /* S_RECOVERY ==> */ S_RECOVERY, + /* S_RELEASE_DC ==> */ S_RELEASE_DC, + /* S_STARTING ==> */ S_RECOVERY, + /* S_PENDING ==> */ S_NOT_DC, + /* S_STOPPING ==> */ S_STOPPING, + /* S_TERMINATE ==> */ S_TERMINATE, + /* S_TRANSITION_ENGINE ==> */ S_RECOVERY, + /* S_HALT ==> */ S_HALT, + }, /* Got an I_RECOVERED */ - { - /* S_IDLE ==> */ S_IDLE, - /* S_ELECTION ==> */ S_ELECTION, - /* S_INTEGRATION ==> */ S_INTEGRATION, - /* S_FINALIZE_JOIN ==> */ S_INTEGRATION, - /* S_NOT_DC ==> */ S_NOT_DC, - /* S_POLICY_ENGINE ==> */ S_POLICY_ENGINE, - /* S_RECOVERY ==> */ S_PENDING, - /* S_RELEASE_DC ==> */ S_RELEASE_DC, - /* S_STARTING ==> */ S_STARTING, - /* S_PENDING ==> */ S_PENDING, - /* S_STOPPING ==> */ S_STOPPING, - /* S_TERMINATE ==> */ S_TERMINATE, - /* S_TRANSITION_ENGINE ==> */ S_TRANSITION_ENGINE, - /* S_HALT ==> */ S_HALT, - }, + { + /* S_IDLE ==> */ S_IDLE, + /* S_ELECTION ==> */ S_ELECTION, + /* S_INTEGRATION ==> */ S_INTEGRATION, + /* S_FINALIZE_JOIN ==> */ S_INTEGRATION, + /* S_NOT_DC ==> */ S_NOT_DC, + /* S_POLICY_ENGINE ==> */ S_POLICY_ENGINE, + /* S_RECOVERY ==> */ S_PENDING, + /* S_RELEASE_DC ==> */ S_RELEASE_DC, + /* S_STARTING ==> */ S_STARTING, + /* S_PENDING ==> */ S_PENDING, + /* S_STOPPING ==> */ S_STOPPING, + /* S_TERMINATE ==> */ S_TERMINATE, + /* S_TRANSITION_ENGINE ==> */ S_TRANSITION_ENGINE, + /* S_HALT ==> */ S_HALT, + }, /* Got an I_RELEASE_FAIL */ - { - /* S_IDLE ==> */ S_STOPPING, - /* S_ELECTION ==> */ S_STOPPING, - /* S_INTEGRATION ==> */ S_STOPPING, - /* S_FINALIZE_JOIN ==> */ S_STOPPING, - /* S_NOT_DC ==> */ S_NOT_DC, - /* S_POLICY_ENGINE ==> */ S_STOPPING, - /* S_RECOVERY ==> */ S_STOPPING, - /* S_RELEASE_DC ==> */ S_STOPPING, - /* S_STARTING ==> */ S_RECOVERY, - /* S_PENDING ==> */ S_PENDING, - /* S_STOPPING ==> */ S_STOPPING, - /* S_TERMINATE ==> */ S_TERMINATE, - /* S_TRANSITION_ENGINE ==> */ S_STOPPING, - /* S_HALT ==> */ S_HALT, - }, + { + /* S_IDLE ==> */ S_STOPPING, + /* S_ELECTION ==> */ S_STOPPING, + /* S_INTEGRATION ==> */ S_STOPPING, + /* S_FINALIZE_JOIN ==> */ S_STOPPING, + /* S_NOT_DC ==> */ S_NOT_DC, + /* S_POLICY_ENGINE ==> */ S_STOPPING, + /* S_RECOVERY ==> */ S_STOPPING, + /* S_RELEASE_DC ==> */ S_STOPPING, + /* S_STARTING ==> */ S_RECOVERY, + /* S_PENDING ==> */ S_PENDING, + /* S_STOPPING ==> */ S_STOPPING, + /* S_TERMINATE ==> */ S_TERMINATE, + /* S_TRANSITION_ENGINE ==> */ S_STOPPING, + /* S_HALT ==> */ S_HALT, + }, /* Got an I_RELEASE_SUCCESS */ - { - /* S_IDLE ==> */ S_RECOVERY, - /* S_ELECTION ==> */ S_ELECTION, - /* S_INTEGRATION ==> */ S_RECOVERY, - /* S_FINALIZE_JOIN ==> */ S_RECOVERY, - /* S_NOT_DC ==> */ S_NOT_DC, - /* S_POLICY_ENGINE ==> */ S_RECOVERY, - /* S_RECOVERY ==> */ S_RECOVERY, - /* S_RELEASE_DC ==> */ S_PENDING, - /* S_STARTING ==> */ S_RECOVERY, - /* S_PENDING ==> */ S_PENDING, - /* S_STOPPING ==> */ S_STOPPING, - /* S_TERMINATE ==> */ S_TERMINATE, - /* S_TRANSITION_ENGINE ==> */ S_RECOVERY, - /* S_HALT ==> */ S_HALT, - }, + { + /* S_IDLE ==> */ S_RECOVERY, + /* S_ELECTION ==> */ S_ELECTION, + /* S_INTEGRATION ==> */ S_RECOVERY, + /* S_FINALIZE_JOIN ==> */ S_RECOVERY, + /* S_NOT_DC ==> */ S_NOT_DC, + /* S_POLICY_ENGINE ==> */ S_RECOVERY, + /* S_RECOVERY ==> */ S_RECOVERY, + /* S_RELEASE_DC ==> */ S_PENDING, + /* S_STARTING ==> */ S_RECOVERY, + /* S_PENDING ==> */ S_PENDING, + /* S_STOPPING ==> */ S_STOPPING, + /* S_TERMINATE ==> */ S_TERMINATE, + /* S_TRANSITION_ENGINE ==> */ S_RECOVERY, + /* S_HALT ==> */ S_HALT, + }, /* Got an I_RESTART */ - { - /* S_IDLE ==> */ S_IDLE, - /* S_ELECTION ==> */ S_ELECTION, - /* S_INTEGRATION ==> */ S_INTEGRATION, - /* S_FINALIZE_JOIN ==> */ S_FINALIZE_JOIN, - /* S_NOT_DC ==> */ S_NOT_DC, - /* S_POLICY_ENGINE ==> */ S_POLICY_ENGINE, - /* S_RECOVERY ==> */ S_RECOVERY, - /* S_RELEASE_DC ==> */ S_RELEASE_DC, - /* S_STARTING ==> */ S_STARTING, - /* S_PENDING ==> */ S_PENDING, - /* S_STOPPING ==> */ S_STOPPING, - /* S_TERMINATE ==> */ S_TERMINATE, - /* S_TRANSITION_ENGINE ==> */ S_TRANSITION_ENGINE, - /* S_HALT ==> */ S_HALT, - }, + { + /* S_IDLE ==> */ S_IDLE, + /* S_ELECTION ==> */ S_ELECTION, + /* S_INTEGRATION ==> */ S_INTEGRATION, + /* S_FINALIZE_JOIN ==> */ S_FINALIZE_JOIN, + /* S_NOT_DC ==> */ S_NOT_DC, + /* S_POLICY_ENGINE ==> */ S_POLICY_ENGINE, + /* S_RECOVERY ==> */ S_RECOVERY, + /* S_RELEASE_DC ==> */ S_RELEASE_DC, + /* S_STARTING ==> */ S_STARTING, + /* S_PENDING ==> */ S_PENDING, + /* S_STOPPING ==> */ S_STOPPING, + /* S_TERMINATE ==> */ S_TERMINATE, + /* S_TRANSITION_ENGINE ==> */ S_TRANSITION_ENGINE, + /* S_HALT ==> */ S_HALT, + }, /* Got an I_TE_SUCCESS */ - { - /* S_IDLE ==> */ S_IDLE, - /* S_ELECTION ==> */ S_ELECTION, - /* S_INTEGRATION ==> */ S_INTEGRATION, - /* S_FINALIZE_JOIN ==> */ S_FINALIZE_JOIN, - /* S_NOT_DC ==> */ S_NOT_DC, - /* S_POLICY_ENGINE ==> */ S_POLICY_ENGINE, - /* S_RECOVERY ==> */ S_RECOVERY, - /* S_RELEASE_DC ==> */ S_RELEASE_DC, - /* S_STARTING ==> */ S_RECOVERY, - /* S_PENDING ==> */ S_PENDING, - /* S_STOPPING ==> */ S_STOPPING, - /* S_TERMINATE ==> */ S_TERMINATE, - /* S_TRANSITION_ENGINE ==> */ S_IDLE, - /* S_HALT ==> */ S_HALT, - }, + { + /* S_IDLE ==> */ S_IDLE, + /* S_ELECTION ==> */ S_ELECTION, + /* S_INTEGRATION ==> */ S_INTEGRATION, + /* S_FINALIZE_JOIN ==> */ S_FINALIZE_JOIN, + /* S_NOT_DC ==> */ S_NOT_DC, + /* S_POLICY_ENGINE ==> */ S_POLICY_ENGINE, + /* S_RECOVERY ==> */ S_RECOVERY, + /* S_RELEASE_DC ==> */ S_RELEASE_DC, + /* S_STARTING ==> */ S_RECOVERY, + /* S_PENDING ==> */ S_PENDING, + /* S_STOPPING ==> */ S_STOPPING, + /* S_TERMINATE ==> */ S_TERMINATE, + /* S_TRANSITION_ENGINE ==> */ S_IDLE, + /* S_HALT ==> */ S_HALT, + }, /* Got an I_ROUTER */ - { - /* S_IDLE ==> */ S_IDLE, - /* S_ELECTION ==> */ S_ELECTION, - /* S_INTEGRATION ==> */ S_INTEGRATION, - /* S_FINALIZE_JOIN ==> */ S_FINALIZE_JOIN, - /* S_NOT_DC ==> */ S_NOT_DC, - /* S_POLICY_ENGINE ==> */ S_POLICY_ENGINE, - /* S_RECOVERY ==> */ S_RECOVERY, - /* S_RELEASE_DC ==> */ S_RELEASE_DC, - /* S_STARTING ==> */ S_STARTING, - /* S_PENDING ==> */ S_PENDING, - /* S_STOPPING ==> */ S_STOPPING, - /* S_TERMINATE ==> */ S_TERMINATE, - /* S_TRANSITION_ENGINE ==> */ S_TRANSITION_ENGINE, - /* S_HALT ==> */ S_HALT, - }, + { + /* S_IDLE ==> */ S_IDLE, + /* S_ELECTION ==> */ S_ELECTION, + /* S_INTEGRATION ==> */ S_INTEGRATION, + /* S_FINALIZE_JOIN ==> */ S_FINALIZE_JOIN, + /* S_NOT_DC ==> */ S_NOT_DC, + /* S_POLICY_ENGINE ==> */ S_POLICY_ENGINE, + /* S_RECOVERY ==> */ S_RECOVERY, + /* S_RELEASE_DC ==> */ S_RELEASE_DC, + /* S_STARTING ==> */ S_STARTING, + /* S_PENDING ==> */ S_PENDING, + /* S_STOPPING ==> */ S_STOPPING, + /* S_TERMINATE ==> */ S_TERMINATE, + /* S_TRANSITION_ENGINE ==> */ S_TRANSITION_ENGINE, + /* S_HALT ==> */ S_HALT, + }, /* Got an I_SHUTDOWN */ - { - /* S_IDLE ==> */ S_POLICY_ENGINE, - /* S_ELECTION ==> */ S_ELECTION, - /* S_INTEGRATION ==> */ S_INTEGRATION, - /* S_FINALIZE_JOIN ==> */ S_FINALIZE_JOIN, - /* S_NOT_DC ==> */ S_NOT_DC, - /* S_POLICY_ENGINE ==> */ S_POLICY_ENGINE, - /* S_RECOVERY ==> */ S_STOPPING, - /* S_RELEASE_DC ==> */ S_RELEASE_DC, - /* S_STARTING ==> */ S_STOPPING, - /* S_PENDING ==> */ S_PENDING, - /* S_STOPPING ==> */ S_STOPPING, - /* S_TERMINATE ==> */ S_TERMINATE, - /* S_TRANSITION_ENGINE ==> */ S_POLICY_ENGINE, - /* S_HALT ==> */ S_ELECTION, - }, + { + /* S_IDLE ==> */ S_POLICY_ENGINE, + /* S_ELECTION ==> */ S_ELECTION, + /* S_INTEGRATION ==> */ S_INTEGRATION, + /* S_FINALIZE_JOIN ==> */ S_FINALIZE_JOIN, + /* S_NOT_DC ==> */ S_NOT_DC, + /* S_POLICY_ENGINE ==> */ S_POLICY_ENGINE, + /* S_RECOVERY ==> */ S_STOPPING, + /* S_RELEASE_DC ==> */ S_RELEASE_DC, + /* S_STARTING ==> */ S_STOPPING, + /* S_PENDING ==> */ S_PENDING, + /* S_STOPPING ==> */ S_STOPPING, + /* S_TERMINATE ==> */ S_TERMINATE, + /* S_TRANSITION_ENGINE ==> */ S_POLICY_ENGINE, + /* S_HALT ==> */ S_ELECTION, + }, /* Got an I_STOP */ - { - /* S_IDLE ==> */ S_STOPPING, - /* S_ELECTION ==> */ S_STOPPING, - /* S_INTEGRATION ==> */ S_STOPPING, - /* S_FINALIZE_JOIN ==> */ S_STOPPING, - /* S_NOT_DC ==> */ S_STOPPING, - /* S_POLICY_ENGINE ==> */ S_STOPPING, - /* S_RECOVERY ==> */ S_STOPPING, - /* S_RELEASE_DC ==> */ S_STOPPING, - /* S_STARTING ==> */ S_STOPPING, - /* S_PENDING ==> */ S_STOPPING, - /* S_STOPPING ==> */ S_STOPPING, - /* S_TERMINATE ==> */ S_TERMINATE, - /* S_TRANSITION_ENGINE ==> */ S_STOPPING, - /* S_HALT ==> */ S_STOPPING, - }, + { + /* S_IDLE ==> */ S_STOPPING, + /* S_ELECTION ==> */ S_STOPPING, + /* S_INTEGRATION ==> */ S_STOPPING, + /* S_FINALIZE_JOIN ==> */ S_STOPPING, + /* S_NOT_DC ==> */ S_STOPPING, + /* S_POLICY_ENGINE ==> */ S_STOPPING, + /* S_RECOVERY ==> */ S_STOPPING, + /* S_RELEASE_DC ==> */ S_STOPPING, + /* S_STARTING ==> */ S_STOPPING, + /* S_PENDING ==> */ S_STOPPING, + /* S_STOPPING ==> */ S_STOPPING, + /* S_TERMINATE ==> */ S_TERMINATE, + /* S_TRANSITION_ENGINE ==> */ S_STOPPING, + /* S_HALT ==> */ S_STOPPING, + }, /* Got an I_TERMINATE */ - { - /* S_IDLE ==> */ S_TERMINATE, - /* S_ELECTION ==> */ S_TERMINATE, - /* S_INTEGRATION ==> */ S_TERMINATE, - /* S_FINALIZE_JOIN ==> */ S_TERMINATE, - /* S_NOT_DC ==> */ S_TERMINATE, - /* S_POLICY_ENGINE ==> */ S_TERMINATE, - /* S_RECOVERY ==> */ S_TERMINATE, - /* S_RELEASE_DC ==> */ S_TERMINATE, - /* S_STARTING ==> */ S_TERMINATE, - /* S_PENDING ==> */ S_TERMINATE, - /* S_STOPPING ==> */ S_TERMINATE, - /* S_TERMINATE ==> */ S_TERMINATE, - /* S_TRANSITION_ENGINE ==> */ S_TERMINATE, - /* S_HALT ==> */ S_TERMINATE, - }, + { + /* S_IDLE ==> */ S_TERMINATE, + /* S_ELECTION ==> */ S_TERMINATE, + /* S_INTEGRATION ==> */ S_TERMINATE, + /* S_FINALIZE_JOIN ==> */ S_TERMINATE, + /* S_NOT_DC ==> */ S_TERMINATE, + /* S_POLICY_ENGINE ==> */ S_TERMINATE, + /* S_RECOVERY ==> */ S_TERMINATE, + /* S_RELEASE_DC ==> */ S_TERMINATE, + /* S_STARTING ==> */ S_TERMINATE, + /* S_PENDING ==> */ S_TERMINATE, + /* S_STOPPING ==> */ S_TERMINATE, + /* S_TERMINATE ==> */ S_TERMINATE, + /* S_TRANSITION_ENGINE ==> */ S_TERMINATE, + /* S_HALT ==> */ S_TERMINATE, + }, /* Got an I_STARTUP */ - { - /* S_IDLE ==> */ S_RECOVERY, - /* S_ELECTION ==> */ S_RECOVERY, - /* S_INTEGRATION ==> */ S_RECOVERY, - /* S_FINALIZE_JOIN ==> */ S_RECOVERY, - /* S_NOT_DC ==> */ S_RECOVERY, - /* S_POLICY_ENGINE ==> */ S_RECOVERY, - /* S_RECOVERY ==> */ S_RECOVERY, - /* S_RELEASE_DC ==> */ S_RELEASE_DC, - /* S_STARTING ==> */ S_STARTING, - /* S_PENDING ==> */ S_PENDING, - /* S_STOPPING ==> */ S_STOPPING, - /* S_TERMINATE ==> */ S_TERMINATE, - /* S_TRANSITION_ENGINE ==> */ S_RECOVERY, - /* S_HALT ==> */ S_HALT, - }, + { + /* S_IDLE ==> */ S_RECOVERY, + /* S_ELECTION ==> */ S_RECOVERY, + /* S_INTEGRATION ==> */ S_RECOVERY, + /* S_FINALIZE_JOIN ==> */ S_RECOVERY, + /* S_NOT_DC ==> */ S_RECOVERY, + /* S_POLICY_ENGINE ==> */ S_RECOVERY, + /* S_RECOVERY ==> */ S_RECOVERY, + /* S_RELEASE_DC ==> */ S_RELEASE_DC, + /* S_STARTING ==> */ S_STARTING, + /* S_PENDING ==> */ S_PENDING, + /* S_STOPPING ==> */ S_STOPPING, + /* S_TERMINATE ==> */ S_TERMINATE, + /* S_TRANSITION_ENGINE ==> */ S_RECOVERY, + /* S_HALT ==> */ S_HALT, + }, /* Got an I_PE_SUCCESS */ - { - /* S_IDLE ==> */ S_IDLE, - /* S_ELECTION ==> */ S_ELECTION, - /* S_INTEGRATION ==> */ S_INTEGRATION, - /* S_FINALIZE_JOIN ==> */ S_FINALIZE_JOIN, - /* S_NOT_DC ==> */ S_NOT_DC, - /* S_POLICY_ENGINE ==> */ S_TRANSITION_ENGINE, - /* S_RECOVERY ==> */ S_RECOVERY, - /* S_RELEASE_DC ==> */ S_RELEASE_DC, - /* S_STARTING ==> */ S_RECOVERY, - /* S_PENDING ==> */ S_PENDING, - /* S_STOPPING ==> */ S_STOPPING, - /* S_TERMINATE ==> */ S_TERMINATE, - /* S_TRANSITION_ENGINE ==> */ S_TRANSITION_ENGINE, - /* S_HALT ==> */ S_HALT, - }, + { + /* S_IDLE ==> */ S_IDLE, + /* S_ELECTION ==> */ S_ELECTION, + /* S_INTEGRATION ==> */ S_INTEGRATION, + /* S_FINALIZE_JOIN ==> */ S_FINALIZE_JOIN, + /* S_NOT_DC ==> */ S_NOT_DC, + /* S_POLICY_ENGINE ==> */ S_TRANSITION_ENGINE, + /* S_RECOVERY ==> */ S_RECOVERY, + /* S_RELEASE_DC ==> */ S_RELEASE_DC, + /* S_STARTING ==> */ S_RECOVERY, + /* S_PENDING ==> */ S_PENDING, + /* S_STOPPING ==> */ S_STOPPING, + /* S_TERMINATE ==> */ S_TERMINATE, + /* S_TRANSITION_ENGINE ==> */ S_TRANSITION_ENGINE, + /* S_HALT ==> */ S_HALT, + }, /* Got an I_JOIN_OFFER */ - { - /* S_IDLE ==> */ S_IDLE, - /* S_ELECTION ==> */ S_ELECTION, - /* S_INTEGRATION ==> */ S_INTEGRATION, - /* S_FINALIZE_JOIN ==> */ S_FINALIZE_JOIN, - /* S_NOT_DC ==> */ S_PENDING, - /* S_POLICY_ENGINE ==> */ S_POLICY_ENGINE, - /* S_RECOVERY ==> */ S_RECOVERY, - /* S_RELEASE_DC ==> */ S_RELEASE_DC, - /* S_STARTING ==> */ S_STARTING, - /* S_PENDING ==> */ S_PENDING, - /* S_STOPPING ==> */ S_STOPPING, - /* S_TERMINATE ==> */ S_TERMINATE, - /* S_TRANSITION_ENGINE ==> */ S_TRANSITION_ENGINE, - /* S_HALT ==> */ S_HALT, - }, + { + /* S_IDLE ==> */ S_IDLE, + /* S_ELECTION ==> */ S_ELECTION, + /* S_INTEGRATION ==> */ S_INTEGRATION, + /* S_FINALIZE_JOIN ==> */ S_FINALIZE_JOIN, + /* S_NOT_DC ==> */ S_PENDING, + /* S_POLICY_ENGINE ==> */ S_POLICY_ENGINE, + /* S_RECOVERY ==> */ S_RECOVERY, + /* S_RELEASE_DC ==> */ S_RELEASE_DC, + /* S_STARTING ==> */ S_STARTING, + /* S_PENDING ==> */ S_PENDING, + /* S_STOPPING ==> */ S_STOPPING, + /* S_TERMINATE ==> */ S_TERMINATE, + /* S_TRANSITION_ENGINE ==> */ S_TRANSITION_ENGINE, + /* S_HALT ==> */ S_HALT, + }, /* Got an I_JOIN_REQUEST */ - { - /* S_IDLE ==> */ S_INTEGRATION, - /* S_ELECTION ==> */ S_ELECTION, - /* S_INTEGRATION ==> */ S_INTEGRATION, - /* S_FINALIZE_JOIN ==> */ S_INTEGRATION, - /* S_NOT_DC ==> */ S_NOT_DC, - /* S_POLICY_ENGINE ==> */ S_INTEGRATION, - /* S_RECOVERY ==> */ S_RECOVERY, - /* S_RELEASE_DC ==> */ S_RELEASE_DC, - /* S_STARTING ==> */ S_STARTING, - /* S_PENDING ==> */ S_PENDING, - /* S_STOPPING ==> */ S_STOPPING, - /* S_TERMINATE ==> */ S_TERMINATE, - /* S_TRANSITION_ENGINE ==> */ S_INTEGRATION, - /* S_HALT ==> */ S_HALT, - }, + { + /* S_IDLE ==> */ S_INTEGRATION, + /* S_ELECTION ==> */ S_ELECTION, + /* S_INTEGRATION ==> */ S_INTEGRATION, + /* S_FINALIZE_JOIN ==> */ S_INTEGRATION, + /* S_NOT_DC ==> */ S_NOT_DC, + /* S_POLICY_ENGINE ==> */ S_INTEGRATION, + /* S_RECOVERY ==> */ S_RECOVERY, + /* S_RELEASE_DC ==> */ S_RELEASE_DC, + /* S_STARTING ==> */ S_STARTING, + /* S_PENDING ==> */ S_PENDING, + /* S_STOPPING ==> */ S_STOPPING, + /* S_TERMINATE ==> */ S_TERMINATE, + /* S_TRANSITION_ENGINE ==> */ S_INTEGRATION, + /* S_HALT ==> */ S_HALT, + }, /* Got an I_JOIN_RESULT */ - { - /* S_IDLE ==> */ S_INTEGRATION, - /* S_ELECTION ==> */ S_ELECTION, - /* S_INTEGRATION ==> */ S_INTEGRATION, - /* S_FINALIZE_JOIN ==> */ S_FINALIZE_JOIN, - /* S_NOT_DC ==> */ S_PENDING, - /* S_POLICY_ENGINE ==> */ S_INTEGRATION, - /* S_RECOVERY ==> */ S_RECOVERY, - /* S_RELEASE_DC ==> */ S_RELEASE_DC, - /* S_STARTING ==> */ S_RECOVERY, - /* S_PENDING ==> */ S_PENDING, - /* S_STOPPING ==> */ S_STOPPING, - /* S_TERMINATE ==> */ S_TERMINATE, - /* S_TRANSITION_ENGINE ==> */ S_INTEGRATION, - /* S_HALT ==> */ S_HALT, - }, + { + /* S_IDLE ==> */ S_INTEGRATION, + /* S_ELECTION ==> */ S_ELECTION, + /* S_INTEGRATION ==> */ S_INTEGRATION, + /* S_FINALIZE_JOIN ==> */ S_FINALIZE_JOIN, + /* S_NOT_DC ==> */ S_PENDING, + /* S_POLICY_ENGINE ==> */ S_INTEGRATION, + /* S_RECOVERY ==> */ S_RECOVERY, + /* S_RELEASE_DC ==> */ S_RELEASE_DC, + /* S_STARTING ==> */ S_RECOVERY, + /* S_PENDING ==> */ S_PENDING, + /* S_STOPPING ==> */ S_STOPPING, + /* S_TERMINATE ==> */ S_TERMINATE, + /* S_TRANSITION_ENGINE ==> */ S_INTEGRATION, + /* S_HALT ==> */ S_HALT, + }, /* Got an I_WAIT_FOR_EVENT */ - { - /* S_IDLE ==> */ S_IDLE, - /* S_ELECTION ==> */ S_ELECTION, - /* S_INTEGRATION ==> */ S_INTEGRATION, - /* S_FINALIZE_JOIN ==> */ S_FINALIZE_JOIN, - /* S_NOT_DC ==> */ S_NOT_DC, - /* S_POLICY_ENGINE ==> */ S_POLICY_ENGINE, - /* S_RECOVERY ==> */ S_RECOVERY, - /* S_RELEASE_DC ==> */ S_RELEASE_DC, - /* S_STARTING ==> */ S_STARTING, - /* S_PENDING ==> */ S_PENDING, - /* S_STOPPING ==> */ S_STOPPING, - /* S_TERMINATE ==> */ S_TERMINATE, - /* S_TRANSITION_ENGINE ==> */ S_TRANSITION_ENGINE, - /* S_HALT ==> */ S_HALT, - }, + { + /* S_IDLE ==> */ S_IDLE, + /* S_ELECTION ==> */ S_ELECTION, + /* S_INTEGRATION ==> */ S_INTEGRATION, + /* S_FINALIZE_JOIN ==> */ S_FINALIZE_JOIN, + /* S_NOT_DC ==> */ S_NOT_DC, + /* S_POLICY_ENGINE ==> */ S_POLICY_ENGINE, + /* S_RECOVERY ==> */ S_RECOVERY, + /* S_RELEASE_DC ==> */ S_RELEASE_DC, + /* S_STARTING ==> */ S_STARTING, + /* S_PENDING ==> */ S_PENDING, + /* S_STOPPING ==> */ S_STOPPING, + /* S_TERMINATE ==> */ S_TERMINATE, + /* S_TRANSITION_ENGINE ==> */ S_TRANSITION_ENGINE, + /* S_HALT ==> */ S_HALT, + }, /* Got an I_DC_HEARTBEAT */ - { - /* S_IDLE ==> */ S_IDLE, - /* S_ELECTION ==> */ S_ELECTION, - /* S_INTEGRATION ==> */ S_INTEGRATION, - /* S_FINALIZE_JOIN ==> */ S_FINALIZE_JOIN, - /* S_NOT_DC ==> */ S_NOT_DC, - /* S_POLICY_ENGINE ==> */ S_POLICY_ENGINE, - /* S_RECOVERY ==> */ S_RECOVERY, - /* S_RELEASE_DC ==> */ S_RELEASE_DC, - /* S_STARTING ==> */ S_STARTING, - /* S_PENDING ==> */ S_PENDING, - /* S_STOPPING ==> */ S_STOPPING, - /* S_TERMINATE ==> */ S_TERMINATE, - /* S_TRANSITION_ENGINE ==> */ S_TRANSITION_ENGINE, - /* S_HALT ==> */ S_HALT, - }, + { + /* S_IDLE ==> */ S_IDLE, + /* S_ELECTION ==> */ S_ELECTION, + /* S_INTEGRATION ==> */ S_INTEGRATION, + /* S_FINALIZE_JOIN ==> */ S_FINALIZE_JOIN, + /* S_NOT_DC ==> */ S_NOT_DC, + /* S_POLICY_ENGINE ==> */ S_POLICY_ENGINE, + /* S_RECOVERY ==> */ S_RECOVERY, + /* S_RELEASE_DC ==> */ S_RELEASE_DC, + /* S_STARTING ==> */ S_STARTING, + /* S_PENDING ==> */ S_PENDING, + /* S_STOPPING ==> */ S_STOPPING, + /* S_TERMINATE ==> */ S_TERMINATE, + /* S_TRANSITION_ENGINE ==> */ S_TRANSITION_ENGINE, + /* S_HALT ==> */ S_HALT, + }, /* Got an I_LRM_EVENT */ - { - /* S_IDLE ==> */ S_IDLE, - /* S_ELECTION ==> */ S_ELECTION, - /* S_INTEGRATION ==> */ S_INTEGRATION, - /* S_FINALIZE_JOIN ==> */ S_FINALIZE_JOIN, - /* S_NOT_DC ==> */ S_NOT_DC, - /* S_POLICY_ENGINE ==> */ S_POLICY_ENGINE, - /* S_RECOVERY ==> */ S_RECOVERY, - /* S_RELEASE_DC ==> */ S_RELEASE_DC, - /* S_STARTING ==> */ S_STARTING, - /* S_PENDING ==> */ S_PENDING, - /* S_STOPPING ==> */ S_STOPPING, - /* S_TERMINATE ==> */ S_TERMINATE, - /* S_TRANSITION_ENGINE ==> */ S_TRANSITION_ENGINE, - /* S_HALT ==> */ S_HALT, - }, + { + /* S_IDLE ==> */ S_IDLE, + /* S_ELECTION ==> */ S_ELECTION, + /* S_INTEGRATION ==> */ S_INTEGRATION, + /* S_FINALIZE_JOIN ==> */ S_FINALIZE_JOIN, + /* S_NOT_DC ==> */ S_NOT_DC, + /* S_POLICY_ENGINE ==> */ S_POLICY_ENGINE, + /* S_RECOVERY ==> */ S_RECOVERY, + /* S_RELEASE_DC ==> */ S_RELEASE_DC, + /* S_STARTING ==> */ S_STARTING, + /* S_PENDING ==> */ S_PENDING, + /* S_STOPPING ==> */ S_STOPPING, + /* S_TERMINATE ==> */ S_TERMINATE, + /* S_TRANSITION_ENGINE ==> */ S_TRANSITION_ENGINE, + /* S_HALT ==> */ S_HALT, + }, /* Got an I_PENDING */ - { - /* S_IDLE ==> */ S_PENDING, - /* S_ELECTION ==> */ S_PENDING, - /* S_INTEGRATION ==> */ S_PENDING, - /* S_FINALIZE_JOIN ==> */ S_PENDING, - /* S_NOT_DC ==> */ S_PENDING, - /* S_POLICY_ENGINE ==> */ S_PENDING, - /* S_RECOVERY ==> */ S_RECOVERY, - /* S_RELEASE_DC ==> */ S_RELEASE_DC, - /* S_STARTING ==> */ S_PENDING, - /* S_PENDING ==> */ S_PENDING, - /* S_STOPPING ==> */ S_STOPPING, - /* S_TERMINATE ==> */ S_TERMINATE, - /* S_TRANSITION_ENGINE ==> */ S_PENDING, - /* S_HALT ==> */ S_HALT, - }, + { + /* S_IDLE ==> */ S_PENDING, + /* S_ELECTION ==> */ S_PENDING, + /* S_INTEGRATION ==> */ S_PENDING, + /* S_FINALIZE_JOIN ==> */ S_PENDING, + /* S_NOT_DC ==> */ S_PENDING, + /* S_POLICY_ENGINE ==> */ S_PENDING, + /* S_RECOVERY ==> */ S_RECOVERY, + /* S_RELEASE_DC ==> */ S_RELEASE_DC, + /* S_STARTING ==> */ S_PENDING, + /* S_PENDING ==> */ S_PENDING, + /* S_STOPPING ==> */ S_STOPPING, + /* S_TERMINATE ==> */ S_TERMINATE, + /* S_TRANSITION_ENGINE ==> */ S_PENDING, + /* S_HALT ==> */ S_HALT, + }, /* Got an I_HALT */ - { - /* S_IDLE ==> */ S_HALT, - /* S_ELECTION ==> */ S_HALT, - /* S_INTEGRATION ==> */ S_HALT, - /* S_FINALIZE_JOIN ==> */ S_HALT, - /* S_NOT_DC ==> */ S_HALT, - /* S_POLICY_ENGINE ==> */ S_HALT, - /* S_RECOVERY ==> */ S_RECOVERY, - /* S_RELEASE_DC ==> */ S_RELEASE_DC, - /* S_STARTING ==> */ S_STARTING, - /* S_PENDING ==> */ S_HALT, - /* S_STOPPING ==> */ S_STOPPING, - /* S_TERMINATE ==> */ S_TERMINATE, - /* S_TRANSITION_ENGINE ==> */ S_HALT, - /* S_HALT ==> */ S_HALT, - }, + { + /* S_IDLE ==> */ S_HALT, + /* S_ELECTION ==> */ S_HALT, + /* S_INTEGRATION ==> */ S_HALT, + /* S_FINALIZE_JOIN ==> */ S_HALT, + /* S_NOT_DC ==> */ S_HALT, + /* S_POLICY_ENGINE ==> */ S_HALT, + /* S_RECOVERY ==> */ S_RECOVERY, + /* S_RELEASE_DC ==> */ S_RELEASE_DC, + /* S_STARTING ==> */ S_STARTING, + /* S_PENDING ==> */ S_HALT, + /* S_STOPPING ==> */ S_STOPPING, + /* S_TERMINATE ==> */ S_TERMINATE, + /* S_TRANSITION_ENGINE ==> */ S_HALT, + /* S_HALT ==> */ S_HALT, + }, }; - /* * The action table. Each entry is a set of actions to take or-ed * together. Like the state table, the rows are inputs, and * the columns are states. */ /* NOTE: In the fsa, the actions are extracted then state is updated. */ -const long long crmd_fsa_actions [MAXINPUT][MAXSTATE] = { +const long long crmd_fsa_actions[MAXINPUT][MAXSTATE] = { /* Got an I_NULL */ - { - /* S_IDLE ==> */ A_NOTHING, - /* S_ELECTION ==> */ A_NOTHING, - /* S_INTEGRATION ==> */ A_NOTHING, - /* S_FINALIZE_JOIN ==> */ A_NOTHING, - /* S_NOT_DC ==> */ A_NOTHING, - /* S_POLICY_ENGINE ==> */ A_NOTHING, - /* S_RECOVERY ==> */ A_NOTHING, - /* S_RELEASE_DC ==> */ A_NOTHING, - /* S_STARTING ==> */ A_NOTHING, - /* S_PENDING ==> */ A_NOTHING, - /* S_STOPPING ==> */ A_NOTHING, - /* S_TERMINATE ==> */ A_NOTHING, - /* S_TRANSITION_ENGINE ==> */ A_NOTHING, - /* S_HALT ==> */ A_NOTHING, - }, + { + /* S_IDLE ==> */ A_NOTHING, + /* S_ELECTION ==> */ A_NOTHING, + /* S_INTEGRATION ==> */ A_NOTHING, + /* S_FINALIZE_JOIN ==> */ A_NOTHING, + /* S_NOT_DC ==> */ A_NOTHING, + /* S_POLICY_ENGINE ==> */ A_NOTHING, + /* S_RECOVERY ==> */ A_NOTHING, + /* S_RELEASE_DC ==> */ A_NOTHING, + /* S_STARTING ==> */ A_NOTHING, + /* S_PENDING ==> */ A_NOTHING, + /* S_STOPPING ==> */ A_NOTHING, + /* S_TERMINATE ==> */ A_NOTHING, + /* S_TRANSITION_ENGINE ==> */ A_NOTHING, + /* S_HALT ==> */ A_NOTHING, + }, /* Got an I_CIB_OP */ - { - /* S_IDLE ==> */ A_ERROR, - /* S_ELECTION ==> */ A_ERROR, - /* S_INTEGRATION ==> */ A_ERROR, - /* S_FINALIZE_JOIN ==> */ A_ERROR, - /* S_NOT_DC ==> */ A_ERROR, - /* S_POLICY_ENGINE ==> */ A_ERROR, - /* S_RECOVERY ==> */ A_ERROR, - /* S_RELEASE_DC ==> */ A_ERROR, - /* S_STARTING ==> */ A_ERROR, - /* S_PENDING ==> */ A_ERROR, - /* S_STOPPING ==> */ A_ERROR, - /* S_TERMINATE ==> */ A_ERROR, - /* S_TRANSITION_ENGINE ==> */ A_ERROR, - /* S_HALT ==> */ A_ERROR, - }, + { + /* S_IDLE ==> */ A_ERROR, + /* S_ELECTION ==> */ A_ERROR, + /* S_INTEGRATION ==> */ A_ERROR, + /* S_FINALIZE_JOIN ==> */ A_ERROR, + /* S_NOT_DC ==> */ A_ERROR, + /* S_POLICY_ENGINE ==> */ A_ERROR, + /* S_RECOVERY ==> */ A_ERROR, + /* S_RELEASE_DC ==> */ A_ERROR, + /* S_STARTING ==> */ A_ERROR, + /* S_PENDING ==> */ A_ERROR, + /* S_STOPPING ==> */ A_ERROR, + /* S_TERMINATE ==> */ A_ERROR, + /* S_TRANSITION_ENGINE ==> */ A_ERROR, + /* S_HALT ==> */ A_ERROR, + }, /* Got an I_CIB_UPDATE */ - { - /* S_IDLE ==> */ A_LOG, - /* S_ELECTION ==> */ A_LOG, - /* S_INTEGRATION ==> */ A_WARN, - /* S_FINALIZE_JOIN ==> */ A_WARN, - /* S_NOT_DC ==> */ A_WARN, - /* S_POLICY_ENGINE ==> */ A_LOG, - /* S_RECOVERY ==> */ A_WARN, - /* S_RELEASE_DC ==> */ A_WARN, - /* S_STARTING ==> */ A_WARN, - /* S_PENDING ==> */ A_WARN, - /* S_STOPPING ==> */ A_WARN, - /* S_TERMINATE ==> */ A_WARN, - /* S_TRANSITION_ENGINE ==> */ A_LOG, - /* S_HALT ==> */ A_WARN, - }, + { + /* S_IDLE ==> */ A_LOG, + /* S_ELECTION ==> */ A_LOG, + /* S_INTEGRATION ==> */ A_WARN, + /* S_FINALIZE_JOIN ==> */ A_WARN, + /* S_NOT_DC ==> */ A_WARN, + /* S_POLICY_ENGINE ==> */ A_LOG, + /* S_RECOVERY ==> */ A_WARN, + /* S_RELEASE_DC ==> */ A_WARN, + /* S_STARTING ==> */ A_WARN, + /* S_PENDING ==> */ A_WARN, + /* S_STOPPING ==> */ A_WARN, + /* S_TERMINATE ==> */ A_WARN, + /* S_TRANSITION_ENGINE ==> */ A_LOG, + /* S_HALT ==> */ A_WARN, + }, /* Got an I_DC_TIMEOUT */ - { - /* S_IDLE ==> */ A_WARN, - /* S_ELECTION ==> */ A_ELECTION_VOTE, - /* S_INTEGRATION ==> */ A_WARN, - /* S_FINALIZE_JOIN ==> */ A_WARN, - /* S_NOT_DC ==> */ A_ELECTION_VOTE|A_WARN, - /* S_POLICY_ENGINE ==> */ A_WARN, - /* S_RECOVERY ==> */ A_NOTHING, - /* S_RELEASE_DC ==> */ A_WARN, - /* S_STARTING ==> */ A_WARN, - /* S_PENDING ==> */ A_ELECTION_VOTE|A_WARN, - /* S_STOPPING ==> */ A_NOTHING, - /* S_TERMINATE ==> */ A_NOTHING, - /* S_TRANSITION_ENGINE ==> */ A_TE_CANCEL|A_WARN, - /* S_HALT ==> */ A_WARN, - }, + { + /* S_IDLE ==> */ A_WARN, + /* S_ELECTION ==> */ A_ELECTION_VOTE, + /* S_INTEGRATION ==> */ A_WARN, + /* S_FINALIZE_JOIN ==> */ A_WARN, + /* S_NOT_DC ==> */ A_ELECTION_VOTE | A_WARN, + /* S_POLICY_ENGINE ==> */ A_WARN, + /* S_RECOVERY ==> */ A_NOTHING, + /* S_RELEASE_DC ==> */ A_WARN, + /* S_STARTING ==> */ A_WARN, + /* S_PENDING ==> */ A_ELECTION_VOTE | A_WARN, + /* S_STOPPING ==> */ A_NOTHING, + /* S_TERMINATE ==> */ A_NOTHING, + /* S_TRANSITION_ENGINE ==> */ A_TE_CANCEL | A_WARN, + /* S_HALT ==> */ A_WARN, + }, /* Got an I_ELECTION */ - { - /* S_IDLE ==> */ A_ELECTION_VOTE, - /* S_ELECTION ==> */ A_ELECTION_VOTE, - /* S_INTEGRATION ==> */ A_ELECTION_VOTE, - /* S_FINALIZE_JOIN ==> */ A_ELECTION_VOTE, - /* S_NOT_DC ==> */ A_ELECTION_VOTE, - /* S_POLICY_ENGINE ==> */ A_ELECTION_VOTE, - /* S_RECOVERY ==> */ A_LOG, - /* S_RELEASE_DC ==> */ A_LOG, - /* S_STARTING ==> */ A_WARN, - /* S_PENDING ==> */ A_ELECTION_VOTE, - /* S_STOPPING ==> */ A_LOG, - /* S_TERMINATE ==> */ A_LOG, - /* S_TRANSITION_ENGINE ==> */ A_ELECTION_VOTE, - /* S_HALT ==> */ A_ELECTION_VOTE, - }, + { + /* S_IDLE ==> */ A_ELECTION_VOTE, + /* S_ELECTION ==> */ A_ELECTION_VOTE, + /* S_INTEGRATION ==> */ A_ELECTION_VOTE, + /* S_FINALIZE_JOIN ==> */ A_ELECTION_VOTE, + /* S_NOT_DC ==> */ A_ELECTION_VOTE, + /* S_POLICY_ENGINE ==> */ A_ELECTION_VOTE, + /* S_RECOVERY ==> */ A_LOG, + /* S_RELEASE_DC ==> */ A_LOG, + /* S_STARTING ==> */ A_WARN, + /* S_PENDING ==> */ A_ELECTION_VOTE, + /* S_STOPPING ==> */ A_LOG, + /* S_TERMINATE ==> */ A_LOG, + /* S_TRANSITION_ENGINE ==> */ A_ELECTION_VOTE, + /* S_HALT ==> */ A_ELECTION_VOTE, + }, /* Got an I_PE_CALC */ - { - /* S_IDLE ==> */ A_PE_INVOKE, - /* S_ELECTION ==> */ A_NOTHING, - /* S_INTEGRATION ==> */ A_NOTHING, - /* S_FINALIZE_JOIN ==> */ A_NOTHING, - /* S_NOT_DC ==> */ A_WARN, - /* S_POLICY_ENGINE ==> */ A_PE_INVOKE, - /* S_RECOVERY ==> */ A_NOTHING, - /* S_RELEASE_DC ==> */ A_NOTHING, - /* S_STARTING ==> */ A_ERROR, - /* S_PENDING ==> */ A_WARN, - /* S_STOPPING ==> */ A_WARN, - /* S_TERMINATE ==> */ A_ERROR, - /* S_TRANSITION_ENGINE ==> */ A_PE_INVOKE, - /* S_HALT ==> */ A_ERROR, - }, - + { + /* S_IDLE ==> */ A_PE_INVOKE, + /* S_ELECTION ==> */ A_NOTHING, + /* S_INTEGRATION ==> */ A_NOTHING, + /* S_FINALIZE_JOIN ==> */ A_NOTHING, + /* S_NOT_DC ==> */ A_WARN, + /* S_POLICY_ENGINE ==> */ A_PE_INVOKE, + /* S_RECOVERY ==> */ A_NOTHING, + /* S_RELEASE_DC ==> */ A_NOTHING, + /* S_STARTING ==> */ A_ERROR, + /* S_PENDING ==> */ A_WARN, + /* S_STOPPING ==> */ A_WARN, + /* S_TERMINATE ==> */ A_ERROR, + /* S_TRANSITION_ENGINE ==> */ A_PE_INVOKE, + /* S_HALT ==> */ A_ERROR, + }, + /* Got an I_RELEASE_DC */ - { - /* S_IDLE ==> */ O_RELEASE, - /* S_ELECTION ==> */ O_RELEASE, - /* S_INTEGRATION ==> */ O_RELEASE|A_WARN, - /* S_FINALIZE_JOIN ==> */ O_RELEASE|A_WARN, - /* S_NOT_DC ==> */ A_WARN, - /* S_POLICY_ENGINE ==> */ O_RELEASE|A_WARN, - /* S_RECOVERY ==> */ O_RELEASE, - /* S_RELEASE_DC ==> */ O_RELEASE|A_WARN, - /* S_STARTING ==> */ A_ERROR, - /* S_PENDING ==> */ A_WARN, - /* S_STOPPING ==> */ A_WARN, - /* S_TERMINATE ==> */ A_WARN, - /* S_TRANSITION_ENGINE ==> */ O_RELEASE|A_WARN, - /* S_HALT ==> */ A_WARN, - }, + { + /* S_IDLE ==> */ O_RELEASE, + /* S_ELECTION ==> */ O_RELEASE, + /* S_INTEGRATION ==> */ O_RELEASE | A_WARN, + /* S_FINALIZE_JOIN ==> */ O_RELEASE | A_WARN, + /* S_NOT_DC ==> */ A_WARN, + /* S_POLICY_ENGINE ==> */ O_RELEASE | A_WARN, + /* S_RECOVERY ==> */ O_RELEASE, + /* S_RELEASE_DC ==> */ O_RELEASE | A_WARN, + /* S_STARTING ==> */ A_ERROR, + /* S_PENDING ==> */ A_WARN, + /* S_STOPPING ==> */ A_WARN, + /* S_TERMINATE ==> */ A_WARN, + /* S_TRANSITION_ENGINE ==> */ O_RELEASE | A_WARN, + /* S_HALT ==> */ A_WARN, + }, /* Got an I_ELECTION_DC */ - { - /* S_IDLE ==> */ A_WARN|A_ELECTION_VOTE, - /* S_ELECTION ==> */ A_LOG|A_DC_TAKEOVER|A_PE_START|A_TE_START|A_DC_JOIN_OFFER_ALL|A_DC_TIMER_STOP, - /* S_INTEGRATION ==> */ A_WARN|A_ELECTION_VOTE|A_DC_JOIN_OFFER_ALL, - /* S_FINALIZE_JOIN ==> */ A_WARN|A_ELECTION_VOTE|A_DC_JOIN_OFFER_ALL, - /* S_NOT_DC ==> */ A_LOG|A_ELECTION_VOTE, - /* S_POLICY_ENGINE ==> */ A_WARN|A_ELECTION_VOTE, - /* S_RECOVERY ==> */ A_WARN, - /* S_RELEASE_DC ==> */ A_WARN|A_ELECTION_VOTE, - /* S_STARTING ==> */ A_LOG|A_WARN, - /* S_PENDING ==> */ A_LOG|A_WARN, - /* S_STOPPING ==> */ A_WARN, - /* S_TERMINATE ==> */ A_WARN, - /* S_TRANSITION_ENGINE ==> */ A_WARN|A_ELECTION_VOTE, - /* S_HALT ==> */ A_WARN, - }, + { + /* S_IDLE ==> */ A_WARN | A_ELECTION_VOTE, + /* S_ELECTION ==> */ + A_LOG | A_DC_TAKEOVER | A_PE_START | A_TE_START | A_DC_JOIN_OFFER_ALL | A_DC_TIMER_STOP, + /* S_INTEGRATION ==> */ A_WARN | A_ELECTION_VOTE | A_DC_JOIN_OFFER_ALL, + /* S_FINALIZE_JOIN ==> */ A_WARN | A_ELECTION_VOTE | A_DC_JOIN_OFFER_ALL, + /* S_NOT_DC ==> */ A_LOG | A_ELECTION_VOTE, + /* S_POLICY_ENGINE ==> */ A_WARN | A_ELECTION_VOTE, + /* S_RECOVERY ==> */ A_WARN, + /* S_RELEASE_DC ==> */ A_WARN | A_ELECTION_VOTE, + /* S_STARTING ==> */ A_LOG | A_WARN, + /* S_PENDING ==> */ A_LOG | A_WARN, + /* S_STOPPING ==> */ A_WARN, + /* S_TERMINATE ==> */ A_WARN, + /* S_TRANSITION_ENGINE ==> */ A_WARN | A_ELECTION_VOTE, + /* S_HALT ==> */ A_WARN, + }, /* Got an I_ERROR */ - { - /* S_IDLE ==> */ A_ERROR|A_RECOVER|O_RELEASE|A_ELECTION_START, - /* S_ELECTION ==> */ A_ERROR|A_RECOVER|O_RELEASE, - /* S_INTEGRATION ==> */ A_ERROR|A_RECOVER|O_RELEASE|A_ELECTION_START, - /* S_FINALIZE_JOIN ==> */ A_ERROR|A_RECOVER|O_RELEASE|A_ELECTION_START, - /* S_NOT_DC ==> */ A_ERROR|A_RECOVER, - /* S_POLICY_ENGINE ==> */ A_ERROR|A_RECOVER|O_RELEASE|A_ELECTION_START, - /* S_RECOVERY ==> */ A_ERROR|O_RELEASE, - /* S_RELEASE_DC ==> */ A_ERROR|A_RECOVER, - /* S_STARTING ==> */ A_ERROR|A_RECOVER, - /* S_PENDING ==> */ A_ERROR|A_RECOVER, - /* S_STOPPING ==> */ A_ERROR|A_EXIT_1, - /* S_TERMINATE ==> */ A_ERROR|A_EXIT_1, - /* S_TRANSITION_ENGINE ==> */ A_ERROR|A_RECOVER|O_RELEASE|A_ELECTION_START, - /* S_HALT ==> */ A_ERROR|A_RECOVER|O_RELEASE|A_ELECTION_START, - }, + { + /* S_IDLE ==> */ A_ERROR | A_RECOVER | O_RELEASE | A_ELECTION_START, + /* S_ELECTION ==> */ A_ERROR | A_RECOVER | O_RELEASE, + /* S_INTEGRATION ==> */ A_ERROR | A_RECOVER | O_RELEASE | A_ELECTION_START, + /* S_FINALIZE_JOIN ==> */ A_ERROR | A_RECOVER | O_RELEASE | A_ELECTION_START, + /* S_NOT_DC ==> */ A_ERROR | A_RECOVER, + /* S_POLICY_ENGINE ==> */ A_ERROR | A_RECOVER | O_RELEASE | A_ELECTION_START, + /* S_RECOVERY ==> */ A_ERROR | O_RELEASE, + /* S_RELEASE_DC ==> */ A_ERROR | A_RECOVER, + /* S_STARTING ==> */ A_ERROR | A_RECOVER, + /* S_PENDING ==> */ A_ERROR | A_RECOVER, + /* S_STOPPING ==> */ A_ERROR | A_EXIT_1, + /* S_TERMINATE ==> */ A_ERROR | A_EXIT_1, + /* S_TRANSITION_ENGINE ==> */ A_ERROR | A_RECOVER | O_RELEASE | A_ELECTION_START, + /* S_HALT ==> */ A_ERROR | A_RECOVER | O_RELEASE | A_ELECTION_START, + }, /* Got an I_FAIL */ - { - /* S_IDLE ==> */ A_WARN, - /* S_ELECTION ==> */ A_WARN, - /* S_INTEGRATION ==> */ A_WARN|A_DC_JOIN_OFFER_ALL, - /* S_FINALIZE_JOIN ==> */ A_WARN|A_DC_JOIN_OFFER_ALL, - /* S_NOT_DC ==> */ A_WARN, - /* S_POLICY_ENGINE ==> */ A_WARN|A_DC_JOIN_OFFER_ALL|A_TE_CANCEL, - /* S_RECOVERY ==> */ A_WARN|O_RELEASE, - /* S_RELEASE_DC ==> */ A_WARN, - /* S_STARTING ==> */ A_WARN, - /* S_PENDING ==> */ A_WARN, - /* S_STOPPING ==> */ A_WARN, - /* S_TERMINATE ==> */ A_WARN|A_EXIT_1, - /* S_TRANSITION_ENGINE ==> */ A_WARN|O_TE_RESTART|A_RECOVER, - /* S_HALT ==> */ A_WARN, - }, - + { + /* S_IDLE ==> */ A_WARN, + /* S_ELECTION ==> */ A_WARN, + /* S_INTEGRATION ==> */ A_WARN | A_DC_JOIN_OFFER_ALL, + /* S_FINALIZE_JOIN ==> */ A_WARN | A_DC_JOIN_OFFER_ALL, + /* S_NOT_DC ==> */ A_WARN, + /* S_POLICY_ENGINE ==> */ A_WARN | A_DC_JOIN_OFFER_ALL | A_TE_CANCEL, + /* S_RECOVERY ==> */ A_WARN | O_RELEASE, + /* S_RELEASE_DC ==> */ A_WARN, + /* S_STARTING ==> */ A_WARN, + /* S_PENDING ==> */ A_WARN, + /* S_STOPPING ==> */ A_WARN, + /* S_TERMINATE ==> */ A_WARN | A_EXIT_1, + /* S_TRANSITION_ENGINE ==> */ A_WARN | O_TE_RESTART | A_RECOVER, + /* S_HALT ==> */ A_WARN, + }, + /* Got an I_INTEGRATED */ - { - /* S_IDLE ==> */ A_NOTHING, - /* S_ELECTION ==> */ A_WARN, - /* S_INTEGRATION ==> */ A_DC_JOIN_FINALIZE, - /* S_FINALIZE_JOIN ==> */ A_WARN, - /* S_NOT_DC ==> */ A_WARN, - /* S_POLICY_ENGINE ==> */ A_NOTHING, - /* S_RECOVERY ==> */ A_WARN, - /* S_RELEASE_DC ==> */ A_WARN, - /* S_STARTING ==> */ A_WARN, - /* S_PENDING ==> */ A_WARN, - /* S_STOPPING ==> */ A_WARN, - /* S_TERMINATE ==> */ A_WARN, - /* S_TRANSITION_ENGINE ==> */ A_NOTHING, - /* S_HALT ==> */ A_WARN, - }, + { + /* S_IDLE ==> */ A_NOTHING, + /* S_ELECTION ==> */ A_WARN, + /* S_INTEGRATION ==> */ A_DC_JOIN_FINALIZE, + /* S_FINALIZE_JOIN ==> */ A_WARN, + /* S_NOT_DC ==> */ A_WARN, + /* S_POLICY_ENGINE ==> */ A_NOTHING, + /* S_RECOVERY ==> */ A_WARN, + /* S_RELEASE_DC ==> */ A_WARN, + /* S_STARTING ==> */ A_WARN, + /* S_PENDING ==> */ A_WARN, + /* S_STOPPING ==> */ A_WARN, + /* S_TERMINATE ==> */ A_WARN, + /* S_TRANSITION_ENGINE ==> */ A_NOTHING, + /* S_HALT ==> */ A_WARN, + }, /* Got an I_FINALIZED */ - { - /* S_IDLE ==> */ A_NOTHING, - /* S_ELECTION ==> */ A_WARN, - /* S_INTEGRATION ==> */ A_WARN, - /* S_FINALIZE_JOIN ==> */ A_DC_JOIN_FINAL|A_TE_CANCEL, - /* S_NOT_DC ==> */ A_WARN, - /* S_POLICY_ENGINE ==> */ A_NOTHING, - /* S_RECOVERY ==> */ A_WARN, - /* S_RELEASE_DC ==> */ A_WARN, - /* S_STARTING ==> */ A_WARN, - /* S_PENDING ==> */ A_WARN, - /* S_STOPPING ==> */ A_WARN, - /* S_TERMINATE ==> */ A_WARN, - /* S_TRANSITION_ENGINE ==> */ A_NOTHING, - /* S_HALT ==> */ A_WARN, - }, + { + /* S_IDLE ==> */ A_NOTHING, + /* S_ELECTION ==> */ A_WARN, + /* S_INTEGRATION ==> */ A_WARN, + /* S_FINALIZE_JOIN ==> */ A_DC_JOIN_FINAL | A_TE_CANCEL, + /* S_NOT_DC ==> */ A_WARN, + /* S_POLICY_ENGINE ==> */ A_NOTHING, + /* S_RECOVERY ==> */ A_WARN, + /* S_RELEASE_DC ==> */ A_WARN, + /* S_STARTING ==> */ A_WARN, + /* S_PENDING ==> */ A_WARN, + /* S_STOPPING ==> */ A_WARN, + /* S_TERMINATE ==> */ A_WARN, + /* S_TRANSITION_ENGINE ==> */ A_NOTHING, + /* S_HALT ==> */ A_WARN, + }, /* Got an I_NODE_JOIN */ - { - /* S_IDLE ==> */ A_TE_HALT|A_DC_JOIN_OFFER_ONE, - /* S_ELECTION ==> */ A_WARN, - /* S_INTEGRATION ==> */ A_DC_JOIN_OFFER_ONE, - /* S_FINALIZE_JOIN ==> */ A_DC_JOIN_OFFER_ONE, - /* S_NOT_DC ==> */ A_WARN, - /* S_POLICY_ENGINE ==> */ A_DC_JOIN_OFFER_ONE, - /* S_RECOVERY ==> */ A_WARN, - /* S_RELEASE_DC ==> */ A_WARN, - /* S_STARTING ==> */ A_WARN, - /* S_PENDING ==> */ A_WARN, - /* S_STOPPING ==> */ A_WARN, - /* S_TERMINATE ==> */ A_WARN, - /* S_TRANSITION_ENGINE ==> */ A_TE_HALT|A_DC_JOIN_OFFER_ONE, - /* S_HALT ==> */ A_WARN, - }, + { + /* S_IDLE ==> */ A_TE_HALT | A_DC_JOIN_OFFER_ONE, + /* S_ELECTION ==> */ A_WARN, + /* S_INTEGRATION ==> */ A_DC_JOIN_OFFER_ONE, + /* S_FINALIZE_JOIN ==> */ A_DC_JOIN_OFFER_ONE, + /* S_NOT_DC ==> */ A_WARN, + /* S_POLICY_ENGINE ==> */ A_DC_JOIN_OFFER_ONE, + /* S_RECOVERY ==> */ A_WARN, + /* S_RELEASE_DC ==> */ A_WARN, + /* S_STARTING ==> */ A_WARN, + /* S_PENDING ==> */ A_WARN, + /* S_STOPPING ==> */ A_WARN, + /* S_TERMINATE ==> */ A_WARN, + /* S_TRANSITION_ENGINE ==> */ A_TE_HALT | A_DC_JOIN_OFFER_ONE, + /* S_HALT ==> */ A_WARN, + }, /* Got an I_NOT_DC */ - { - /* S_IDLE ==> */ A_WARN|O_RELEASE, - /* S_ELECTION ==> */ A_ERROR|A_ELECTION_START|A_DC_TIMER_STOP, - /* S_INTEGRATION ==> */ A_ERROR|O_RELEASE, - /* S_FINALIZE_JOIN ==> */ A_ERROR|O_RELEASE, - /* S_NOT_DC ==> */ A_LOG, - /* S_POLICY_ENGINE ==> */ A_ERROR|O_RELEASE, - /* S_RECOVERY ==> */ A_ERROR|O_RELEASE, - /* S_RELEASE_DC ==> */ A_ERROR|O_RELEASE, - /* S_STARTING ==> */ A_WARN, - /* S_PENDING ==> */ A_LOG|A_DC_TIMER_STOP, - /* S_STOPPING ==> */ A_WARN, - /* S_TERMINATE ==> */ A_WARN, - /* S_TRANSITION_ENGINE ==> */ A_ERROR|O_RELEASE, - /* S_HALT ==> */ A_WARN, - }, + { + /* S_IDLE ==> */ A_WARN | O_RELEASE, + /* S_ELECTION ==> */ A_ERROR | A_ELECTION_START | A_DC_TIMER_STOP, + /* S_INTEGRATION ==> */ A_ERROR | O_RELEASE, + /* S_FINALIZE_JOIN ==> */ A_ERROR | O_RELEASE, + /* S_NOT_DC ==> */ A_LOG, + /* S_POLICY_ENGINE ==> */ A_ERROR | O_RELEASE, + /* S_RECOVERY ==> */ A_ERROR | O_RELEASE, + /* S_RELEASE_DC ==> */ A_ERROR | O_RELEASE, + /* S_STARTING ==> */ A_WARN, + /* S_PENDING ==> */ A_LOG | A_DC_TIMER_STOP, + /* S_STOPPING ==> */ A_WARN, + /* S_TERMINATE ==> */ A_WARN, + /* S_TRANSITION_ENGINE ==> */ A_ERROR | O_RELEASE, + /* S_HALT ==> */ A_WARN, + }, /* Got an I_RECOVERED */ - { - /* S_IDLE ==> */ A_WARN, - /* S_ELECTION ==> */ A_ELECTION_VOTE, - /* S_INTEGRATION ==> */ A_WARN, - /* S_FINALIZE_JOIN ==> */ A_WARN, - /* S_NOT_DC ==> */ A_WARN, - /* S_POLICY_ENGINE ==> */ A_WARN, - /* S_RECOVERY ==> */ A_LOG, - /* S_RELEASE_DC ==> */ A_WARN, - /* S_STARTING ==> */ A_WARN, - /* S_PENDING ==> */ A_WARN, - /* S_STOPPING ==> */ A_WARN, - /* S_TERMINATE ==> */ A_WARN, - /* S_TRANSITION_ENGINE ==> */ A_WARN, - /* S_HALT ==> */ A_WARN, - }, + { + /* S_IDLE ==> */ A_WARN, + /* S_ELECTION ==> */ A_ELECTION_VOTE, + /* S_INTEGRATION ==> */ A_WARN, + /* S_FINALIZE_JOIN ==> */ A_WARN, + /* S_NOT_DC ==> */ A_WARN, + /* S_POLICY_ENGINE ==> */ A_WARN, + /* S_RECOVERY ==> */ A_LOG, + /* S_RELEASE_DC ==> */ A_WARN, + /* S_STARTING ==> */ A_WARN, + /* S_PENDING ==> */ A_WARN, + /* S_STOPPING ==> */ A_WARN, + /* S_TERMINATE ==> */ A_WARN, + /* S_TRANSITION_ENGINE ==> */ A_WARN, + /* S_HALT ==> */ A_WARN, + }, /* Got an I_RELEASE_FAIL */ - { - /* S_IDLE ==> */ A_WARN, - /* S_ELECTION ==> */ A_WARN, - /* S_INTEGRATION ==> */ A_WARN, - /* S_FINALIZE_JOIN ==> */ A_WARN, - /* S_NOT_DC ==> */ A_WARN, - /* S_POLICY_ENGINE ==> */ A_NOTHING, - /* S_RECOVERY ==> */ A_WARN|A_SHUTDOWN_REQ, - /* S_RELEASE_DC ==> */ A_NOTHING, - /* S_STARTING ==> */ A_WARN, - /* S_PENDING ==> */ A_WARN, - /* S_STOPPING ==> */ A_WARN, - /* S_TERMINATE ==> */ A_WARN, - /* S_TRANSITION_ENGINE ==> */ A_WARN, - /* S_HALT ==> */ A_WARN, - }, + { + /* S_IDLE ==> */ A_WARN, + /* S_ELECTION ==> */ A_WARN, + /* S_INTEGRATION ==> */ A_WARN, + /* S_FINALIZE_JOIN ==> */ A_WARN, + /* S_NOT_DC ==> */ A_WARN, + /* S_POLICY_ENGINE ==> */ A_NOTHING, + /* S_RECOVERY ==> */ A_WARN | A_SHUTDOWN_REQ, + /* S_RELEASE_DC ==> */ A_NOTHING, + /* S_STARTING ==> */ A_WARN, + /* S_PENDING ==> */ A_WARN, + /* S_STOPPING ==> */ A_WARN, + /* S_TERMINATE ==> */ A_WARN, + /* S_TRANSITION_ENGINE ==> */ A_WARN, + /* S_HALT ==> */ A_WARN, + }, /* Got an I_RELEASE_SUCCESS */ - { - /* S_IDLE ==> */ A_WARN, - /* S_ELECTION ==> */ A_WARN, - /* S_INTEGRATION ==> */ A_WARN, - /* S_FINALIZE_JOIN ==> */ A_WARN, - /* S_NOT_DC ==> */ A_WARN, - /* S_POLICY_ENGINE ==> */ A_WARN, - /* S_RECOVERY ==> */ A_WARN, - /* S_RELEASE_DC ==> */ A_LOG, - /* S_STARTING ==> */ A_WARN, - /* S_PENDING ==> */ A_LOG, - /* S_STOPPING ==> */ A_WARN, - /* S_TERMINATE ==> */ A_WARN, - /* S_TRANSITION_ENGINE ==> */ A_WARN, - /* S_HALT ==> */ A_WARN, - }, + { + /* S_IDLE ==> */ A_WARN, + /* S_ELECTION ==> */ A_WARN, + /* S_INTEGRATION ==> */ A_WARN, + /* S_FINALIZE_JOIN ==> */ A_WARN, + /* S_NOT_DC ==> */ A_WARN, + /* S_POLICY_ENGINE ==> */ A_WARN, + /* S_RECOVERY ==> */ A_WARN, + /* S_RELEASE_DC ==> */ A_LOG, + /* S_STARTING ==> */ A_WARN, + /* S_PENDING ==> */ A_LOG, + /* S_STOPPING ==> */ A_WARN, + /* S_TERMINATE ==> */ A_WARN, + /* S_TRANSITION_ENGINE ==> */ A_WARN, + /* S_HALT ==> */ A_WARN, + }, /* Got an I_RESTART */ - { - /* S_IDLE ==> */ A_NOTHING, - /* S_ELECTION ==> */ A_LOG|A_ELECTION_VOTE, - /* S_INTEGRATION ==> */ A_LOG|A_DC_JOIN_OFFER_ALL, - /* S_FINALIZE_JOIN ==> */ A_LOG|A_DC_JOIN_FINALIZE, - /* S_NOT_DC ==> */ A_LOG|A_NOTHING, - /* S_POLICY_ENGINE ==> */ A_LOG|A_PE_INVOKE, - /* S_RECOVERY ==> */ A_LOG|A_RECOVER|O_RELEASE, - /* S_RELEASE_DC ==> */ A_LOG|O_RELEASE, - /* S_STARTING ==> */ A_LOG, - /* S_PENDING ==> */ A_LOG, - /* S_STOPPING ==> */ A_LOG, - /* S_TERMINATE ==> */ A_LOG, - /* S_TRANSITION_ENGINE ==> */ A_LOG|A_TE_INVOKE, - /* S_HALT ==> */ A_WARN, - }, + { + /* S_IDLE ==> */ A_NOTHING, + /* S_ELECTION ==> */ A_LOG | A_ELECTION_VOTE, + /* S_INTEGRATION ==> */ A_LOG | A_DC_JOIN_OFFER_ALL, + /* S_FINALIZE_JOIN ==> */ A_LOG | A_DC_JOIN_FINALIZE, + /* S_NOT_DC ==> */ A_LOG | A_NOTHING, + /* S_POLICY_ENGINE ==> */ A_LOG | A_PE_INVOKE, + /* S_RECOVERY ==> */ A_LOG | A_RECOVER | O_RELEASE, + /* S_RELEASE_DC ==> */ A_LOG | O_RELEASE, + /* S_STARTING ==> */ A_LOG, + /* S_PENDING ==> */ A_LOG, + /* S_STOPPING ==> */ A_LOG, + /* S_TERMINATE ==> */ A_LOG, + /* S_TRANSITION_ENGINE ==> */ A_LOG | A_TE_INVOKE, + /* S_HALT ==> */ A_WARN, + }, /* Got an I_TE_SUCCESS */ - { - /* S_IDLE ==> */ A_LOG, - /* S_ELECTION ==> */ A_WARN, - /* S_INTEGRATION ==> */ A_WARN, - /* S_FINALIZE_JOIN ==> */ A_WARN, - /* S_NOT_DC ==> */ A_ERROR, - /* S_POLICY_ENGINE ==> */ A_WARN, - /* S_RECOVERY ==> */ A_RECOVER|A_WARN, - /* S_RELEASE_DC ==> */ A_WARN, - /* S_STARTING ==> */ A_ERROR, - /* S_PENDING ==> */ A_ERROR, - /* S_STOPPING ==> */ A_WARN, - /* S_TERMINATE ==> */ A_WARN, - /* S_TRANSITION_ENGINE ==> */ A_LOG, - /* S_HALT ==> */ A_WARN, - }, + { + /* S_IDLE ==> */ A_LOG, + /* S_ELECTION ==> */ A_WARN, + /* S_INTEGRATION ==> */ A_WARN, + /* S_FINALIZE_JOIN ==> */ A_WARN, + /* S_NOT_DC ==> */ A_ERROR, + /* S_POLICY_ENGINE ==> */ A_WARN, + /* S_RECOVERY ==> */ A_RECOVER | A_WARN, + /* S_RELEASE_DC ==> */ A_WARN, + /* S_STARTING ==> */ A_ERROR, + /* S_PENDING ==> */ A_ERROR, + /* S_STOPPING ==> */ A_WARN, + /* S_TERMINATE ==> */ A_WARN, + /* S_TRANSITION_ENGINE ==> */ A_LOG, + /* S_HALT ==> */ A_WARN, + }, /* Got an I_ROUTER */ - { - /* S_IDLE ==> */ A_MSG_ROUTE, - /* S_ELECTION ==> */ A_MSG_ROUTE, - /* S_INTEGRATION ==> */ A_MSG_ROUTE, - /* S_FINALIZE_JOIN ==> */ A_MSG_ROUTE, - /* S_NOT_DC ==> */ A_MSG_ROUTE, - /* S_POLICY_ENGINE ==> */ A_MSG_ROUTE, - /* S_RECOVERY ==> */ A_MSG_ROUTE, - /* S_RELEASE_DC ==> */ A_MSG_ROUTE, - /* S_STARTING ==> */ A_MSG_ROUTE, - /* S_PENDING ==> */ A_MSG_ROUTE, - /* S_STOPPING ==> */ A_MSG_ROUTE, - /* S_TERMINATE ==> */ A_MSG_ROUTE, - /* S_TRANSITION_ENGINE ==> */ A_MSG_ROUTE, - /* S_HALT ==> */ A_WARN|A_MSG_ROUTE, - }, + { + /* S_IDLE ==> */ A_MSG_ROUTE, + /* S_ELECTION ==> */ A_MSG_ROUTE, + /* S_INTEGRATION ==> */ A_MSG_ROUTE, + /* S_FINALIZE_JOIN ==> */ A_MSG_ROUTE, + /* S_NOT_DC ==> */ A_MSG_ROUTE, + /* S_POLICY_ENGINE ==> */ A_MSG_ROUTE, + /* S_RECOVERY ==> */ A_MSG_ROUTE, + /* S_RELEASE_DC ==> */ A_MSG_ROUTE, + /* S_STARTING ==> */ A_MSG_ROUTE, + /* S_PENDING ==> */ A_MSG_ROUTE, + /* S_STOPPING ==> */ A_MSG_ROUTE, + /* S_TERMINATE ==> */ A_MSG_ROUTE, + /* S_TRANSITION_ENGINE ==> */ A_MSG_ROUTE, + /* S_HALT ==> */ A_WARN | A_MSG_ROUTE, + }, /* Got an I_SHUTDOWN */ - { - /* S_IDLE ==> */ A_LOG|A_SHUTDOWN_REQ, - /* S_ELECTION ==> */ A_LOG|A_SHUTDOWN_REQ|A_ELECTION_VOTE, - /* S_INTEGRATION ==> */ A_LOG|A_SHUTDOWN_REQ, - /* S_FINALIZE_JOIN ==> */ A_LOG|A_SHUTDOWN_REQ, - /* S_NOT_DC ==> */ A_SHUTDOWN_REQ, - /* S_POLICY_ENGINE ==> */ A_LOG|A_SHUTDOWN_REQ, - /* S_RECOVERY ==> */ A_WARN|O_EXIT|O_RELEASE, - /* S_RELEASE_DC ==> */ A_WARN|A_SHUTDOWN_REQ, - /* S_STARTING ==> */ A_WARN|O_EXIT, - /* S_PENDING ==> */ A_SHUTDOWN_REQ, - /* S_STOPPING ==> */ A_LOG, - /* S_TERMINATE ==> */ A_LOG, - /* S_TRANSITION_ENGINE ==> */ A_WARN|A_SHUTDOWN_REQ, - /* S_HALT ==> */ A_WARN|A_ELECTION_START|A_SHUTDOWN_REQ, - }, + { + /* S_IDLE ==> */ A_LOG | A_SHUTDOWN_REQ, + /* S_ELECTION ==> */ A_LOG | A_SHUTDOWN_REQ | A_ELECTION_VOTE, + /* S_INTEGRATION ==> */ A_LOG | A_SHUTDOWN_REQ, + /* S_FINALIZE_JOIN ==> */ A_LOG | A_SHUTDOWN_REQ, + /* S_NOT_DC ==> */ A_SHUTDOWN_REQ, + /* S_POLICY_ENGINE ==> */ A_LOG | A_SHUTDOWN_REQ, + /* S_RECOVERY ==> */ A_WARN | O_EXIT | O_RELEASE, + /* S_RELEASE_DC ==> */ A_WARN | A_SHUTDOWN_REQ, + /* S_STARTING ==> */ A_WARN | O_EXIT, + /* S_PENDING ==> */ A_SHUTDOWN_REQ, + /* S_STOPPING ==> */ A_LOG, + /* S_TERMINATE ==> */ A_LOG, + /* S_TRANSITION_ENGINE ==> */ A_WARN | A_SHUTDOWN_REQ, + /* S_HALT ==> */ A_WARN | A_ELECTION_START | A_SHUTDOWN_REQ, + }, /* Got an I_STOP */ - { - /* S_IDLE ==> */ A_ERROR|O_RELEASE|O_EXIT, - /* S_ELECTION ==> */ O_RELEASE|O_EXIT, - /* S_INTEGRATION ==> */ A_WARN|O_RELEASE|O_EXIT, - /* S_FINALIZE_JOIN ==> */ A_ERROR|O_RELEASE|O_EXIT, - /* S_NOT_DC ==> */ O_EXIT, - /* S_POLICY_ENGINE ==> */ A_WARN|O_RELEASE|O_EXIT, - /* S_RECOVERY ==> */ A_ERROR|O_RELEASE|O_EXIT, - /* S_RELEASE_DC ==> */ A_ERROR|O_RELEASE|O_EXIT, - /* S_STARTING ==> */ O_EXIT, - /* S_PENDING ==> */ O_EXIT, - /* S_STOPPING ==> */ O_EXIT, - /* S_TERMINATE ==> */ A_ERROR|A_EXIT_1, - /* S_TRANSITION_ENGINE ==> */ A_LOG|O_RELEASE|O_EXIT, - /* S_HALT ==> */ O_RELEASE|O_EXIT|A_WARN, - }, + { + /* S_IDLE ==> */ A_ERROR | O_RELEASE | O_EXIT, + /* S_ELECTION ==> */ O_RELEASE | O_EXIT, + /* S_INTEGRATION ==> */ A_WARN | O_RELEASE | O_EXIT, + /* S_FINALIZE_JOIN ==> */ A_ERROR | O_RELEASE | O_EXIT, + /* S_NOT_DC ==> */ O_EXIT, + /* S_POLICY_ENGINE ==> */ A_WARN | O_RELEASE | O_EXIT, + /* S_RECOVERY ==> */ A_ERROR | O_RELEASE | O_EXIT, + /* S_RELEASE_DC ==> */ A_ERROR | O_RELEASE | O_EXIT, + /* S_STARTING ==> */ O_EXIT, + /* S_PENDING ==> */ O_EXIT, + /* S_STOPPING ==> */ O_EXIT, + /* S_TERMINATE ==> */ A_ERROR | A_EXIT_1, + /* S_TRANSITION_ENGINE ==> */ A_LOG | O_RELEASE | O_EXIT, + /* S_HALT ==> */ O_RELEASE | O_EXIT | A_WARN, + }, /* Got an I_TERMINATE */ - { - /* S_IDLE ==> */ A_ERROR|O_EXIT, - /* S_ELECTION ==> */ A_ERROR|O_EXIT, - /* S_INTEGRATION ==> */ A_ERROR|O_EXIT, - /* S_FINALIZE_JOIN ==> */ A_ERROR|O_EXIT, - /* S_NOT_DC ==> */ A_ERROR|O_EXIT, - /* S_POLICY_ENGINE ==> */ A_ERROR|O_EXIT, - /* S_RECOVERY ==> */ A_ERROR|O_EXIT, - /* S_RELEASE_DC ==> */ A_ERROR|O_EXIT, - /* S_STARTING ==> */ O_EXIT, - /* S_PENDING ==> */ A_ERROR|O_EXIT, - /* S_STOPPING ==> */ O_EXIT, - /* S_TERMINATE ==> */ O_EXIT, - /* S_TRANSITION_ENGINE ==> */ A_ERROR|O_EXIT, - /* S_HALT ==> */ A_ERROR|O_EXIT, - }, + { + /* S_IDLE ==> */ A_ERROR | O_EXIT, + /* S_ELECTION ==> */ A_ERROR | O_EXIT, + /* S_INTEGRATION ==> */ A_ERROR | O_EXIT, + /* S_FINALIZE_JOIN ==> */ A_ERROR | O_EXIT, + /* S_NOT_DC ==> */ A_ERROR | O_EXIT, + /* S_POLICY_ENGINE ==> */ A_ERROR | O_EXIT, + /* S_RECOVERY ==> */ A_ERROR | O_EXIT, + /* S_RELEASE_DC ==> */ A_ERROR | O_EXIT, + /* S_STARTING ==> */ O_EXIT, + /* S_PENDING ==> */ A_ERROR | O_EXIT, + /* S_STOPPING ==> */ O_EXIT, + /* S_TERMINATE ==> */ O_EXIT, + /* S_TRANSITION_ENGINE ==> */ A_ERROR | O_EXIT, + /* S_HALT ==> */ A_ERROR | O_EXIT, + }, /* Got an I_STARTUP */ - { - /* S_IDLE ==> */ A_WARN, - /* S_ELECTION ==> */ A_WARN, - /* S_INTEGRATION ==> */ A_WARN, - /* S_FINALIZE_JOIN ==> */ A_WARN, - /* S_NOT_DC ==> */ A_WARN, - /* S_POLICY_ENGINE ==> */ A_WARN, - /* S_RECOVERY ==> */ A_WARN, - /* S_RELEASE_DC ==> */ A_WARN, - /* S_STARTING ==> */ A_LOG|A_STARTUP|A_CIB_START|A_LRM_CONNECT|A_CCM_CONNECT|A_HA_CONNECT|A_READCONFIG|A_STARTED, - /* S_PENDING ==> */ A_LOG, - /* S_STOPPING ==> */ A_WARN, - /* S_TERMINATE ==> */ A_WARN, - /* S_TRANSITION_ENGINE ==> */ A_WARN, - /* S_HALT ==> */ A_WARN, - }, + { + /* S_IDLE ==> */ A_WARN, + /* S_ELECTION ==> */ A_WARN, + /* S_INTEGRATION ==> */ A_WARN, + /* S_FINALIZE_JOIN ==> */ A_WARN, + /* S_NOT_DC ==> */ A_WARN, + /* S_POLICY_ENGINE ==> */ A_WARN, + /* S_RECOVERY ==> */ A_WARN, + /* S_RELEASE_DC ==> */ A_WARN, + /* S_STARTING ==> */ + A_LOG | A_STARTUP | A_CIB_START | A_LRM_CONNECT | A_CCM_CONNECT | A_HA_CONNECT | A_READCONFIG | + A_STARTED, + /* S_PENDING ==> */ A_LOG, + /* S_STOPPING ==> */ A_WARN, + /* S_TERMINATE ==> */ A_WARN, + /* S_TRANSITION_ENGINE ==> */ A_WARN, + /* S_HALT ==> */ A_WARN, + }, /* Got an I_PE_SUCCESS */ - { - /* S_IDLE ==> */ A_LOG, - /* S_ELECTION ==> */ A_WARN, - /* S_INTEGRATION ==> */ A_WARN, - /* S_FINALIZE_JOIN ==> */ A_WARN, - /* S_NOT_DC ==> */ A_NOTHING, - /* S_POLICY_ENGINE ==> */ A_LOG|A_TE_INVOKE, - /* S_RECOVERY ==> */ A_RECOVER|A_LOG, - /* S_RELEASE_DC ==> */ A_LOG, - /* S_STARTING ==> */ A_ERROR, - /* S_PENDING ==> */ A_LOG, - /* S_STOPPING ==> */ A_ERROR, - /* S_TERMINATE ==> */ A_ERROR, - /* S_TRANSITION_ENGINE ==> */ A_LOG, - /* S_HALT ==> */ A_WARN, - }, + { + /* S_IDLE ==> */ A_LOG, + /* S_ELECTION ==> */ A_WARN, + /* S_INTEGRATION ==> */ A_WARN, + /* S_FINALIZE_JOIN ==> */ A_WARN, + /* S_NOT_DC ==> */ A_NOTHING, + /* S_POLICY_ENGINE ==> */ A_LOG | A_TE_INVOKE, + /* S_RECOVERY ==> */ A_RECOVER | A_LOG, + /* S_RELEASE_DC ==> */ A_LOG, + /* S_STARTING ==> */ A_ERROR, + /* S_PENDING ==> */ A_LOG, + /* S_STOPPING ==> */ A_ERROR, + /* S_TERMINATE ==> */ A_ERROR, + /* S_TRANSITION_ENGINE ==> */ A_LOG, + /* S_HALT ==> */ A_WARN, + }, /* Got an I_JOIN_OFFER */ - { - /* S_IDLE ==> */ A_WARN|A_CL_JOIN_REQUEST, - /* S_ELECTION ==> */ A_WARN|A_ELECTION_VOTE, - /* S_INTEGRATION ==> */ A_CL_JOIN_REQUEST, - /* S_FINALIZE_JOIN ==> */ A_CL_JOIN_REQUEST, - /* S_NOT_DC ==> */ A_CL_JOIN_REQUEST|A_DC_TIMER_STOP, - /* S_POLICY_ENGINE ==> */ A_WARN|A_CL_JOIN_REQUEST, - /* S_RECOVERY ==> */ A_WARN|A_CL_JOIN_REQUEST|A_DC_TIMER_STOP, - /* S_RELEASE_DC ==> */ A_WARN|A_CL_JOIN_REQUEST|A_DC_TIMER_STOP, - /* S_STARTING ==> */ A_LOG, - /* S_PENDING ==> */ A_CL_JOIN_REQUEST|A_DC_TIMER_STOP, - /* S_STOPPING ==> */ A_LOG, - /* S_TERMINATE ==> */ A_LOG, - /* S_TRANSITION_ENGINE ==> */ A_WARN|A_CL_JOIN_REQUEST, - /* S_HALT ==> */ A_WARN, - }, + { + /* S_IDLE ==> */ A_WARN | A_CL_JOIN_REQUEST, + /* S_ELECTION ==> */ A_WARN | A_ELECTION_VOTE, + /* S_INTEGRATION ==> */ A_CL_JOIN_REQUEST, + /* S_FINALIZE_JOIN ==> */ A_CL_JOIN_REQUEST, + /* S_NOT_DC ==> */ A_CL_JOIN_REQUEST | A_DC_TIMER_STOP, + /* S_POLICY_ENGINE ==> */ A_WARN | A_CL_JOIN_REQUEST, + /* S_RECOVERY ==> */ A_WARN | A_CL_JOIN_REQUEST | A_DC_TIMER_STOP, + /* S_RELEASE_DC ==> */ A_WARN | A_CL_JOIN_REQUEST | A_DC_TIMER_STOP, + /* S_STARTING ==> */ A_LOG, + /* S_PENDING ==> */ A_CL_JOIN_REQUEST | A_DC_TIMER_STOP, + /* S_STOPPING ==> */ A_LOG, + /* S_TERMINATE ==> */ A_LOG, + /* S_TRANSITION_ENGINE ==> */ A_WARN | A_CL_JOIN_REQUEST, + /* S_HALT ==> */ A_WARN, + }, /* Got an I_JOIN_REQUEST */ - { - /* S_IDLE ==> */ A_DC_JOIN_OFFER_ONE, - /* S_ELECTION ==> */ A_WARN, - /* S_INTEGRATION ==> */ A_DC_JOIN_PROCESS_REQ, - /* S_FINALIZE_JOIN ==> */ A_DC_JOIN_OFFER_ONE, - /* S_NOT_DC ==> */ A_WARN, - /* S_POLICY_ENGINE ==> */ A_DC_JOIN_OFFER_ONE, - /* S_RECOVERY ==> */ A_WARN, - /* S_RELEASE_DC ==> */ A_WARN, - /* S_STARTING ==> */ A_WARN, - /* S_PENDING ==> */ A_WARN, - /* S_STOPPING ==> */ A_WARN, - /* S_TERMINATE ==> */ A_WARN, - /* S_TRANSITION_ENGINE ==> */ A_DC_JOIN_OFFER_ONE, - /* S_HALT ==> */ A_WARN, - }, + { + /* S_IDLE ==> */ A_DC_JOIN_OFFER_ONE, + /* S_ELECTION ==> */ A_WARN, + /* S_INTEGRATION ==> */ A_DC_JOIN_PROCESS_REQ, + /* S_FINALIZE_JOIN ==> */ A_DC_JOIN_OFFER_ONE, + /* S_NOT_DC ==> */ A_WARN, + /* S_POLICY_ENGINE ==> */ A_DC_JOIN_OFFER_ONE, + /* S_RECOVERY ==> */ A_WARN, + /* S_RELEASE_DC ==> */ A_WARN, + /* S_STARTING ==> */ A_WARN, + /* S_PENDING ==> */ A_WARN, + /* S_STOPPING ==> */ A_WARN, + /* S_TERMINATE ==> */ A_WARN, + /* S_TRANSITION_ENGINE ==> */ A_DC_JOIN_OFFER_ONE, + /* S_HALT ==> */ A_WARN, + }, /* Got an I_JOIN_RESULT */ - { - /* S_IDLE ==> */ A_ERROR|A_TE_HALT|A_DC_JOIN_OFFER_ALL, - /* S_ELECTION ==> */ A_LOG, - /* S_INTEGRATION ==> */ A_LOG, - /* S_FINALIZE_JOIN ==> */ A_CL_JOIN_RESULT|A_DC_JOIN_PROCESS_ACK, - /* S_NOT_DC ==> */ A_ERROR|A_CL_JOIN_ANNOUNCE, - /* S_POLICY_ENGINE ==> */ A_ERROR|A_TE_HALT|A_DC_JOIN_OFFER_ALL, - /* S_RECOVERY ==> */ A_LOG, - /* S_RELEASE_DC ==> */ A_LOG, - /* S_STARTING ==> */ A_ERROR, - /* S_PENDING ==> */ A_CL_JOIN_RESULT, - /* S_STOPPING ==> */ A_ERROR, - /* S_TERMINATE ==> */ A_ERROR, - /* S_TRANSITION_ENGINE ==> */ A_ERROR|A_TE_HALT|A_DC_JOIN_OFFER_ALL, - /* S_HALT ==> */ A_WARN, - }, - + { + /* S_IDLE ==> */ A_ERROR | A_TE_HALT | A_DC_JOIN_OFFER_ALL, + /* S_ELECTION ==> */ A_LOG, + /* S_INTEGRATION ==> */ A_LOG, + /* S_FINALIZE_JOIN ==> */ A_CL_JOIN_RESULT | A_DC_JOIN_PROCESS_ACK, + /* S_NOT_DC ==> */ A_ERROR | A_CL_JOIN_ANNOUNCE, + /* S_POLICY_ENGINE ==> */ A_ERROR | A_TE_HALT | A_DC_JOIN_OFFER_ALL, + /* S_RECOVERY ==> */ A_LOG, + /* S_RELEASE_DC ==> */ A_LOG, + /* S_STARTING ==> */ A_ERROR, + /* S_PENDING ==> */ A_CL_JOIN_RESULT, + /* S_STOPPING ==> */ A_ERROR, + /* S_TERMINATE ==> */ A_ERROR, + /* S_TRANSITION_ENGINE ==> */ A_ERROR | A_TE_HALT | A_DC_JOIN_OFFER_ALL, + /* S_HALT ==> */ A_WARN, + }, + /* Got an I_WAIT_FOR_EVENT */ - { - /* S_IDLE ==> */ A_LOG, - /* S_ELECTION ==> */ A_LOG, - /* S_INTEGRATION ==> */ A_LOG, - /* S_FINALIZE_JOIN ==> */ A_LOG, - /* S_NOT_DC ==> */ A_LOG, - /* S_POLICY_ENGINE ==> */ A_LOG, - /* S_RECOVERY ==> */ A_LOG, - /* S_RELEASE_DC ==> */ A_LOG, - /* S_STARTING ==> */ A_LOG, - /* S_PENDING ==> */ A_LOG, - /* S_STOPPING ==> */ A_LOG, - /* S_TERMINATE ==> */ A_LOG, - /* S_TRANSITION_ENGINE ==> */ A_LOG, - /* S_HALT ==> */ A_WARN, - }, + { + /* S_IDLE ==> */ A_LOG, + /* S_ELECTION ==> */ A_LOG, + /* S_INTEGRATION ==> */ A_LOG, + /* S_FINALIZE_JOIN ==> */ A_LOG, + /* S_NOT_DC ==> */ A_LOG, + /* S_POLICY_ENGINE ==> */ A_LOG, + /* S_RECOVERY ==> */ A_LOG, + /* S_RELEASE_DC ==> */ A_LOG, + /* S_STARTING ==> */ A_LOG, + /* S_PENDING ==> */ A_LOG, + /* S_STOPPING ==> */ A_LOG, + /* S_TERMINATE ==> */ A_LOG, + /* S_TRANSITION_ENGINE ==> */ A_LOG, + /* S_HALT ==> */ A_WARN, + }, /* Got an I_DC_HEARTBEAT */ - { - /* S_IDLE ==> */ A_ERROR, - /* S_ELECTION ==> */ A_WARN|A_ELECTION_VOTE, - /* S_INTEGRATION ==> */ A_ERROR, - /* S_FINALIZE_JOIN ==> */ A_ERROR, - /* S_NOT_DC ==> */ A_NOTHING, - /* S_POLICY_ENGINE ==> */ A_ERROR, - /* S_RECOVERY ==> */ A_NOTHING, - /* S_RELEASE_DC ==> */ A_LOG, - /* S_STARTING ==> */ A_LOG, - /* S_PENDING ==> */ A_LOG|A_CL_JOIN_ANNOUNCE, - /* S_STOPPING ==> */ A_NOTHING, - /* S_TERMINATE ==> */ A_NOTHING, - /* S_TRANSITION_ENGINE ==> */ A_ERROR, - /* S_HALT ==> */ A_WARN, - }, + { + /* S_IDLE ==> */ A_ERROR, + /* S_ELECTION ==> */ A_WARN | A_ELECTION_VOTE, + /* S_INTEGRATION ==> */ A_ERROR, + /* S_FINALIZE_JOIN ==> */ A_ERROR, + /* S_NOT_DC ==> */ A_NOTHING, + /* S_POLICY_ENGINE ==> */ A_ERROR, + /* S_RECOVERY ==> */ A_NOTHING, + /* S_RELEASE_DC ==> */ A_LOG, + /* S_STARTING ==> */ A_LOG, + /* S_PENDING ==> */ A_LOG | A_CL_JOIN_ANNOUNCE, + /* S_STOPPING ==> */ A_NOTHING, + /* S_TERMINATE ==> */ A_NOTHING, + /* S_TRANSITION_ENGINE ==> */ A_ERROR, + /* S_HALT ==> */ A_WARN, + }, /* Got an I_LRM_EVENT */ - { - /* S_IDLE ==> */ A_LRM_EVENT, - /* S_ELECTION ==> */ A_LRM_EVENT, - /* S_INTEGRATION ==> */ A_LRM_EVENT, - /* S_FINALIZE_JOIN ==> */ A_LRM_EVENT, - /* S_NOT_DC ==> */ A_LRM_EVENT, - /* S_POLICY_ENGINE ==> */ A_LRM_EVENT, - /* S_RECOVERY ==> */ A_LRM_EVENT, - /* S_RELEASE_DC ==> */ A_LRM_EVENT, - /* S_STARTING ==> */ A_LRM_EVENT, - /* S_PENDING ==> */ A_LRM_EVENT, - /* S_STOPPING ==> */ A_LRM_EVENT, - /* S_TERMINATE ==> */ A_LRM_EVENT, - /* S_TRANSITION_ENGINE ==> */ A_LRM_EVENT, - /* S_HALT ==> */ A_WARN, - }, + { + /* S_IDLE ==> */ A_LRM_EVENT, + /* S_ELECTION ==> */ A_LRM_EVENT, + /* S_INTEGRATION ==> */ A_LRM_EVENT, + /* S_FINALIZE_JOIN ==> */ A_LRM_EVENT, + /* S_NOT_DC ==> */ A_LRM_EVENT, + /* S_POLICY_ENGINE ==> */ A_LRM_EVENT, + /* S_RECOVERY ==> */ A_LRM_EVENT, + /* S_RELEASE_DC ==> */ A_LRM_EVENT, + /* S_STARTING ==> */ A_LRM_EVENT, + /* S_PENDING ==> */ A_LRM_EVENT, + /* S_STOPPING ==> */ A_LRM_EVENT, + /* S_TERMINATE ==> */ A_LRM_EVENT, + /* S_TRANSITION_ENGINE ==> */ A_LRM_EVENT, + /* S_HALT ==> */ A_WARN, + }, /* For everyone ending up in S_PENDING, (re)start the DC timer and wait for I_JOIN_OFFER or I_NOT_DC */ /* Got an I_PENDING */ - { - /* S_IDLE ==> */ O_RELEASE|O_DC_TIMER_RESTART, - /* S_ELECTION ==> */ O_RELEASE|O_DC_TIMER_RESTART, - /* S_INTEGRATION ==> */ O_RELEASE|O_DC_TIMER_RESTART, - /* S_FINALIZE_JOIN ==> */ O_RELEASE|O_DC_TIMER_RESTART, - /* S_NOT_DC ==> */ A_LOG|O_DC_TIMER_RESTART, - /* S_POLICY_ENGINE ==> */ O_RELEASE|O_DC_TIMER_RESTART, - /* S_RECOVERY ==> */ A_WARN, - /* S_RELEASE_DC ==> */ A_WARN|O_DC_TIMER_RESTART, - /* S_STARTING ==> */ A_LOG|A_DC_TIMER_START|A_CL_JOIN_QUERY, - /* S_PENDING ==> */ A_LOG|O_DC_TIMER_RESTART, - /* S_STOPPING ==> */ A_WARN, - /* S_TERMINATE ==> */ A_WARN, - /* S_TRANSITION_ENGINE ==> */ O_RELEASE|O_DC_TIMER_RESTART, - /* S_HALT ==> */ A_WARN, - }, + { + /* S_IDLE ==> */ O_RELEASE | O_DC_TIMER_RESTART, + /* S_ELECTION ==> */ O_RELEASE | O_DC_TIMER_RESTART, + /* S_INTEGRATION ==> */ O_RELEASE | O_DC_TIMER_RESTART, + /* S_FINALIZE_JOIN ==> */ O_RELEASE | O_DC_TIMER_RESTART, + /* S_NOT_DC ==> */ A_LOG | O_DC_TIMER_RESTART, + /* S_POLICY_ENGINE ==> */ O_RELEASE | O_DC_TIMER_RESTART, + /* S_RECOVERY ==> */ A_WARN, + /* S_RELEASE_DC ==> */ A_WARN | O_DC_TIMER_RESTART, + /* S_STARTING ==> */ A_LOG | A_DC_TIMER_START | A_CL_JOIN_QUERY, + /* S_PENDING ==> */ A_LOG | O_DC_TIMER_RESTART, + /* S_STOPPING ==> */ A_WARN, + /* S_TERMINATE ==> */ A_WARN, + /* S_TRANSITION_ENGINE ==> */ O_RELEASE | O_DC_TIMER_RESTART, + /* S_HALT ==> */ A_WARN, + }, /* Got an I_HALT */ - { - /* S_IDLE ==> */ A_WARN, - /* S_ELECTION ==> */ A_WARN, - /* S_INTEGRATION ==> */ A_WARN, - /* S_FINALIZE_JOIN ==> */ A_WARN, - /* S_NOT_DC ==> */ A_WARN, - /* S_POLICY_ENGINE ==> */ A_WARN, - /* S_RECOVERY ==> */ A_WARN, - /* S_RELEASE_DC ==> */ A_WARN, - /* S_STARTING ==> */ A_WARN, - /* S_PENDING ==> */ A_WARN, - /* S_STOPPING ==> */ A_WARN, - /* S_TERMINATE ==> */ A_WARN, - /* S_TRANSITION_ENGINE ==> */ A_WARN, - /* S_HALT ==> */ A_WARN, - }, + { + /* S_IDLE ==> */ A_WARN, + /* S_ELECTION ==> */ A_WARN, + /* S_INTEGRATION ==> */ A_WARN, + /* S_FINALIZE_JOIN ==> */ A_WARN, + /* S_NOT_DC ==> */ A_WARN, + /* S_POLICY_ENGINE ==> */ A_WARN, + /* S_RECOVERY ==> */ A_WARN, + /* S_RELEASE_DC ==> */ A_WARN, + /* S_STARTING ==> */ A_WARN, + /* S_PENDING ==> */ A_WARN, + /* S_STOPPING ==> */ A_WARN, + /* S_TERMINATE ==> */ A_WARN, + /* S_TRANSITION_ENGINE ==> */ A_WARN, + /* S_HALT ==> */ A_WARN, + }, }; #endif diff --git a/crmd/fsa_proto.h b/crmd/fsa_proto.h index 017b433aab..a25856b4a6 100644 --- a/crmd/fsa_proto.h +++ b/crmd/fsa_proto.h @@ -1,368 +1,342 @@ /* * 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 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef XML_FSA_PROTO__H -#define XML_FSA_PROTO__H +# define XML_FSA_PROTO__H extern xmlNode *do_lrm_query(gboolean); /* A_READCONFIG */ void + do_read_config(long long action, - enum crmd_fsa_cause cause, - enum crmd_fsa_state cur_state, - enum crmd_fsa_input current_input, - fsa_data_t *msg_data); + enum crmd_fsa_cause cause, + enum crmd_fsa_state cur_state, + enum crmd_fsa_input current_input, fsa_data_t * msg_data); /* A_PE_INVOKE */ void + do_pe_invoke(long long action, - enum crmd_fsa_cause cause, - enum crmd_fsa_state cur_state, - enum crmd_fsa_input current_input, - fsa_data_t *msg_data); + enum crmd_fsa_cause cause, + enum crmd_fsa_state cur_state, + enum crmd_fsa_input current_input, fsa_data_t * msg_data); /* A_ERROR */ void + do_error(long long action, - enum crmd_fsa_cause cause, - enum crmd_fsa_state cur_state, - enum crmd_fsa_input cur_input, - fsa_data_t *msg_data); + enum crmd_fsa_cause cause, + enum crmd_fsa_state cur_state, enum crmd_fsa_input cur_input, fsa_data_t * msg_data); /* A_LOG */ void + do_log(long long action, enum crmd_fsa_cause cause, - enum crmd_fsa_state cur_state, - enum crmd_fsa_input cur_input, - fsa_data_t *msg_data); + enum crmd_fsa_state cur_state, enum crmd_fsa_input cur_input, fsa_data_t * msg_data); /* A_STARTUP */ void + do_startup(long long action, - enum crmd_fsa_cause cause, - enum crmd_fsa_state cur_state, - enum crmd_fsa_input cur_input, - fsa_data_t *msg_data); + enum crmd_fsa_cause cause, + enum crmd_fsa_state cur_state, enum crmd_fsa_input cur_input, fsa_data_t * msg_data); /* A_CIB_START, STOP, RESTART */ void + do_cib_control(long long action, - enum crmd_fsa_cause cause, - enum crmd_fsa_state cur_state, - enum crmd_fsa_input cur_input, - fsa_data_t *msg_data); + enum crmd_fsa_cause cause, + enum crmd_fsa_state cur_state, enum crmd_fsa_input cur_input, fsa_data_t * msg_data); /* A_HA_CONNECT */ void + do_ha_control(long long action, - enum crmd_fsa_cause cause, - enum crmd_fsa_state cur_state, - enum crmd_fsa_input cur_input, - fsa_data_t *msg_data); + enum crmd_fsa_cause cause, + enum crmd_fsa_state cur_state, enum crmd_fsa_input cur_input, fsa_data_t * msg_data); /* A_CCM_CONNECT */ void + do_ccm_control(long long action, - enum crmd_fsa_cause cause, - enum crmd_fsa_state cur_state, - enum crmd_fsa_input cur_input, - fsa_data_t *msg_data); + enum crmd_fsa_cause cause, + enum crmd_fsa_state cur_state, enum crmd_fsa_input cur_input, fsa_data_t * msg_data); /* A_LRM_CONNECT */ void + do_lrm_control(long long action, - enum crmd_fsa_cause cause, - enum crmd_fsa_state cur_state, - enum crmd_fsa_input cur_input, - fsa_data_t *msg_data); + enum crmd_fsa_cause cause, + enum crmd_fsa_state cur_state, enum crmd_fsa_input cur_input, fsa_data_t * msg_data); /* A_PE_START, STOP, RESTART */ void + do_pe_control(long long action, - enum crmd_fsa_cause cause, - enum crmd_fsa_state cur_state, - enum crmd_fsa_input cur_input, - fsa_data_t *msg_data); + enum crmd_fsa_cause cause, + enum crmd_fsa_state cur_state, enum crmd_fsa_input cur_input, fsa_data_t * msg_data); /* A_TE_START, STOP, RESTART */ void + do_te_control(long long action, - enum crmd_fsa_cause cause, - enum crmd_fsa_state cur_state, - enum crmd_fsa_input cur_input, - fsa_data_t *msg_data); + enum crmd_fsa_cause cause, + enum crmd_fsa_state cur_state, enum crmd_fsa_input cur_input, fsa_data_t * msg_data); /* A_STARTED */ void + do_started(long long action, - enum crmd_fsa_cause cause, - enum crmd_fsa_state cur_state, - enum crmd_fsa_input cur_input, - fsa_data_t *msg_data); + enum crmd_fsa_cause cause, + enum crmd_fsa_state cur_state, enum crmd_fsa_input cur_input, fsa_data_t * msg_data); /* A_MSG_ROUTE */ void + do_msg_route(long long action, - enum crmd_fsa_cause cause, - enum crmd_fsa_state cur_state, - enum crmd_fsa_input cur_input, - fsa_data_t *msg_data); + enum crmd_fsa_cause cause, + enum crmd_fsa_state cur_state, enum crmd_fsa_input cur_input, fsa_data_t * msg_data); /* A_RECOVER */ void + do_recover(long long action, - enum crmd_fsa_cause cause, - enum crmd_fsa_state cur_state, - enum crmd_fsa_input cur_input, - fsa_data_t *msg_data); + enum crmd_fsa_cause cause, + enum crmd_fsa_state cur_state, enum crmd_fsa_input cur_input, fsa_data_t * msg_data); /* A_ELECTION_VOTE */ void + do_election_vote(long long action, - enum crmd_fsa_cause cause, - enum crmd_fsa_state cur_state, - enum crmd_fsa_input cur_input, - fsa_data_t *msg_data); + enum crmd_fsa_cause cause, + enum crmd_fsa_state cur_state, + enum crmd_fsa_input cur_input, fsa_data_t * msg_data); /* A_ELECTION_COUNT */ void + do_election_count_vote(long long action, - enum crmd_fsa_cause cause, - enum crmd_fsa_state cur_state, - enum crmd_fsa_input cur_input, - fsa_data_t *msg_data); + enum crmd_fsa_cause cause, + enum crmd_fsa_state cur_state, + enum crmd_fsa_input cur_input, fsa_data_t * msg_data); /* A_ELECTION_CHECK */ void + do_election_check(long long action, - enum crmd_fsa_cause cause, - enum crmd_fsa_state cur_state, - enum crmd_fsa_input cur_input, - fsa_data_t *msg_data); + enum crmd_fsa_cause cause, + enum crmd_fsa_state cur_state, + enum crmd_fsa_input cur_input, fsa_data_t * msg_data); /* A_ELECT_TIMER_START, A_ELECTION_TIMEOUT */ void + do_election_timer_ctrl(long long action, - enum crmd_fsa_cause cause, - enum crmd_fsa_state cur_state, - enum crmd_fsa_input cur_input, - fsa_data_t *msg_data); + enum crmd_fsa_cause cause, + enum crmd_fsa_state cur_state, + enum crmd_fsa_input cur_input, fsa_data_t * msg_data); /* A_DC_TIMER_STOP */ void + do_timer_control(long long action, - enum crmd_fsa_cause cause, - enum crmd_fsa_state cur_state, - enum crmd_fsa_input cur_input, - fsa_data_t *msg_data); + enum crmd_fsa_cause cause, + enum crmd_fsa_state cur_state, + enum crmd_fsa_input cur_input, fsa_data_t * msg_data); -#if SUPPORT_HEARTBEAT +# if SUPPORT_HEARTBEAT /* A_CCM_UPDATE_CACHE */ -void do_ccm_update_cache( - enum crmd_fsa_cause cause, enum crmd_fsa_state cur_state, - oc_ed_t event, const oc_ev_membership_t *oc, xmlNode *xml); -#endif +void do_ccm_update_cache(enum crmd_fsa_cause cause, enum crmd_fsa_state cur_state, + oc_ed_t event, const oc_ev_membership_t * oc, xmlNode * xml); +# endif /* A_CCM_EVENT */ void + do_ccm_event(long long action, - enum crmd_fsa_cause cause, - enum crmd_fsa_state cur_state, - enum crmd_fsa_input cur_input, - fsa_data_t *msg_data); + enum crmd_fsa_cause cause, + enum crmd_fsa_state cur_state, enum crmd_fsa_input cur_input, fsa_data_t * msg_data); /* A_DC_TAKEOVER */ void + do_dc_takeover(long long action, - enum crmd_fsa_cause cause, - enum crmd_fsa_state cur_state, - enum crmd_fsa_input cur_input, - fsa_data_t *msg_data); + enum crmd_fsa_cause cause, + enum crmd_fsa_state cur_state, enum crmd_fsa_input cur_input, fsa_data_t * msg_data); /* A_DC_RELEASE */ void + do_dc_release(long long action, - enum crmd_fsa_cause cause, - enum crmd_fsa_state cur_state, - enum crmd_fsa_input cur_input, - fsa_data_t *msg_data); + enum crmd_fsa_cause cause, + enum crmd_fsa_state cur_state, enum crmd_fsa_input cur_input, fsa_data_t * msg_data); /* A_DC_JOIN_OFFER_ALL */ void + do_dc_join_offer_all(long long action, - enum crmd_fsa_cause cause, - enum crmd_fsa_state cur_state, - enum crmd_fsa_input cur_input, - fsa_data_t *msg_data); + enum crmd_fsa_cause cause, + enum crmd_fsa_state cur_state, + enum crmd_fsa_input cur_input, fsa_data_t * msg_data); /* A_DC_JOIN_OFFER_ONE */ void + do_dc_join_offer_one(long long action, - enum crmd_fsa_cause cause, - enum crmd_fsa_state cur_state, - enum crmd_fsa_input cur_input, - fsa_data_t *msg_data); + enum crmd_fsa_cause cause, + enum crmd_fsa_state cur_state, + enum crmd_fsa_input cur_input, fsa_data_t * msg_data); /* A_DC_JOIN_ACK */ void + do_dc_join_ack(long long action, - enum crmd_fsa_cause cause, - enum crmd_fsa_state cur_state, - enum crmd_fsa_input cur_input, - fsa_data_t *msg_data); + enum crmd_fsa_cause cause, + enum crmd_fsa_state cur_state, enum crmd_fsa_input cur_input, fsa_data_t * msg_data); /* A_DC_JOIN_REQ */ void + do_dc_join_filter_offer(long long action, - enum crmd_fsa_cause cause, - enum crmd_fsa_state cur_state, - enum crmd_fsa_input cur_input, - fsa_data_t *msg_data); + enum crmd_fsa_cause cause, + enum crmd_fsa_state cur_state, + enum crmd_fsa_input cur_input, fsa_data_t * msg_data); /* A_DC_JOIN_FINALIZE */ void + do_dc_join_finalize(long long action, - enum crmd_fsa_cause cause, - enum crmd_fsa_state cur_state, - enum crmd_fsa_input cur_input, - fsa_data_t *msg_data); + enum crmd_fsa_cause cause, + enum crmd_fsa_state cur_state, + enum crmd_fsa_input cur_input, fsa_data_t * msg_data); /* A_CL_JOIN_QUERY */ /* is there a DC out there? */ void + do_cl_join_query(long long action, - enum crmd_fsa_cause cause, - enum crmd_fsa_state cur_state, - enum crmd_fsa_input current_input, - fsa_data_t *msg_data); + enum crmd_fsa_cause cause, + enum crmd_fsa_state cur_state, + enum crmd_fsa_input current_input, fsa_data_t * msg_data); /* A_CL_JOIN_ANNOUNCE */ void + do_cl_join_announce(long long action, - enum crmd_fsa_cause cause, - enum crmd_fsa_state cur_state, - enum crmd_fsa_input current_input, - fsa_data_t *msg_data); + enum crmd_fsa_cause cause, + enum crmd_fsa_state cur_state, + enum crmd_fsa_input current_input, fsa_data_t * msg_data); /* A_CL_JOIN_REQUEST */ void + do_cl_join_offer_respond(long long action, - enum crmd_fsa_cause cause, - enum crmd_fsa_state cur_state, - enum crmd_fsa_input current_input, - fsa_data_t *msg_data); + enum crmd_fsa_cause cause, + enum crmd_fsa_state cur_state, + enum crmd_fsa_input current_input, fsa_data_t * msg_data); /* A_CL_JOIN_RESULT */ void + do_cl_join_finalize_respond(long long action, - enum crmd_fsa_cause cause, - enum crmd_fsa_state cur_state, - enum crmd_fsa_input current_input, - fsa_data_t *msg_data); + enum crmd_fsa_cause cause, + enum crmd_fsa_state cur_state, + enum crmd_fsa_input current_input, fsa_data_t * msg_data); /* A_UPDATE_NODESTATUS */ void + do_update_node_status(long long action, - enum crmd_fsa_cause cause, - enum crmd_fsa_state cur_state, - enum crmd_fsa_input cur_input, - fsa_data_t *msg_data); + enum crmd_fsa_cause cause, + enum crmd_fsa_state cur_state, + enum crmd_fsa_input cur_input, fsa_data_t * msg_data); /* A_LRM_INVOKE */ void + do_lrm_invoke(long long action, - enum crmd_fsa_cause cause, - enum crmd_fsa_state cur_state, - enum crmd_fsa_input cur_input, - fsa_data_t *msg_data); + enum crmd_fsa_cause cause, + enum crmd_fsa_state cur_state, enum crmd_fsa_input cur_input, fsa_data_t * msg_data); /* A_LRM_EVENT */ void + do_lrm_event(long long action, - enum crmd_fsa_cause cause, - enum crmd_fsa_state cur_state, - enum crmd_fsa_input cur_input, - fsa_data_t *msg_data); + enum crmd_fsa_cause cause, + enum crmd_fsa_state cur_state, enum crmd_fsa_input cur_input, fsa_data_t * msg_data); /* A_PE_INVOKE */ void + do_pe_invoke(long long action, - enum crmd_fsa_cause cause, - enum crmd_fsa_state cur_state, - enum crmd_fsa_input cur_input, - fsa_data_t *msg_data); + enum crmd_fsa_cause cause, + enum crmd_fsa_state cur_state, enum crmd_fsa_input cur_input, fsa_data_t * msg_data); /* A_TE_INVOKE, A_TE_CANCEL */ void + do_te_invoke(long long action, - enum crmd_fsa_cause cause, - enum crmd_fsa_state cur_state, - enum crmd_fsa_input cur_input, - fsa_data_t *msg_data); + enum crmd_fsa_cause cause, + enum crmd_fsa_state cur_state, enum crmd_fsa_input cur_input, fsa_data_t * msg_data); /* A_TE_INVOKE */ void + do_te_copyto(long long action, - enum crmd_fsa_cause cause, - enum crmd_fsa_state cur_state, - enum crmd_fsa_input cur_input, - fsa_data_t *msg_data); + enum crmd_fsa_cause cause, + enum crmd_fsa_state cur_state, enum crmd_fsa_input cur_input, fsa_data_t * msg_data); /* A_SHUTDOWN_REQ */ void + do_shutdown_req(long long action, - enum crmd_fsa_cause cause, - enum crmd_fsa_state cur_state, - enum crmd_fsa_input cur_input, - fsa_data_t *msg_data); + enum crmd_fsa_cause cause, + enum crmd_fsa_state cur_state, + enum crmd_fsa_input cur_input, fsa_data_t * msg_data); /* A_SHUTDOWN */ void + do_shutdown(long long action, - enum crmd_fsa_cause cause, - enum crmd_fsa_state cur_state, - enum crmd_fsa_input cur_input, - fsa_data_t *msg_data); + enum crmd_fsa_cause cause, + enum crmd_fsa_state cur_state, enum crmd_fsa_input cur_input, fsa_data_t * msg_data); /* A_STOP */ void + do_stop(long long action, - enum crmd_fsa_cause cause, - enum crmd_fsa_state cur_state, - enum crmd_fsa_input cur_input, - fsa_data_t *msg_data); + enum crmd_fsa_cause cause, + enum crmd_fsa_state cur_state, enum crmd_fsa_input cur_input, fsa_data_t * msg_data); /* A_EXIT_0, A_EXIT_1 */ void -do_exit(long long action, - enum crmd_fsa_cause cause, - enum crmd_fsa_state cur_state, - enum crmd_fsa_input cur_input, - fsa_data_t *msg_data); +do_exit(long long action, + enum crmd_fsa_cause cause, + enum crmd_fsa_state cur_state, enum crmd_fsa_input cur_input, fsa_data_t * msg_data); void + do_dc_join_final(long long action, - enum crmd_fsa_cause cause, - enum crmd_fsa_state cur_state, - enum crmd_fsa_input current_input, - fsa_data_t *msg_data); + enum crmd_fsa_cause cause, + enum crmd_fsa_state cur_state, + enum crmd_fsa_input current_input, fsa_data_t * msg_data); #endif diff --git a/crmd/te_callbacks.h b/crmd/te_callbacks.h index f7d7ebbb85..0058781707 100644 --- a/crmd/te_callbacks.h +++ b/crmd/te_callbacks.h @@ -1,40 +1,40 @@ /* * 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 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef TE_CALLBACKS__H -#define TE_CALLBACKS__H +# define TE_CALLBACKS__H -extern void cib_fencing_updated(xmlNode *msg, int call_id, int rc, - xmlNode *output, void *user_data); +extern void cib_fencing_updated(xmlNode * msg, int call_id, int rc, + xmlNode * output, void *user_data); -extern void cib_action_updated(xmlNode *msg, int call_id, int rc, - xmlNode *output, void *user_data); +extern void cib_action_updated(xmlNode * msg, int call_id, int rc, + xmlNode * output, void *user_data); -extern void cib_failcount_updated(xmlNode *msg, int call_id, int rc, - xmlNode *output, void *user_data); +extern void cib_failcount_updated(xmlNode * msg, int call_id, int rc, + xmlNode * output, void *user_data); extern gboolean global_timer_callback(gpointer data); extern gboolean action_timer_callback(gpointer data); extern gboolean te_graph_trigger(gpointer user_data); -extern void te_update_diff(const char *event, xmlNode *msg); +extern void te_update_diff(const char *event, xmlNode * msg); -extern void tengine_stonith_callback( - stonith_t *stonith, const xmlNode *msg, int call_id, int rc, xmlNode *output, void *userdata); +extern void tengine_stonith_callback(stonith_t * stonith, const xmlNode * msg, int call_id, int rc, + xmlNode * output, void *userdata); #endif diff --git a/crmd/tengine.h b/crmd/tengine.h index f5e0cb0d3f..16c758e934 100755 --- a/crmd/tengine.h +++ b/crmd/tengine.h @@ -1,75 +1,74 @@ /* * 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 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef TENGINE__H -#define TENGINE__H +# define TENGINE__H -#include -#include -#include +# include +# include +# include extern stonith_t *stonith_api; extern GListPtr stonith_cleanup_list; -extern void send_stonith_update(crm_action_t *stonith_action, const char *target, const char *uuid); +extern void send_stonith_update(crm_action_t * stonith_action, const char *target, + const char *uuid); /* tengine */ -extern crm_action_t *match_down_event( - int rc, const char *target, const char *filter); +extern crm_action_t *match_down_event(int rc, const char *target, const char *filter); extern crm_action_t *get_cancel_action(const char *id, const char *node); -extern gboolean cib_action_update(crm_action_t *action, int status, int op_rc); -extern gboolean fail_incompletable_actions(crm_graph_t *graph, const char *down_node); -extern gboolean process_graph_event(xmlNode *event, const char *event_node); +extern gboolean cib_action_update(crm_action_t * action, int status, int op_rc); +extern gboolean fail_incompletable_actions(crm_graph_t * graph, const char *down_node); +extern gboolean process_graph_event(xmlNode * event, const char *event_node); /* utils */ extern crm_action_t *get_action(int id, gboolean confirmed); -extern gboolean start_global_timer(crm_action_timer_t *timer, int timeout); -extern gboolean stop_te_timer(crm_action_timer_t *timer); +extern gboolean start_global_timer(crm_action_timer_t * timer, int timeout); +extern gboolean stop_te_timer(crm_action_timer_t * timer); extern const char *get_rsc_state(const char *task, op_status_t status); /* unpack */ -extern gboolean process_te_message(xmlNode * msg, xmlNode *xml_data); +extern gboolean process_te_message(xmlNode * msg, xmlNode * xml_data); extern crm_graph_t *transition_graph; extern crm_trigger_t *transition_trigger; extern char *te_uuid; -extern void notify_crmd(crm_graph_t *graph); +extern void notify_crmd(crm_graph_t * graph); -#include +# include extern void trigger_graph_processing(const char *fn, int line); -extern void abort_transition_graph( - int abort_priority, enum transition_action abort_action, - const char *abort_text, xmlNode *reason, const char *fn, int line); +extern void abort_transition_graph(int abort_priority, enum transition_action abort_action, + const char *abort_text, xmlNode * reason, const char *fn, + int line); -#define trigger_graph() trigger_graph_processing(__FUNCTION__, __LINE__) -#define abort_transition(pri, action, text, reason) \ +# define trigger_graph() trigger_graph_processing(__FUNCTION__, __LINE__) +# define abort_transition(pri, action, text, reason) \ abort_transition_graph(pri, action, text, reason,__FUNCTION__,__LINE__); extern gboolean te_connect_stonith(gpointer user_data); extern GCHSource *stonith_src; extern crm_trigger_t *transition_trigger; extern crm_trigger_t *stonith_reconnect; extern char *failed_stop_offset; extern char *failed_start_offset; extern int active_timeout; extern int stonith_op_active; #endif - diff --git a/fencing/internal.h b/fencing/internal.h index 335c2352e4..5bf701de4b 100644 --- a/fencing/internal.h +++ b/fencing/internal.h @@ -1,64 +1,59 @@ -typedef struct stonith_device_s -{ - char *id; - char *agent; - char *namespace; - - GListPtr targets; - time_t targets_age; - gboolean has_attr_map; - guint priority; - guint active_pid; - - GHashTable *params; - GHashTable *aliases; - GList *pending_ops; - crm_trigger_t *work; - +typedef struct stonith_device_s { + char *id; + char *agent; + char *namespace; + + GListPtr targets; + time_t targets_age; + gboolean has_attr_map; + guint priority; + guint active_pid; + + GHashTable *params; + GHashTable *aliases; + GList *pending_ops; + crm_trigger_t *work; + } stonith_device_t; -typedef struct stonith_client_s -{ - char *id; - char *name; - char *callback_id; +typedef struct stonith_client_s { + char *id; + char *name; + char *callback_id; - const char *channel_name; + const char *channel_name; - IPC_Channel *channel; - GCHSource *source; + IPC_Channel *channel; + GCHSource *source; - long long flags; + long long flags; } stonith_client_t; extern long long get_stonith_flag(const char *name); -extern void stonith_command( - stonith_client_t *client, xmlNode *op_request, const char *remote); +extern void stonith_command(stonith_client_t * client, xmlNode * op_request, const char *remote); -extern void do_local_reply( - xmlNode *notify_src, const char *client_id, gboolean sync_reply, gboolean from_peer); +extern void do_local_reply(xmlNode * notify_src, const char *client_id, gboolean sync_reply, + gboolean from_peer); -extern xmlNode *stonith_construct_reply( - xmlNode *request, char *output, xmlNode *data, int rc); +extern xmlNode *stonith_construct_reply(xmlNode * request, char *output, xmlNode * data, int rc); -extern xmlNode *stonith_construct_async_reply( - async_command_t *cmd, char *output, xmlNode *data, int rc);; +extern xmlNode *stonith_construct_async_reply(async_command_t * cmd, char *output, xmlNode * data, + int rc);; -extern void do_stonith_notify( - int options, const char *type, enum stonith_errors result, xmlNode *data, - const char *remote); +extern void do_stonith_notify(int options, const char *type, enum stonith_errors result, + xmlNode * data, const char *remote); -extern void initiate_remote_stonith_op(stonith_client_t *client, xmlNode *request); +extern void initiate_remote_stonith_op(stonith_client_t * client, xmlNode * request); -extern int process_remote_stonith_exec(xmlNode *msg); +extern int process_remote_stonith_exec(xmlNode * msg); -extern int process_remote_stonith_query(xmlNode *msg); +extern int process_remote_stonith_query(xmlNode * msg); -extern void *create_remote_stonith_op(const char *client, xmlNode *request, gboolean peer); +extern void *create_remote_stonith_op(const char *client, xmlNode * request, gboolean peer); -extern int stonith_fence_history(xmlNode *msg, xmlNode **output); +extern int stonith_fence_history(xmlNode * msg, xmlNode ** output); extern char *stonith_our_uname; extern gboolean stand_alone; diff --git a/include/crm/ais.h b/include/crm/ais.h index f8ca4009d9..b072ddf7ac 100644 --- a/include/crm/ais.h +++ b/include/crm/ais.h @@ -1,366 +1,370 @@ /* * 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 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef CRM_AIS__H -#define CRM_AIS__H +# define CRM_AIS__H -#include -#include -#include +# include +# include +# include -#include -#include +# include +# include -#define AIS_IPC_MESSAGE_SIZE 8192*128 +# define AIS_IPC_MESSAGE_SIZE 8192*128 -#if SUPPORT_COROSYNC +# if SUPPORT_COROSYNC -# include -# include -# include +# include +# include +# include -#else +# else typedef struct { - int size __attribute__((aligned(8))); - int id __attribute__((aligned(8))); -} coroipc_request_header_t __attribute__((aligned(8))); + int size __attribute__ ((aligned(8))); + int id __attribute__ ((aligned(8))); +} coroipc_request_header_t __attribute__ ((aligned(8))); typedef struct { - int size; __attribute__((aligned(8))) - int id __attribute__((aligned(8))); - int error __attribute__((aligned(8))); -} coroipc_response_header_t __attribute__((aligned(8))); -#endif + int size; + __attribute__ ((aligned(8))) + int id __attribute__ ((aligned(8))); + int error __attribute__ ((aligned(8))); +} coroipc_response_header_t __attribute__ ((aligned(8))); +# endif -#define CRM_MESSAGE_IPC_ACK 0 +# define CRM_MESSAGE_IPC_ACK 0 -#ifndef CRM_SERVICE -#define CRM_SERVICE PCMK_SERVICE_ID -#endif +# ifndef CRM_SERVICE +# define CRM_SERVICE PCMK_SERVICE_ID +# endif -#define MAX_NAME 256 -#define AIS_IPC_NAME "ais-crm-ipc" +# define MAX_NAME 256 +# define AIS_IPC_NAME "ais-crm-ipc" /* *INDENT-OFF* */ #define CRM_NODE_LOST "lost" #define CRM_NODE_MEMBER "member" #define CRM_NODE_ACTIVE CRM_NODE_MEMBER #define CRM_NODE_INACTIVE CRM_NODE_LOST #define CRM_NODE_EVICTED "evicted" typedef struct crm_ais_host_s AIS_Host; typedef struct crm_ais_msg_s AIS_Message; enum crm_ais_msg_class { crm_class_cluster = 0, crm_class_members = 1, crm_class_notify = 2, crm_class_nodeid = 3, crm_class_rmpeer = 4, crm_class_quorum = 5, }; /* order here matters - its used to index into the crm_children array */ enum crm_ais_msg_types { crm_msg_none = 0, crm_msg_ais = 1, crm_msg_lrmd = 2, crm_msg_cib = 3, crm_msg_crmd = 4, crm_msg_attrd = 5, crm_msg_stonithd = 6, crm_msg_te = 7, crm_msg_pe = 8, crm_msg_stonith_ng = 9, }; enum crm_proc_flag { crm_proc_none = 0x00000001, crm_proc_ais = 0x00000002, crm_proc_lrmd = 0x00000010, crm_proc_cib = 0x00000100, crm_proc_crmd = 0x00000200, crm_proc_attrd = 0x00001000, crm_proc_stonithd = 0x00002000, crm_proc_pe = 0x00010000, crm_proc_te = 0x00020000, crm_proc_mgmtd = 0x00040000, crm_proc_stonith_ng = 0x00100000, }; /* *INDENT-ON* */ -typedef struct crm_peer_node_s -{ - uint32_t id; - uint64_t born; - uint64_t last_seen; - - int32_t votes; - uint32_t processes; - - char *uname; - char *state; - char *uuid; - char *addr; - char *version; -} crm_node_t; +typedef struct crm_peer_node_s { + uint32_t id; + uint64_t born; + uint64_t last_seen; -struct crm_ais_host_s -{ - uint32_t id; - uint32_t pid; - gboolean local; - enum crm_ais_msg_types type; - uint32_t size; - char uname[MAX_NAME]; + int32_t votes; + uint32_t processes; -} __attribute__((packed)); + char *uname; + char *state; + char *uuid; + char *addr; + char *version; +} crm_node_t; -struct crm_ais_msg_s -{ - coroipc_response_header_t header __attribute__((aligned(8))); - uint32_t id; - gboolean is_compressed; - - AIS_Host host; - AIS_Host sender; - - uint32_t size; - uint32_t compressed_size; - /* 584 bytes */ - char data[0]; - -} __attribute__((packed)); - -struct crm_ais_nodeid_resp_s +struct crm_ais_host_s { + uint32_t id; + uint32_t pid; + gboolean local; + enum crm_ais_msg_types type; + uint32_t size; + char uname[MAX_NAME]; + +} __attribute__ ((packed)); + +struct crm_ais_msg_s { + coroipc_response_header_t header __attribute__ ((aligned(8))); + uint32_t id; + gboolean is_compressed; + + AIS_Host host; + AIS_Host sender; + + uint32_t size; + uint32_t compressed_size; + /* 584 bytes */ + char data[0]; + +} __attribute__ ((packed)); + +struct crm_ais_nodeid_resp_s { + coroipc_response_header_t header __attribute__ ((aligned(8))); + uint32_t id; + uint32_t counter; + char uname[MAX_NAME]; + char cname[MAX_NAME]; +} __attribute__ ((packed)); + +struct crm_ais_quorum_resp_s { + coroipc_response_header_t header __attribute__ ((aligned(8))); + uint64_t id; + uint32_t votes; + uint32_t expected_votes; + uint32_t quorate; +} __attribute__ ((packed)); + +static inline const char * +msg_type2text(enum crm_ais_msg_types type) { - coroipc_response_header_t header __attribute__((aligned(8))); - uint32_t id; - uint32_t counter; - char uname[MAX_NAME]; - char cname[MAX_NAME]; -} __attribute__((packed)); - -struct crm_ais_quorum_resp_s -{ - coroipc_response_header_t header __attribute__((aligned(8))); - uint64_t id; - uint32_t votes; - uint32_t expected_votes; - uint32_t quorate; -} __attribute__((packed)); - -static inline const char *msg_type2text(enum crm_ais_msg_types type) -{ - const char *text = "unknown"; - switch(type) { - case crm_msg_none: - text = "unknown"; - break; - case crm_msg_ais: - text = "ais"; - break; - case crm_msg_cib: - text = "cib"; - break; - case crm_msg_crmd: - text = "crmd"; - break; - case crm_msg_pe: - text = "pengine"; - break; - case crm_msg_te: - text = "tengine"; - break; - case crm_msg_lrmd: - text = "lrmd"; - break; - case crm_msg_attrd: - text = "attrd"; - break; - case crm_msg_stonithd: - text = "stonithd"; - break; - case crm_msg_stonith_ng: - text = "stonith-ng"; - break; - } - return text; + const char *text = "unknown"; + + switch (type) { + case crm_msg_none: + text = "unknown"; + break; + case crm_msg_ais: + text = "ais"; + break; + case crm_msg_cib: + text = "cib"; + break; + case crm_msg_crmd: + text = "crmd"; + break; + case crm_msg_pe: + text = "pengine"; + break; + case crm_msg_te: + text = "tengine"; + break; + case crm_msg_lrmd: + text = "lrmd"; + break; + case crm_msg_attrd: + text = "attrd"; + break; + case crm_msg_stonithd: + text = "stonithd"; + break; + case crm_msg_stonith_ng: + text = "stonith-ng"; + break; + } + return text; } -static inline const char *peer2text(enum crm_proc_flag proc) +static inline const char * +peer2text(enum crm_proc_flag proc) { - const char *text = "unknown"; - switch(proc) { - case crm_proc_none: - text = "unknown"; - break; - case crm_proc_ais: - text = "ais"; - break; - case crm_proc_cib: - text = "cib"; - break; - case crm_proc_crmd: - text = "crmd"; - break; - case crm_proc_pe: - text = "pengine"; - break; - case crm_proc_te: - text = "tengine"; - break; - case crm_proc_lrmd: - text = "lrmd"; - break; - case crm_proc_attrd: - text = "attrd"; - break; - case crm_proc_stonithd: - text = "stonithd"; - break; - case crm_proc_stonith_ng: - text = "stonith-ng"; - break; - case crm_proc_mgmtd: - text = "mgmtd"; - break; - } - return text; + const char *text = "unknown"; + + switch (proc) { + case crm_proc_none: + text = "unknown"; + break; + case crm_proc_ais: + text = "ais"; + break; + case crm_proc_cib: + text = "cib"; + break; + case crm_proc_crmd: + text = "crmd"; + break; + case crm_proc_pe: + text = "pengine"; + break; + case crm_proc_te: + text = "tengine"; + break; + case crm_proc_lrmd: + text = "lrmd"; + break; + case crm_proc_attrd: + text = "attrd"; + break; + case crm_proc_stonithd: + text = "stonithd"; + break; + case crm_proc_stonith_ng: + text = "stonith-ng"; + break; + case crm_proc_mgmtd: + text = "mgmtd"; + break; + } + return text; } -static inline const char *ais_dest(const struct crm_ais_host_s *host) +static inline const char * +ais_dest(const struct crm_ais_host_s *host) { - if(host->local) { - return "local"; - } else if(host->size > 0) { - return host->uname; + if (host->local) { + return "local"; + } else if (host->size > 0) { + return host->uname; } else { - return ""; + return ""; } } -#define ais_data_len(msg) (msg->is_compressed?msg->compressed_size:msg->size) +# define ais_data_len(msg) (msg->is_compressed?msg->compressed_size:msg->size) -static inline AIS_Message *ais_msg_copy(const AIS_Message *source) +static inline AIS_Message * +ais_msg_copy(const AIS_Message * source) { AIS_Message *target = malloc(sizeof(AIS_Message) + ais_data_len(source)); - + memcpy(target, source, sizeof(AIS_Message)); memcpy(target->data, source->data, ais_data_len(target)); return target; } -static inline const char *ais_error2text(int error) +static inline const char * +ais_error2text(int error) { - const char *text = "unknown"; -# if SUPPORT_COROSYNC - switch(error) { - case CS_OK: - text = "None"; - break; - case CS_ERR_LIBRARY: - text = "Library error"; - break; - case CS_ERR_VERSION: - text = "Version error"; - break; - case CS_ERR_INIT: - text = "Initialization error"; - break; - case CS_ERR_TIMEOUT: - text = "Timeout"; - break; - case CS_ERR_TRY_AGAIN: - text = "Try again"; - break; - case CS_ERR_INVALID_PARAM: - text = "Invalid parameter"; - break; - case CS_ERR_NO_MEMORY: - text = "No memory"; - break; - case CS_ERR_BAD_HANDLE: - text = "Bad handle"; - break; - case CS_ERR_BUSY: - text = "Busy"; - break; - case CS_ERR_ACCESS: - text = "Access error"; - break; - case CS_ERR_NOT_EXIST: - text = "Doesn't exist"; - break; - case CS_ERR_NAME_TOO_LONG: - text = "Name too long"; - break; - case CS_ERR_EXIST: - text = "Exists"; - break; - case CS_ERR_NO_SPACE: - text = "No space"; - break; - case CS_ERR_INTERRUPT: - text = "Interrupt"; - break; - case CS_ERR_NAME_NOT_FOUND: - text = "Name not found"; - break; - case CS_ERR_NO_RESOURCES: - text = "No resources"; - break; - case CS_ERR_NOT_SUPPORTED: - text = "Not supported"; - break; - case CS_ERR_BAD_OPERATION: - text = "Bad operation"; - break; - case CS_ERR_FAILED_OPERATION: - text = "Failed operation"; - break; - case CS_ERR_MESSAGE_ERROR: - text = "Message error"; - break; - case CS_ERR_QUEUE_FULL: - text = "Queue full"; - break; - case CS_ERR_QUEUE_NOT_AVAILABLE: - text = "Queue not available"; - break; - case CS_ERR_BAD_FLAGS: - text = "Bad flags"; - break; - case CS_ERR_TOO_BIG: - text = "To big"; - break; - case CS_ERR_NO_SECTIONS: - text = "No sections"; - break; - } -# endif - return text; + const char *text = "unknown"; + +# if SUPPORT_COROSYNC + switch (error) { + case CS_OK: + text = "None"; + break; + case CS_ERR_LIBRARY: + text = "Library error"; + break; + case CS_ERR_VERSION: + text = "Version error"; + break; + case CS_ERR_INIT: + text = "Initialization error"; + break; + case CS_ERR_TIMEOUT: + text = "Timeout"; + break; + case CS_ERR_TRY_AGAIN: + text = "Try again"; + break; + case CS_ERR_INVALID_PARAM: + text = "Invalid parameter"; + break; + case CS_ERR_NO_MEMORY: + text = "No memory"; + break; + case CS_ERR_BAD_HANDLE: + text = "Bad handle"; + break; + case CS_ERR_BUSY: + text = "Busy"; + break; + case CS_ERR_ACCESS: + text = "Access error"; + break; + case CS_ERR_NOT_EXIST: + text = "Doesn't exist"; + break; + case CS_ERR_NAME_TOO_LONG: + text = "Name too long"; + break; + case CS_ERR_EXIST: + text = "Exists"; + break; + case CS_ERR_NO_SPACE: + text = "No space"; + break; + case CS_ERR_INTERRUPT: + text = "Interrupt"; + break; + case CS_ERR_NAME_NOT_FOUND: + text = "Name not found"; + break; + case CS_ERR_NO_RESOURCES: + text = "No resources"; + break; + case CS_ERR_NOT_SUPPORTED: + text = "Not supported"; + break; + case CS_ERR_BAD_OPERATION: + text = "Bad operation"; + break; + case CS_ERR_FAILED_OPERATION: + text = "Failed operation"; + break; + case CS_ERR_MESSAGE_ERROR: + text = "Message error"; + break; + case CS_ERR_QUEUE_FULL: + text = "Queue full"; + break; + case CS_ERR_QUEUE_NOT_AVAILABLE: + text = "Queue not available"; + break; + case CS_ERR_BAD_FLAGS: + text = "Bad flags"; + break; + case CS_ERR_TOO_BIG: + text = "To big"; + break; + case CS_ERR_NO_SECTIONS: + text = "No sections"; + break; + } +# endif + return text; } extern enum crm_ais_msg_types crm_system_type; extern enum crm_ais_msg_types text2msg_type(const char *text); -extern char *get_ais_data(const AIS_Message *msg); -extern gboolean check_message_sanity(const AIS_Message *msg, const char *data); +extern char *get_ais_data(const AIS_Message * msg); +extern gboolean check_message_sanity(const AIS_Message * msg, const char *data); #endif diff --git a/include/crm/cib.h b/include/crm/cib.h index 47f3a7084e..e51b3694fa 100644 --- a/include/crm/cib.h +++ b/include/crm/cib.h @@ -1,324 +1,310 @@ /* * 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 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef CIB__H -#define CIB__H +# define CIB__H -#include -#include +# include +# include -#define CIB_FEATURE_SET "2.0" -#define USE_PESKY_FRAGMENTS 1 +# define CIB_FEATURE_SET "2.0" +# define USE_PESKY_FRAGMENTS 1 /* use compare_version() for doing comparisons */ enum cib_variant { - cib_undefined, - cib_native, - cib_file, - cib_remote, - cib_database, - cib_edir + cib_undefined, + cib_native, + cib_file, + cib_remote, + cib_database, + cib_edir }; enum cib_state { - cib_connected_command, - cib_connected_query, - cib_disconnected + cib_connected_command, + cib_connected_query, + cib_disconnected }; enum cib_conn_type { - cib_command, - cib_query, - cib_no_connection + cib_command, + cib_query, + cib_no_connection }; /* *INDENT-OFF* */ enum cib_call_options { cib_none = 0x00000000, cib_verbose = 0x00000001, cib_xpath = 0x00000002, cib_multiple = 0x00000004, cib_can_create = 0x00000008, cib_discard_reply = 0x00000010, cib_no_children = 0x00000020, cib_scope_local = 0x00000100, cib_dryrun = 0x00000200, cib_sync_call = 0x00001000, cib_inhibit_notify = 0x00010000, cib_quorum_override = 0x00100000, cib_inhibit_bcast = 0x01000000, cib_force_diff = 0x10000000 }; #define cib_default_options = cib_none enum cib_errors { cib_ok = 0, cib_operation = -1, cib_create_msg = -2, cib_not_connected = -3, cib_not_authorized = -4, cib_send_failed = -5, cib_reply_failed = -6, cib_return_code = -7, cib_output_ptr = -8, cib_output_data = -9, cib_connection = -10, cib_authentication = -11, cib_missing = -12, cib_variant = -28, CIBRES_MISSING_ID = -13, CIBRES_MISSING_TYPE = -14, CIBRES_MISSING_FIELD = -15, CIBRES_OBJTYPE_MISMATCH = -16, CIBRES_CORRUPT = -17, CIBRES_OTHER = -18, cib_unknown = -19, cib_STALE = -20, cib_EXISTS = -21, cib_NOTEXISTS = -22, cib_ACTIVATION = -23, cib_NOSECTION = -24, cib_NOOBJECT = -25, cib_NOPARENT = -26, cib_NODECOPY = -27, cib_NOTSUPPORTED = -29, cib_registration_msg = -30, cib_callback_token = -31, cib_callback_register = -32, cib_msg_field_add = -33, cib_client_gone = -34, cib_not_master = -35, cib_client_corrupt = -36, cib_master_timeout = -37, cib_revision_unsupported= -38, cib_revision_unknown = -39, cib_missing_data = -40, cib_remote_timeout = -41, cib_no_quorum = -42, cib_diff_failed = -43, cib_diff_resync = -44, cib_old_data = -45, cib_id_check = -46, cib_dtd_validation = -47, cib_bad_section = -48, cib_bad_digest = -49, cib_bad_permissions = -50, cib_bad_config = -51, cib_invalid_argument = -52, cib_transform_failed = -53, cib_permission_denied = -54, }; /* *INDENT-ON* */ enum cib_update_op { - CIB_UPDATE_OP_NONE = 0, - CIB_UPDATE_OP_ADD, - CIB_UPDATE_OP_MODIFY, - CIB_UPDATE_OP_DELETE, - CIB_UPDATE_OP_MAX + CIB_UPDATE_OP_NONE = 0, + CIB_UPDATE_OP_ADD, + CIB_UPDATE_OP_MODIFY, + CIB_UPDATE_OP_DELETE, + CIB_UPDATE_OP_MAX }; enum cib_section { - cib_section_none, - cib_section_all, - cib_section_nodes, - cib_section_constraints, - cib_section_resources, - cib_section_crmconfig, - cib_section_status + cib_section_none, + cib_section_all, + cib_section_nodes, + cib_section_constraints, + cib_section_resources, + cib_section_crmconfig, + cib_section_status }; -#define CIB_OP_SLAVE "cib_slave" -#define CIB_OP_SLAVEALL "cib_slave_all" -#define CIB_OP_MASTER "cib_master" -#define CIB_OP_SYNC "cib_sync" -#define CIB_OP_SYNC_ONE "cib_sync_one" -#define CIB_OP_ISMASTER "cib_ismaster" -#define CIB_OP_BUMP "cib_bump" -#define CIB_OP_QUERY "cib_query" -#define CIB_OP_CREATE "cib_create" -#define CIB_OP_UPDATE "cib_update" -#define CIB_OP_MODIFY "cib_modify" -#define CIB_OP_DELETE "cib_delete" -#define CIB_OP_ERASE "cib_erase" -#define CIB_OP_REPLACE "cib_replace" -#define CIB_OP_NOTIFY "cib_notify" -#define CIB_OP_APPLY_DIFF "cib_apply_diff" -#define CIB_OP_UPGRADE "cib_upgrade" -#define CIB_OP_DELETE_ALT "cib_delete_alt" - -#define F_CIB_CLIENTID "cib_clientid" -#define F_CIB_CALLOPTS "cib_callopt" -#define F_CIB_CALLID "cib_callid" -#define F_CIB_CALLDATA "cib_calldata" -#define F_CIB_OPERATION "cib_op" -#define F_CIB_ISREPLY "cib_isreplyto" -#define F_CIB_SECTION "cib_section" -#define F_CIB_HOST "cib_host" -#define F_CIB_RC "cib_rc" -#define F_CIB_DELEGATED "cib_delegated_from" -#define F_CIB_OBJID "cib_object" -#define F_CIB_OBJTYPE "cib_object_type" -#define F_CIB_EXISTING "cib_existing_object" -#define F_CIB_SEENCOUNT "cib_seen" -#define F_CIB_TIMEOUT "cib_timeout" -#define F_CIB_UPDATE "cib_update" -#define F_CIB_CALLBACK_TOKEN "cib_async_id" -#define F_CIB_GLOBAL_UPDATE "cib_update" -#define F_CIB_UPDATE_RESULT "cib_update_result" -#define F_CIB_CLIENTNAME "cib_clientname" -#define F_CIB_NOTIFY_TYPE "cib_notify_type" -#define F_CIB_NOTIFY_ACTIVATE "cib_notify_activate" -#define F_CIB_UPDATE_DIFF "cib_update_diff" -#define F_CIB_USER "cib_user" - -#define T_CIB "cib" -#define T_CIB_NOTIFY "cib_notify" +# define CIB_OP_SLAVE "cib_slave" +# define CIB_OP_SLAVEALL "cib_slave_all" +# define CIB_OP_MASTER "cib_master" +# define CIB_OP_SYNC "cib_sync" +# define CIB_OP_SYNC_ONE "cib_sync_one" +# define CIB_OP_ISMASTER "cib_ismaster" +# define CIB_OP_BUMP "cib_bump" +# define CIB_OP_QUERY "cib_query" +# define CIB_OP_CREATE "cib_create" +# define CIB_OP_UPDATE "cib_update" +# define CIB_OP_MODIFY "cib_modify" +# define CIB_OP_DELETE "cib_delete" +# define CIB_OP_ERASE "cib_erase" +# define CIB_OP_REPLACE "cib_replace" +# define CIB_OP_NOTIFY "cib_notify" +# define CIB_OP_APPLY_DIFF "cib_apply_diff" +# define CIB_OP_UPGRADE "cib_upgrade" +# define CIB_OP_DELETE_ALT "cib_delete_alt" + +# define F_CIB_CLIENTID "cib_clientid" +# define F_CIB_CALLOPTS "cib_callopt" +# define F_CIB_CALLID "cib_callid" +# define F_CIB_CALLDATA "cib_calldata" +# define F_CIB_OPERATION "cib_op" +# define F_CIB_ISREPLY "cib_isreplyto" +# define F_CIB_SECTION "cib_section" +# define F_CIB_HOST "cib_host" +# define F_CIB_RC "cib_rc" +# define F_CIB_DELEGATED "cib_delegated_from" +# define F_CIB_OBJID "cib_object" +# define F_CIB_OBJTYPE "cib_object_type" +# define F_CIB_EXISTING "cib_existing_object" +# define F_CIB_SEENCOUNT "cib_seen" +# define F_CIB_TIMEOUT "cib_timeout" +# define F_CIB_UPDATE "cib_update" +# define F_CIB_CALLBACK_TOKEN "cib_async_id" +# define F_CIB_GLOBAL_UPDATE "cib_update" +# define F_CIB_UPDATE_RESULT "cib_update_result" +# define F_CIB_CLIENTNAME "cib_clientname" +# define F_CIB_NOTIFY_TYPE "cib_notify_type" +# define F_CIB_NOTIFY_ACTIVATE "cib_notify_activate" +# define F_CIB_UPDATE_DIFF "cib_update_diff" +# define F_CIB_USER "cib_user" + +# define T_CIB "cib" +# define T_CIB_NOTIFY "cib_notify" /* notify sub-types */ -#define T_CIB_PRE_NOTIFY "cib_pre_notify" -#define T_CIB_POST_NOTIFY "cib_post_notify" -#define T_CIB_UPDATE_CONFIRM "cib_update_confirmation" -#define T_CIB_DIFF_NOTIFY "cib_diff_notify" -#define T_CIB_REPLACE_NOTIFY "cib_refresh_notify" - -#define cib_channel_ro "cib_ro" -#define cib_channel_rw "cib_rw" -#define cib_channel_callback "cib_callback" -#define cib_channel_ro_synchronous "cib_ro_syncronous" -#define cib_channel_rw_synchronous "cib_rw_syncronous" +# define T_CIB_PRE_NOTIFY "cib_pre_notify" +# define T_CIB_POST_NOTIFY "cib_post_notify" +# define T_CIB_UPDATE_CONFIRM "cib_update_confirmation" +# define T_CIB_DIFF_NOTIFY "cib_diff_notify" +# define T_CIB_REPLACE_NOTIFY "cib_refresh_notify" + +# define cib_channel_ro "cib_ro" +# define cib_channel_rw "cib_rw" +# define cib_channel_callback "cib_callback" +# define cib_channel_ro_synchronous "cib_ro_syncronous" +# define cib_channel_rw_synchronous "cib_rw_syncronous" typedef struct cib_s cib_t; -typedef struct cib_api_operations_s -{ - int (*variant_op)( - cib_t *cib, const char *op, const char *host, - const char *section, xmlNode *data, - xmlNode **output_data, int call_options); - - int (*signon) ( - cib_t *cib, const char *name, enum cib_conn_type type); - int (*signon_raw)(cib_t* cib, const char *name, enum cib_conn_type type, int *async_fd, int *sync_fd); - int (*signoff)(cib_t *cib); - int (*free) (cib_t *cib); - - int (*set_op_callback)( - cib_t *cib, void (*callback)( - const xmlNode *msg, int callid , - int rc, xmlNode *output)); - - int (*add_notify_callback)( - cib_t *cib, const char *event, void (*callback)( - const char *event, xmlNode *msg)); - - int (*del_notify_callback)( - cib_t *cib, const char *event, void (*callback)( - const char *event, xmlNode *msg)); - - int (*set_connection_dnotify)( - cib_t *cib, void (*dnotify)(gpointer user_data)); - - int (*inputfd)(cib_t* cib); - - int (*noop)(cib_t *cib, int call_options); - int (*ping)(cib_t *cib, xmlNode **output_data, int call_options); - - int (*query)(cib_t *cib, const char *section, - xmlNode **output_data, int call_options); - int (*query_from)( - cib_t *cib, const char *host, const char *section, - xmlNode **output_data, int call_options); - - int (*is_master) (cib_t *cib); - int (*set_master)(cib_t *cib, int call_options); - int (*set_slave) (cib_t *cib, int call_options); - int (*set_slave_all)(cib_t *cib, int call_options); - - int (*sync)(cib_t *cib, const char *section, int call_options); - int (*sync_from)( - cib_t *cib, const char *host, const char *section, int call_options); - - int (*upgrade)(cib_t *cib, int call_options); - int (*bump_epoch)(cib_t *cib, int call_options); - - int (*create)(cib_t *cib, const char *section, xmlNode *data, int call_options); - int (*modify)(cib_t *cib, const char *section, xmlNode *data, int call_options); - int (*update)(cib_t *cib, const char *section, xmlNode *data, int call_options); - int (*replace)(cib_t *cib, const char *section, xmlNode *data, int call_options); - int (*delete)(cib_t *cib, const char *section, xmlNode *data, int call_options); - - int (*erase)(cib_t *cib, xmlNode **output_data, int call_options); - int (*delete_absolute)(cib_t *cib, const char *section, xmlNode *data, int call_options); - - int (*quit)(cib_t *cib, int call_options); - - int (*register_notification)( - cib_t* cib, const char *callback, int enabled); - - gboolean (*register_callback)( - cib_t *cib, int call_id, int timeout, gboolean only_success, void *user_data, - const char *callback_name, void (*callback)(xmlNode*, int, int, xmlNode*,void*)); - - int (*delegated_variant_op)( - cib_t *cib, const char *op, const char *host, - const char *section, xmlNode *data, - xmlNode **output_data, int call_options, const char *user_name); - +typedef struct cib_api_operations_s { + int (*variant_op) (cib_t * cib, const char *op, const char *host, + const char *section, xmlNode * data, + xmlNode ** output_data, int call_options); + + int (*signon) (cib_t * cib, const char *name, enum cib_conn_type type); + int (*signon_raw) (cib_t * cib, const char *name, enum cib_conn_type type, int *async_fd, + int *sync_fd); + int (*signoff) (cib_t * cib); + int (*free) (cib_t * cib); + + int (*set_op_callback) (cib_t * cib, void (*callback) (const xmlNode * msg, int callid, + int rc, xmlNode * output)); + + int (*add_notify_callback) (cib_t * cib, const char *event, + void (*callback) (const char *event, xmlNode * msg)); + + int (*del_notify_callback) (cib_t * cib, const char *event, + void (*callback) (const char *event, xmlNode * msg)); + + int (*set_connection_dnotify) (cib_t * cib, void (*dnotify) (gpointer user_data)); + + int (*inputfd) (cib_t * cib); + + int (*noop) (cib_t * cib, int call_options); + int (*ping) (cib_t * cib, xmlNode ** output_data, int call_options); + + int (*query) (cib_t * cib, const char *section, xmlNode ** output_data, int call_options); + int (*query_from) (cib_t * cib, const char *host, const char *section, + xmlNode ** output_data, int call_options); + + int (*is_master) (cib_t * cib); + int (*set_master) (cib_t * cib, int call_options); + int (*set_slave) (cib_t * cib, int call_options); + int (*set_slave_all) (cib_t * cib, int call_options); + + int (*sync) (cib_t * cib, const char *section, int call_options); + int (*sync_from) (cib_t * cib, const char *host, const char *section, int call_options); + + int (*upgrade) (cib_t * cib, int call_options); + int (*bump_epoch) (cib_t * cib, int call_options); + + int (*create) (cib_t * cib, const char *section, xmlNode * data, int call_options); + int (*modify) (cib_t * cib, const char *section, xmlNode * data, int call_options); + int (*update) (cib_t * cib, const char *section, xmlNode * data, int call_options); + int (*replace) (cib_t * cib, const char *section, xmlNode * data, int call_options); + int (*delete) (cib_t * cib, const char *section, xmlNode * data, int call_options); + + int (*erase) (cib_t * cib, xmlNode ** output_data, int call_options); + int (*delete_absolute) (cib_t * cib, const char *section, xmlNode * data, int call_options); + + int (*quit) (cib_t * cib, int call_options); + + int (*register_notification) (cib_t * cib, const char *callback, int enabled); + + gboolean(*register_callback) (cib_t * cib, int call_id, int timeout, gboolean only_success, + void *user_data, const char *callback_name, + void (*callback) (xmlNode *, int, int, xmlNode *, void *)); + + int (*delegated_variant_op) (cib_t * cib, const char *op, const char *host, + const char *section, xmlNode * data, + xmlNode ** output_data, int call_options, const char *user_name); + } cib_api_operations_t; -struct cib_s -{ - enum cib_state state; - enum cib_conn_type type; - enum cib_variant variant; +struct cib_s { + enum cib_state state; + enum cib_conn_type type; + enum cib_variant variant; - int call_id; - int call_timeout; - void *variant_opaque; + int call_id; + int call_timeout; + void *variant_opaque; - GList *notify_list; - void (*op_callback)(const xmlNode *msg, int call_id, - int rc, xmlNode *output); + GList *notify_list; + void (*op_callback) (const xmlNode * msg, int call_id, int rc, xmlNode * output); - cib_api_operations_t *cmds; + cib_api_operations_t *cmds; }; /* Core functions */ extern cib_t *cib_new(void); extern cib_t *cib_native_new(void); extern cib_t *cib_file_new(const char *filename); -extern cib_t *cib_remote_new(const char *server, const char *user, const char *passwd, int port, gboolean encrypted); +extern cib_t *cib_remote_new(const char *server, const char *user, const char *passwd, int port, + gboolean encrypted); extern cib_t *cib_new_no_shadow(void); extern char *get_shadow_file(const char *name); extern cib_t *cib_shadow_new(const char *name); -extern void cib_delete(cib_t *cib); +extern void cib_delete(cib_t * cib); extern void cib_dump_pending_callbacks(void); extern int num_cib_op_callbacks(void); extern void remove_cib_op_callback(int call_id, gboolean all_callbacks); -#define add_cib_op_callback(cib, id, flag, data, fn) cib->cmds->register_callback(cib, id, 120, flag, data, #fn, fn) +# define add_cib_op_callback(cib, id, flag, data, fn) cib->cmds->register_callback(cib, id, 120, flag, data, #fn, fn) -#include -#include +# include +# include #endif - diff --git a/include/crm/cib_ops.h b/include/crm/cib_ops.h index 03ccbf5f91..7598dc9651 100644 --- a/include/crm/cib_ops.h +++ b/include/crm/cib_ops.h @@ -1,95 +1,97 @@ /* * 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 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef CIB_OPS__H -#define CIB_OPS__H - -#include -#include -#include -#include - -#include -#include -#include - -#include - -#include -#include -#include -#include -#include - -enum cib_errors -cib_process_query( - const char *op, int options, const char *section, xmlNode *req, xmlNode *input, - xmlNode *existing_cib, xmlNode **result_cib, xmlNode **answer); - -enum cib_errors -cib_process_erase( - const char *op, int options, const char *section, xmlNode *req, xmlNode *input, - xmlNode *existing_cib, xmlNode **result_cib, xmlNode **answer); - -enum cib_errors -cib_process_bump( - const char *op, int options, const char *section, xmlNode *req, xmlNode *input, - xmlNode *existing_cib, xmlNode **result_cib, xmlNode **answer); - -enum cib_errors -cib_process_replace( - const char *op, int options, const char *section, xmlNode *req, xmlNode *input, - xmlNode *existing_cib, xmlNode **result_cib, xmlNode **answer); - -enum cib_errors -cib_process_create( - const char *op, int options, const char *section, xmlNode *req, xmlNode *input, - xmlNode *existing_cib, xmlNode **result_cib, xmlNode **answer); - -enum cib_errors -cib_process_modify( - const char *op, int options, const char *section, xmlNode *req, xmlNode *input, - xmlNode *existing_cib, xmlNode **result_cib, xmlNode **answer); - -enum cib_errors -cib_process_delete( - const char *op, int options, const char *section, xmlNode *req, xmlNode *input, - xmlNode *existing_cib, xmlNode **result_cib, xmlNode **answer); - -enum cib_errors -cib_process_diff( - const char *op, int options, const char *section, xmlNode *req, xmlNode *input, - xmlNode *existing_cib, xmlNode **result_cib, xmlNode **answer); - -enum cib_errors -cib_process_upgrade( - const char *op, int options, const char *section, xmlNode *req, xmlNode *input, - xmlNode *existing_cib, xmlNode **result_cib, xmlNode **answer); - -enum cib_errors -cib_process_xpath( - const char *op, int options, const char *section, xmlNode *req, xmlNode *input, - xmlNode *existing_cib, xmlNode **result_cib, xmlNode **answer); - -enum cib_errors cib_update_counter(xmlNode *xml_obj, const char *field, gboolean reset); -extern xmlNode *diff_cib_object(xmlNode *old_cib, xmlNode *new_cib, gboolean suppress); -extern gboolean apply_cib_diff(xmlNode *old, xmlNode *diff, xmlNode **new); -extern gboolean cib_config_changed(xmlNode *last, xmlNode *next, xmlNode **diff); -extern gboolean update_results( - xmlNode *failed, xmlNode *target, const char* operation, int return_code); +# define CIB_OPS__H + +# include +# include +# include +# include + +# include +# include +# include + +# include + +# include +# include +# include +# include +# include + +enum cib_errors + +cib_process_query(const char *op, int options, const char *section, xmlNode * req, xmlNode * input, + xmlNode * existing_cib, xmlNode ** result_cib, xmlNode ** answer); + +enum cib_errors + +cib_process_erase(const char *op, int options, const char *section, xmlNode * req, xmlNode * input, + xmlNode * existing_cib, xmlNode ** result_cib, xmlNode ** answer); + +enum cib_errors + +cib_process_bump(const char *op, int options, const char *section, xmlNode * req, xmlNode * input, + xmlNode * existing_cib, xmlNode ** result_cib, xmlNode ** answer); + +enum cib_errors + +cib_process_replace(const char *op, int options, const char *section, xmlNode * req, + xmlNode * input, xmlNode * existing_cib, xmlNode ** result_cib, + xmlNode ** answer); + +enum cib_errors + +cib_process_create(const char *op, int options, const char *section, xmlNode * req, xmlNode * input, + xmlNode * existing_cib, xmlNode ** result_cib, xmlNode ** answer); + +enum cib_errors + +cib_process_modify(const char *op, int options, const char *section, xmlNode * req, xmlNode * input, + xmlNode * existing_cib, xmlNode ** result_cib, xmlNode ** answer); + +enum cib_errors + +cib_process_delete(const char *op, int options, const char *section, xmlNode * req, xmlNode * input, + xmlNode * existing_cib, xmlNode ** result_cib, xmlNode ** answer); + +enum cib_errors + +cib_process_diff(const char *op, int options, const char *section, xmlNode * req, xmlNode * input, + xmlNode * existing_cib, xmlNode ** result_cib, xmlNode ** answer); + +enum cib_errors + +cib_process_upgrade(const char *op, int options, const char *section, xmlNode * req, + xmlNode * input, xmlNode * existing_cib, xmlNode ** result_cib, + xmlNode ** answer); + +enum cib_errors + +cib_process_xpath(const char *op, int options, const char *section, xmlNode * req, xmlNode * input, + xmlNode * existing_cib, xmlNode ** result_cib, xmlNode ** answer); + +enum cib_errors cib_update_counter(xmlNode * xml_obj, const char *field, gboolean reset); +extern xmlNode *diff_cib_object(xmlNode * old_cib, xmlNode * new_cib, gboolean suppress); +extern gboolean apply_cib_diff(xmlNode * old, xmlNode * diff, xmlNode ** new); +extern gboolean cib_config_changed(xmlNode * last, xmlNode * next, xmlNode ** diff); +extern gboolean update_results(xmlNode * failed, xmlNode * target, const char *operation, + int return_code); #endif diff --git a/include/crm/cib_util.h b/include/crm/cib_util.h index 1faa88f7df..9b9f847b9d 100644 --- a/include/crm/cib_util.h +++ b/include/crm/cib_util.h @@ -1,142 +1,134 @@ /* * 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 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef CIB_UTIL__H -#define CIB_UTIL__H +# define CIB_UTIL__H /* Utility functions */ extern const char *get_object_path(const char *object_type); extern const char *get_object_parent(const char *object_type); -extern xmlNode *get_object_root(const char *object_type,xmlNode *the_root); -extern xmlNode *create_cib_fragment_adv( - xmlNode *update, const char *section, const char *source); +extern xmlNode *get_object_root(const char *object_type, xmlNode * the_root); +extern xmlNode *create_cib_fragment_adv(xmlNode * update, const char *section, const char *source); + /* Error Interpretation*/ extern const char *cib_error2string(enum cib_errors); extern xmlNode *createEmptyCib(void); -extern gboolean verifyCibXml(xmlNode *cib); +extern gboolean verifyCibXml(xmlNode * cib); extern int cib_section2enum(const char *a_section); -#define create_cib_fragment(update,cib_section) create_cib_fragment_adv(update, cib_section, __FUNCTION__) +# define create_cib_fragment(update,cib_section) create_cib_fragment_adv(update, cib_section, __FUNCTION__) -extern xmlNode *diff_cib_object( - xmlNode *old, xmlNode *new,gboolean suppress); +extern xmlNode *diff_cib_object(xmlNode * old, xmlNode * new, gboolean suppress); -extern gboolean apply_cib_diff( - xmlNode *old, xmlNode *diff, xmlNode **new); +extern gboolean apply_cib_diff(xmlNode * old, xmlNode * diff, xmlNode ** new); -extern void log_cib_diff(int log_level, xmlNode *diff, const char *function); +extern void log_cib_diff(int log_level, xmlNode * diff, const char *function); -extern gboolean cib_diff_version_details( - xmlNode *diff, int *admin_epoch, int *epoch, int *updates, - int *_admin_epoch, int *_epoch, int *_updates); +extern gboolean cib_diff_version_details(xmlNode * diff, int *admin_epoch, int *epoch, int *updates, + int *_admin_epoch, int *_epoch, int *_updates); -extern gboolean cib_version_details( - xmlNode *cib, int *admin_epoch, int *epoch, int *updates); +extern gboolean cib_version_details(xmlNode * cib, int *admin_epoch, int *epoch, int *updates); -extern enum cib_errors update_attr_delegate( - cib_t *the_cib, int call_options, - const char *section, const char *node_uuid, const char *set_type, const char *set_name, - const char *attr_id, const char *attr_name, const char *attr_value, gboolean to_console, - const char *user_name); +extern enum cib_errors update_attr_delegate(cib_t * the_cib, int call_options, + const char *section, const char *node_uuid, + const char *set_type, const char *set_name, + const char *attr_id, const char *attr_name, + const char *attr_value, gboolean to_console, + const char *user_name); static inline enum cib_errors -update_attr( - cib_t *the_cib, int call_options, - const char *section, const char *node_uuid, const char *set_type, const char *set_name, - const char *attr_id, const char *attr_name, const char *attr_value, gboolean to_console) +update_attr(cib_t * the_cib, int call_options, + const char *section, const char *node_uuid, const char *set_type, const char *set_name, + const char *attr_id, const char *attr_name, const char *attr_value, gboolean to_console) { - return update_attr_delegate( - the_cib, call_options, section, node_uuid, set_type, set_name, - attr_id, attr_name, attr_value, to_console, NULL); + return update_attr_delegate(the_cib, call_options, section, node_uuid, set_type, set_name, + attr_id, attr_name, attr_value, to_console, NULL); } -extern enum cib_errors find_nvpair_attr_delegate( - cib_t *the_cib, const char *attr, const char *section, const char *node_uuid, const char *set_type, - const char *set_name, const char *attr_id, const char *attr_name, gboolean to_console, char **value, - const char *user_name); - +extern enum cib_errors find_nvpair_attr_delegate(cib_t * the_cib, const char *attr, + const char *section, const char *node_uuid, + const char *set_type, const char *set_name, + const char *attr_id, const char *attr_name, + gboolean to_console, char **value, + const char *user_name); static inline enum cib_errors -find_nvpair_attr( - cib_t *the_cib, const char *attr, const char *section, const char *node_uuid, const char *set_type, - const char *set_name, const char *attr_id, const char *attr_name, gboolean to_console, char **value) +find_nvpair_attr(cib_t * the_cib, const char *attr, const char *section, const char *node_uuid, + const char *set_type, const char *set_name, const char *attr_id, + const char *attr_name, gboolean to_console, char **value) { - return find_nvpair_attr_delegate( - the_cib, attr, section, node_uuid, set_type, - set_name, attr_id, attr_name, to_console, value, NULL); + return find_nvpair_attr_delegate(the_cib, attr, section, node_uuid, set_type, + set_name, attr_id, attr_name, to_console, value, NULL); } -extern enum cib_errors read_attr_delegate( - cib_t *the_cib, - const char *section, const char *node_uuid, const char *set_type, const char *set_name, - const char *attr_id, const char *attr_name, char **attr_value, gboolean to_console, - const char *user_name); +extern enum cib_errors read_attr_delegate(cib_t * the_cib, + const char *section, const char *node_uuid, + const char *set_type, const char *set_name, + const char *attr_id, const char *attr_name, + char **attr_value, gboolean to_console, + const char *user_name); static inline enum -cib_errors read_attr( - cib_t *the_cib, - const char *section, const char *node_uuid, const char *set_type, const char *set_name, - const char *attr_id, const char *attr_name, char **attr_value, gboolean to_console) + cib_errors +read_attr(cib_t * the_cib, + const char *section, const char *node_uuid, const char *set_type, const char *set_name, + const char *attr_id, const char *attr_name, char **attr_value, gboolean to_console) { - return read_attr_delegate( - the_cib, section, node_uuid, set_type, set_name, - attr_id, attr_name, attr_value, to_console, NULL); + return read_attr_delegate(the_cib, section, node_uuid, set_type, set_name, + attr_id, attr_name, attr_value, to_console, NULL); } -extern enum cib_errors delete_attr_delegate( - cib_t *the_cib, int options, - const char *section, const char *node_uuid, const char *set_type, const char *set_name, - const char *attr_id, const char *attr_name, const char *attr_value, gboolean to_console, - const char *user_name); +extern enum cib_errors delete_attr_delegate(cib_t * the_cib, int options, + const char *section, const char *node_uuid, + const char *set_type, const char *set_name, + const char *attr_id, const char *attr_name, + const char *attr_value, gboolean to_console, + const char *user_name); static inline enum -cib_errors delete_attr( - cib_t *the_cib, int options, - const char *section, const char *node_uuid, const char *set_type, const char *set_name, - const char *attr_id, const char *attr_name, const char *attr_value, gboolean to_console) + cib_errors +delete_attr(cib_t * the_cib, int options, + const char *section, const char *node_uuid, const char *set_type, const char *set_name, + const char *attr_id, const char *attr_name, const char *attr_value, gboolean to_console) { - return delete_attr_delegate( - the_cib, options, section, node_uuid, set_type, set_name, - attr_id, attr_name, attr_value, to_console, NULL); + return delete_attr_delegate(the_cib, options, section, node_uuid, set_type, set_name, + attr_id, attr_name, attr_value, to_console, NULL); } -extern enum cib_errors query_node_uuid( - cib_t *the_cib, const char *uname, char **uuid); +extern enum cib_errors query_node_uuid(cib_t * the_cib, const char *uname, char **uuid); -extern enum cib_errors query_node_uname( - cib_t *the_cib, const char *uuid, char **uname); +extern enum cib_errors query_node_uname(cib_t * the_cib, const char *uuid, char **uname); -extern enum cib_errors set_standby( - cib_t *the_cib, - const char *uuid, const char *scope, const char *standby_value); +extern enum cib_errors set_standby(cib_t * the_cib, + const char *uuid, const char *scope, const char *standby_value); -extern const char *feature_set(xmlNode *xml_obj); +extern const char *feature_set(xmlNode * xml_obj); -extern gboolean startCib(const char *filename); -extern xmlNode *get_cib_copy(cib_t *cib); -extern xmlNode *cib_get_generation(cib_t *cib); -extern int cib_compare_generation(xmlNode *left, xmlNode *right); -extern gboolean determine_host(cib_t *cib_conn, char **node_uname, char **node_uuid); +extern gboolean startCib(const char *filename); +extern xmlNode *get_cib_copy(cib_t * cib); +extern xmlNode *cib_get_generation(cib_t * cib); +extern int cib_compare_generation(xmlNode * left, xmlNode * right); +extern gboolean determine_host(cib_t * cib_conn, char **node_uname, char **node_uuid); extern void cib_metadata(void); -extern void verify_cib_options(GHashTable *options); -extern const char *cib_pref(GHashTable *options, const char *name); -extern gboolean cib_read_config(GHashTable *options, xmlNode *current_cib); -extern gboolean cib_internal_config_changed(xmlNode *diff); +extern void verify_cib_options(GHashTable * options); +extern const char *cib_pref(GHashTable * options, const char *name); +extern gboolean cib_read_config(GHashTable * options, xmlNode * current_cib); +extern gboolean cib_internal_config_changed(xmlNode * diff); #endif diff --git a/include/crm/common/cluster.h b/include/crm/common/cluster.h index c939b609da..de35622d81 100644 --- a/include/crm/common/cluster.h +++ b/include/crm/common/cluster.h @@ -1,135 +1,132 @@ /* * 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 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef CRM_COMMON_CLUSTER__H -#define CRM_COMMON_CLUSTER__H +# define CRM_COMMON_CLUSTER__H -#include -#include -#include -#include +# include +# include +# include +# include -#if SUPPORT_HEARTBEAT -# include -# include -#endif +# if SUPPORT_HEARTBEAT +# include +# include +# endif extern gboolean crm_have_quorum; extern GHashTable *crm_peer_cache; extern GHashTable *crm_peer_id_cache; extern unsigned long long crm_peer_seq; extern void crm_peer_init(void); extern void crm_peer_destroy(void); -extern gboolean crm_cluster_connect( - char **our_uname, char **our_uuid, void *dispatch, void *destroy, -#if SUPPORT_HEARTBEAT - ll_cluster_t **hb_conn -#else - void **unused -#endif +extern gboolean crm_cluster_connect(char **our_uname, char **our_uuid, void *dispatch, + void *destroy, +# if SUPPORT_HEARTBEAT + ll_cluster_t ** hb_conn +# else + void **unused +# endif ); -extern gboolean init_cman_connection( - gboolean (*dispatch)(unsigned long long, gboolean), void (*destroy)(gpointer)); - -extern gboolean init_quorum_connection( - gboolean (*dispatch)(unsigned long long, gboolean), void (*destroy)(gpointer)); +extern gboolean init_cman_connection(gboolean(*dispatch) (unsigned long long, gboolean), + void (*destroy) (gpointer)); + +extern gboolean init_quorum_connection(gboolean(*dispatch) (unsigned long long, gboolean), + void (*destroy) (gpointer)); -extern gboolean send_cluster_message( - const char *node, enum crm_ais_msg_types service, xmlNode *data, gboolean ordered); +extern gboolean send_cluster_message(const char *node, enum crm_ais_msg_types service, + xmlNode * data, gboolean ordered); extern void destroy_crm_node(gpointer data); extern crm_node_t *crm_get_peer(unsigned int id, const char *uname); -extern crm_node_t *crm_update_ais_node(xmlNode *member, long long seq); -extern crm_node_t *crm_update_cman_node(xmlNode *member, long long seq); -extern void crm_update_peer_proc( - const char *uname, uint32_t flag, const char *status); -extern crm_node_t *crm_update_peer( - unsigned int id, uint64_t born, uint64_t seen, int32_t votes, uint32_t children, - const char *uuid, const char *uname, const char *addr, const char *state); +extern crm_node_t *crm_update_ais_node(xmlNode * member, long long seq); +extern crm_node_t *crm_update_cman_node(xmlNode * member, long long seq); +extern void crm_update_peer_proc(const char *uname, uint32_t flag, const char *status); +extern crm_node_t *crm_update_peer(unsigned int id, uint64_t born, uint64_t seen, int32_t votes, + uint32_t children, const char *uuid, const char *uname, + const char *addr, const char *state); -extern gboolean crm_is_member_active(const crm_node_t *node); -extern gboolean crm_is_full_member(const crm_node_t *node); +extern gboolean crm_is_member_active(const crm_node_t * node); +extern gboolean crm_is_full_member(const crm_node_t * node); extern guint crm_active_members(void); extern guint reap_crm_member(uint32_t id); extern guint crm_active_members(void); extern guint crm_active_peers(uint32_t peer); extern gboolean crm_calculate_quorum(void); -extern int crm_terminate_member(int nodeid, const char *uname, IPC_Channel *cluster); +extern int crm_terminate_member(int nodeid, const char *uname, IPC_Channel * cluster); extern int crm_terminate_member_no_mainloop(int nodeid, const char *uname, int *connection); extern gboolean crm_get_cluster_name(char **cname); -#if SUPPORT_HEARTBEAT +# if SUPPORT_HEARTBEAT extern gboolean ccm_have_quorum(oc_ed_t event); extern const char *ccm_event_name(oc_ed_t event); -extern crm_node_t *crm_update_ccm_node( - const oc_ev_membership_t *oc, int offset, const char *state, uint64_t seq); -#endif +extern crm_node_t *crm_update_ccm_node(const oc_ev_membership_t * oc, int offset, const char *state, + uint64_t seq); +# endif -#if SUPPORT_COROSYNC +# if SUPPORT_COROSYNC extern int ais_fd_sync; extern GFDSource *ais_source; -extern gboolean send_ais_text( - int class, const char *data, gboolean local, - const char *node, enum crm_ais_msg_types dest); -extern gboolean get_ais_nodeid(uint32_t *id, char **uname); +extern gboolean send_ais_text(int class, const char *data, gboolean local, + const char *node, enum crm_ais_msg_types dest); +extern gboolean get_ais_nodeid(uint32_t * id, char **uname); extern gboolean ais_dispatch(int sender, gpointer user_data); -#endif +# endif extern void empty_uuid_cache(void); extern const char *get_uuid(const char *uname); extern const char *get_uname(const char *uuid); -extern void set_uuid(xmlNode *node, const char *attr, const char *uname); +extern void set_uuid(xmlNode * node, const char *attr, const char *uname); extern void unget_uuid(const char *uname); -enum crm_status_type -{ +enum crm_status_type { crm_status_uname, crm_status_nstate, crm_status_processes, }; enum crm_ais_msg_types text2msg_type(const char *text); -extern void crm_set_status_callback( - void (*dispatch)(enum crm_status_type, crm_node_t*, const void*)); +extern void +crm_set_status_callback(void (*dispatch) (enum crm_status_type, crm_node_t *, const void *)); /* *INDENT-OFF* */ enum cluster_type_e { pcmk_cluster_unknown = 0x0001, pcmk_cluster_invalid = 0x0002, pcmk_cluster_heartbeat = 0x0004, pcmk_cluster_classic_ais = 0x0010, pcmk_cluster_corosync = 0x0020, pcmk_cluster_cman = 0x0040, }; /* *INDENT-ON* */ extern enum cluster_type_e get_cluster_type(void); extern const char *name_for_cluster_type(enum cluster_type_e type); extern gboolean is_corosync_cluster(void); extern gboolean is_cman_cluster(void); extern gboolean is_openais_cluster(void); extern gboolean is_classic_ais_cluster(void); extern gboolean is_heartbeat_cluster(void); #endif diff --git a/include/crm/common/ipc.h b/include/crm/common/ipc.h index 8e1c23054a..77d5e85cec 100644 --- a/include/crm/common/ipc.h +++ b/include/crm/common/ipc.h @@ -1,98 +1,88 @@ /* * 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 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef CRM_COMMON_IPC__H -#define CRM_COMMON_IPC__H - -#include -#include - -#include -#include - -typedef struct crmd_client_s -{ - char *sub_sys; - char *uuid; - char *table_key; - char *user; - IPC_Channel *client_channel; - GCHSource *client_source; +# define CRM_COMMON_IPC__H + +# include +# include + +# include +# include + +typedef struct crmd_client_s { + char *sub_sys; + char *uuid; + char *table_key; + char *user; + IPC_Channel *client_channel; + GCHSource *client_source; } crmd_client_t; -extern gboolean send_ipc_message(IPC_Channel *ipc_client, xmlNode *msg); +extern gboolean send_ipc_message(IPC_Channel * ipc_client, xmlNode * msg); extern void default_ipc_connection_destroy(gpointer user_data); -extern int init_server_ipc_comms( - char *channel_name, - gboolean (*channel_client_connect)( - IPC_Channel *newclient, gpointer user_data), - void (*channel_connection_destroy)(gpointer user_data)); +extern int init_server_ipc_comms(char *channel_name, + gboolean(*channel_client_connect) (IPC_Channel * newclient, + gpointer user_data), + void (*channel_connection_destroy) (gpointer user_data)); -extern GCHSource *init_client_ipc_comms( - const char *channel_name, - gboolean (*dispatch)( - IPC_Channel* source_data, gpointer user_data), - void *client_data, IPC_Channel **ch); +extern GCHSource *init_client_ipc_comms(const char *channel_name, + gboolean(*dispatch) (IPC_Channel * source_data, + gpointer user_data), void *client_data, + IPC_Channel ** ch); extern IPC_Channel *init_client_ipc_comms_nodispatch(const char *channel_name); -extern gboolean subsystem_msg_dispatch(IPC_Channel *sender, void *user_data); +extern gboolean subsystem_msg_dispatch(IPC_Channel * sender, void *user_data); extern IPC_WaitConnection *wait_channel_init(char daemonsocket[]); -extern gboolean is_ipc_empty(IPC_Channel *ch); - +extern gboolean is_ipc_empty(IPC_Channel * ch); -extern xmlNode *createPingRequest(const char *crm_msg_reference, - const char *to); +extern xmlNode *createPingRequest(const char *crm_msg_reference, const char *to); -extern xmlNode *validate_crm_message(xmlNode *msg, - const char *sys, - const char *uuid, - const char *msg_type); +extern xmlNode *validate_crm_message(xmlNode * msg, + const char *sys, const char *uuid, const char *msg_type); -extern void send_hello_message(IPC_Channel *ipc_client, - const char *uuid, - const char *client_name, - const char *major_version, - const char *minor_version); +extern void send_hello_message(IPC_Channel * ipc_client, + const char *uuid, + const char *client_name, + const char *major_version, const char *minor_version); -#define create_reply(request, xml_response_data) create_reply_adv(request, xml_response_data, __FUNCTION__); -extern xmlNode *create_reply_adv(xmlNode *request, xmlNode *xml_response_data, const char *origin); +# define create_reply(request, xml_response_data) create_reply_adv(request, xml_response_data, __FUNCTION__); +extern xmlNode *create_reply_adv(xmlNode * request, xmlNode * xml_response_data, + const char *origin); -#define create_request(task, xml_data, host_to, sys_to, sys_from, uuid_from) create_request_adv(task, xml_data, host_to, sys_to, sys_from, uuid_from, __FUNCTION__) +# define create_request(task, xml_data, host_to, sys_to, sys_from, uuid_from) create_request_adv(task, xml_data, host_to, sys_to, sys_from, uuid_from, __FUNCTION__) -extern xmlNode *create_request_adv( - const char *task, xmlNode *xml_data, const char *host_to, - const char *sys_to, const char *sys_from, const char *uuid_from, - const char *origin); +extern xmlNode *create_request_adv(const char *task, xmlNode * xml_data, const char *host_to, + const char *sys_to, const char *sys_from, const char *uuid_from, + const char *origin); +typedef struct ha_msg_input_s { + xmlNode *msg; + xmlNode *xml; -typedef struct ha_msg_input_s -{ - xmlNode *msg; - xmlNode *xml; - } ha_msg_input_t; -extern ha_msg_input_t *new_ha_msg_input(xmlNode *orig); -extern void delete_ha_msg_input(ha_msg_input_t *orig); -extern xmlNode *xmlfromIPC(IPC_Channel *ch, int timeout); +extern ha_msg_input_t *new_ha_msg_input(xmlNode * orig); +extern void delete_ha_msg_input(ha_msg_input_t * orig); +extern xmlNode *xmlfromIPC(IPC_Channel * ch, int timeout); #endif diff --git a/include/crm/common/iso8601.h b/include/crm/common/iso8601.h index ce003de296..a2c26b17d1 100644 --- a/include/crm/common/iso8601.h +++ b/include/crm/common/iso8601.h @@ -1,163 +1,160 @@ /* * Copyright (C) 2005 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 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * http://en.wikipedia.org/wiki/ISO_8601 * */ #ifndef CRM_COMMON_ISO8601 -#define CRM_COMMON_ISO8601 +# define CRM_COMMON_ISO8601 -#include -#include -#include +# include +# include +# include typedef struct ha_has_time_s { - gboolean years; + gboolean years; - gboolean months; - gboolean days; - - gboolean weeks; - gboolean weekdays; - gboolean weekyears; + gboolean months; + gboolean days; - gboolean yeardays; + gboolean weeks; + gboolean weekdays; + gboolean weekyears; - gboolean hours; - gboolean minutes; - gboolean seconds; + gboolean yeardays; + + gboolean hours; + gboolean minutes; + gboolean seconds; } ha_has_time_t; -typedef struct ha_time_s -{ - time_t tm_now; - - int years; - - int months; - int days; - - int weeks; - int weekdays; - int weekyears; - - int yeardays; - - int hours; - int minutes; - int seconds; - - struct ha_time_s *offset; - struct ha_time_s *normalized; - struct ha_has_time_s *has; +typedef struct ha_time_s { + time_t tm_now; + + int years; + + int months; + int days; + + int weeks; + int weekdays; + int weekyears; + + int yeardays; + + int hours; + int minutes; + int seconds; + + struct ha_time_s *offset; + struct ha_time_s *normalized; + struct ha_has_time_s *has; } ha_time_t; enum date_fields { - date_month, - date_day + date_month, + date_day }; -typedef struct ha_time_period_s -{ - ha_time_t *start; - ha_time_t *end; - ha_time_t *diff; +typedef struct ha_time_period_s { + ha_time_t *start; + ha_time_t *end; + ha_time_t *diff; } ha_time_period_t; +# define ha_log_date 0x01 +# define ha_log_time 0x02 +# define ha_log_local 0x04 -#define ha_log_date 0x01 -#define ha_log_time 0x02 -#define ha_log_local 0x04 - -#define ha_date_ordinal 0x10 -#define ha_date_weeks 0x20 +# define ha_date_ordinal 0x10 +# define ha_date_weeks 0x20 extern int str_lookup(const char *str, enum date_fields); -extern char *date_to_string(ha_time_t *dt, int flags); -extern void log_date(int log_level, const char *prefix, ha_time_t *dt, int flags); -extern void log_time_period(int log_level, ha_time_period_t *dtp, int flags); +extern char *date_to_string(ha_time_t * dt, int flags); +extern void log_date(int log_level, const char *prefix, ha_time_t * dt, int flags); +extern void log_time_period(int log_level, ha_time_period_t * dtp, int flags); + +extern ha_time_t *parse_time(char **time_str, ha_time_t * atime, gboolean with_offset); +extern ha_time_t *parse_time_offset(char **offset_str); +extern ha_time_t *parse_date(char **date_str); +extern ha_time_t *parse_time_duration(char **duration_str); +extern ha_time_period_t *parse_time_period(char **period_str); -extern ha_time_t *parse_time (char **time_str, ha_time_t *atime, gboolean with_offset); -extern ha_time_t *parse_time_offset (char **offset_str); -extern ha_time_t *parse_date (char **date_str); -extern ha_time_t *parse_time_duration(char **duration_str); -extern ha_time_period_t *parse_time_period (char **period_str); /* ha_time_interval_t *parse_time_interval(char **interval_str); */ -unsigned long long int date_in_seconds(ha_time_t *a_date); -unsigned long long int date_in_seconds_since_epoch(ha_time_t *a_date); -extern int compare_date(ha_time_t *lhs, ha_time_t *rhs); +unsigned long long int date_in_seconds(ha_time_t * a_date); +unsigned long long int date_in_seconds_since_epoch(ha_time_t * a_date); +extern int compare_date(ha_time_t * lhs, ha_time_t * rhs); extern gboolean parse_int(char **str, int field_width, int uppper_bound, int *result); extern gboolean check_for_ordinal(const char *str); -extern void ha_set_time(ha_time_t *lhs, ha_time_t *rhs, gboolean offset); -extern void ha_set_tm_time(ha_time_t *lhs, struct tm *rhs); -extern void ha_set_timet_time(ha_time_t *lhs, time_t *rhs); -extern ha_time_t *add_time(ha_time_t *lhs, ha_time_t *rhs); -extern ha_time_t *subtract_time(ha_time_t *lhs, ha_time_t *rhs); -extern ha_time_t *subtract_duration(ha_time_t *time, ha_time_t *duration); +extern void ha_set_time(ha_time_t * lhs, ha_time_t * rhs, gboolean offset); +extern void ha_set_tm_time(ha_time_t * lhs, struct tm *rhs); +extern void ha_set_timet_time(ha_time_t * lhs, time_t * rhs); +extern ha_time_t *add_time(ha_time_t * lhs, ha_time_t * rhs); +extern ha_time_t *subtract_time(ha_time_t * lhs, ha_time_t * rhs); +extern ha_time_t *subtract_duration(ha_time_t * time, ha_time_t * duration); extern void reset_tm(struct tm *some_tm); -extern void add_seconds(ha_time_t *a_time, int extra); -extern void add_minutes(ha_time_t *a_time, int extra); -extern void add_hours(ha_time_t *a_time, int extra); -extern void add_days(ha_time_t *a_time, int extra); -extern void add_weekdays(ha_time_t *a_time, int extra); -extern void add_yeardays(ha_time_t *a_time, int extra); -extern void add_weeks(ha_time_t *a_time, int extra); -extern void add_months(ha_time_t *a_time, int extra); -extern void add_years(ha_time_t *a_time, int extra); -extern void add_ordinalyears(ha_time_t *a_time, int extra); -extern void add_weekyears(ha_time_t *a_time, int extra); -extern void sub_seconds(ha_time_t *a_time, int extra); -extern void sub_minutes(ha_time_t *a_time, int extra); -extern void sub_hours(ha_time_t *a_time, int extra); -extern void sub_days(ha_time_t *a_time, int extra); -extern void sub_weekdays(ha_time_t *a_time, int extra); -extern void sub_yeardays(ha_time_t *a_time, int extra); -extern void sub_weeks(ha_time_t *a_time, int extra); -extern void sub_months(ha_time_t *a_time, int extra); -extern void sub_years(ha_time_t *a_time, int extra); -extern void sub_ordinalyears(ha_time_t *a_time, int extra); -extern void sub_weekyears(ha_time_t *a_time, int extra); +extern void add_seconds(ha_time_t * a_time, int extra); +extern void add_minutes(ha_time_t * a_time, int extra); +extern void add_hours(ha_time_t * a_time, int extra); +extern void add_days(ha_time_t * a_time, int extra); +extern void add_weekdays(ha_time_t * a_time, int extra); +extern void add_yeardays(ha_time_t * a_time, int extra); +extern void add_weeks(ha_time_t * a_time, int extra); +extern void add_months(ha_time_t * a_time, int extra); +extern void add_years(ha_time_t * a_time, int extra); +extern void add_ordinalyears(ha_time_t * a_time, int extra); +extern void add_weekyears(ha_time_t * a_time, int extra); +extern void sub_seconds(ha_time_t * a_time, int extra); +extern void sub_minutes(ha_time_t * a_time, int extra); +extern void sub_hours(ha_time_t * a_time, int extra); +extern void sub_days(ha_time_t * a_time, int extra); +extern void sub_weekdays(ha_time_t * a_time, int extra); +extern void sub_yeardays(ha_time_t * a_time, int extra); +extern void sub_weeks(ha_time_t * a_time, int extra); +extern void sub_months(ha_time_t * a_time, int extra); +extern void sub_years(ha_time_t * a_time, int extra); +extern void sub_ordinalyears(ha_time_t * a_time, int extra); +extern void sub_weekyears(ha_time_t * a_time, int extra); /* conversion functions */ extern int january1(int year); -extern gboolean convert_from_weekdays(ha_time_t *a_date); -extern gboolean convert_from_ordinal(ha_time_t *a_date); -extern gboolean convert_from_gregorian(ha_time_t *a_date); +extern gboolean convert_from_weekdays(ha_time_t * a_date); +extern gboolean convert_from_ordinal(ha_time_t * a_date); +extern gboolean convert_from_gregorian(ha_time_t * a_date); extern gboolean is_leap_year(int year); extern int weeks_in_year(int year); extern int days_per_month(int month, int year); -gboolean is_date_sane(ha_time_t *a_date); - +gboolean is_date_sane(ha_time_t * a_date); ha_time_t *new_ha_date(gboolean set_to_now); -void free_ha_date(ha_time_t *a_date); +void free_ha_date(ha_time_t * a_date); -void reset_time(ha_time_t *a_time); +void reset_time(ha_time_t * a_time); void log_tm_date(int log_level, struct tm *some_tm); #endif diff --git a/include/crm/common/mainloop.h b/include/crm/common/mainloop.h index 2ca2c3c462..021f5ca656 100644 --- a/include/crm/common/mainloop.h +++ b/include/crm/common/mainloop.h @@ -1,45 +1,44 @@ /* * Copyright (C) 2009 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 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef CRM_COMMON_MAINLOOP__H -#define CRM_COMMON_MAINLOOP__H +# define CRM_COMMON_MAINLOOP__H -#include +# include -typedef struct trigger_s -{ - GSource source; - gboolean trigger; - void *user_data; - guint id; +typedef struct trigger_s { + GSource source; + gboolean trigger; + void *user_data; + guint id; } crm_trigger_t; -extern crm_trigger_t *mainloop_add_trigger( - int priority, gboolean (*dispatch)(gpointer user_data), gpointer userdata); +extern crm_trigger_t *mainloop_add_trigger(int priority, gboolean(*dispatch) (gpointer user_data), + gpointer userdata); -extern void mainloop_set_trigger(crm_trigger_t* source); +extern void mainloop_set_trigger(crm_trigger_t * source); -extern gboolean mainloop_destroy_trigger(crm_trigger_t* source); +extern gboolean mainloop_destroy_trigger(crm_trigger_t * source); -extern gboolean crm_signal(int sig, void (*dispatch)(int sig)); +extern gboolean crm_signal(int sig, void (*dispatch) (int sig)); -extern gboolean mainloop_add_signal(int sig, void (*dispatch)(int sig)); +extern gboolean mainloop_add_signal(int sig, void (*dispatch) (int sig)); extern gboolean mainloop_destroy_signal(int sig); #endif diff --git a/include/crm/common/msg.h b/include/crm/common/msg.h index c5636fa38a..0d140d5873 100644 --- a/include/crm/common/msg.h +++ b/include/crm/common/msg.h @@ -1,35 +1,32 @@ /* * 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 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef CRM_COMMON_MSG__H -#define CRM_COMMON_MSG__H +# define CRM_COMMON_MSG__H -#include -#include -#include +# include +# include +# include -extern xmlNode *createPingAnswerFragment(const char *from, - const char *status); +extern xmlNode *createPingAnswerFragment(const char *from, const char *status); - -extern gboolean process_hello_message(xmlNode *hello, - char **uuid, - char **client_name, - char **major_version, - char **minor_version); +extern gboolean process_hello_message(xmlNode * hello, + char **uuid, + char **client_name, + char **major_version, char **minor_version); #endif diff --git a/include/crm/common/util.h b/include/crm/common/util.h index 8332f46623..18fddcc898 100644 --- a/include/crm/common/util.h +++ b/include/crm/common/util.h @@ -1,375 +1,381 @@ /* * 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 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef CRM_COMMON_UTIL__H -#define CRM_COMMON_UTIL__H - -#include -#include - -#include - -#include -#include -#include -#include - -#if SUPPORT_HEARTBEAT -# include -#else -# define NORMALNODE "normal" -# define ACTIVESTATUS "active" /* fully functional, and all links are up */ -# define DEADSTATUS "dead" /* Status of non-working link or machine */ -# define PINGSTATUS "ping" /* Status of a working ping node */ -# define JOINSTATUS "join" /* Status when an api client joins */ -# define LEAVESTATUS "leave" /* Status when an api client leaves */ -# define ONLINESTATUS "online" /* Status of an online client */ -# define OFFLINESTATUS "offline" /* Status of an offline client */ -#endif - -#define DEBUG_INC SIGUSR1 -#define DEBUG_DEC SIGUSR2 +# define CRM_COMMON_UTIL__H + +# include +# include + +# include + +# include +# include +# include +# include + +# if SUPPORT_HEARTBEAT +# include +# else +# define NORMALNODE "normal" +# define ACTIVESTATUS "active"/* fully functional, and all links are up */ +# define DEADSTATUS "dead" + /* Status of non-working link or machine */ +# define PINGSTATUS "ping" + /* Status of a working ping node */ +# define JOINSTATUS "join" + /* Status when an api client joins */ +# define LEAVESTATUS "leave" + /* Status when an api client leaves */ +# define ONLINESTATUS "online"/* Status of an online client */ +# define OFFLINESTATUS "offline" + /* Status of an offline client */ +# endif + +# define DEBUG_INC SIGUSR1 +# define DEBUG_DEC SIGUSR2 extern unsigned int crm_log_level; extern gboolean crm_config_error; extern gboolean crm_config_warning; -#ifdef HAVE_GETOPT_H -# include -#else -#define no_argument 0 -#define required_argument 1 -#endif - -#define pcmk_option_default 0x00000 -#define pcmk_option_hidden 0x00001 -#define pcmk_option_paragraph 0x00002 -#define pcmk_option_example 0x00004 - -struct crm_option -{ - /* Fields from 'struct option' in getopt.h */ - /* name of long option */ - const char *name; - /* - * one of no_argument, required_argument, and optional_argument: - * whether option takes an argument - */ - int has_arg; - /* if not NULL, set *flag to val when option found */ - int *flag; - /* if flag not NULL, value to set *flag to; else return value */ - int val; - - /* Custom fields */ - const char *desc; - long flags; +# ifdef HAVE_GETOPT_H +# include +# else +# define no_argument 0 +# define required_argument 1 +# endif + +# define pcmk_option_default 0x00000 +# define pcmk_option_hidden 0x00001 +# define pcmk_option_paragraph 0x00002 +# define pcmk_option_example 0x00004 + +struct crm_option { + /* Fields from 'struct option' in getopt.h */ + /* name of long option */ + const char *name; + /* + * one of no_argument, required_argument, and optional_argument: + * whether option takes an argument + */ + int has_arg; + /* if not NULL, set *flag to val when option found */ + int *flag; + /* if flag not NULL, value to set *flag to; else return value */ + int val; + + /* Custom fields */ + const char *desc; + long flags; }; - -#define crm_config_err(fmt...) { crm_config_error = TRUE; crm_err(fmt); } -#define crm_config_warn(fmt...) { crm_config_warning = TRUE; crm_warn(fmt); } - +# define crm_config_err(fmt...) { crm_config_error = TRUE; crm_err(fmt); } +# define crm_config_warn(fmt...) { crm_config_warning = TRUE; crm_warn(fmt); } extern void crm_log_deinit(void); -extern gboolean crm_log_init( - const char *entity, int level, gboolean coredir, gboolean to_stderr, - int argc, char **argv); +extern gboolean crm_log_init(const char *entity, int level, gboolean coredir, gboolean to_stderr, + int argc, char **argv); -extern gboolean crm_log_init_quiet( - const char *entity, int level, gboolean coredir, gboolean to_stderr, - int argc, char **argv); +extern gboolean crm_log_init_quiet(const char *entity, int level, gboolean coredir, + gboolean to_stderr, int argc, char **argv); -extern gboolean crm_log_init_worker( - const char *entity, int level, gboolean coredir, gboolean to_stderr, - int argc, char **argv, gboolean quiet); +extern gboolean crm_log_init_worker(const char *entity, int level, gboolean coredir, + gboolean to_stderr, int argc, char **argv, gboolean quiet); /* returns the old value */ extern unsigned int set_crm_log_level(unsigned int level); extern unsigned int get_crm_log_level(void); extern char *crm_itoa(int an_int); extern char *crm_strdup_fn(const char *a, const char *file, const char *fn, int line); extern char *generate_hash_key(const char *crm_msg_reference, const char *sys); extern char *generate_hash_value(const char *src_node, const char *src_subsys); -extern gboolean decodeNVpair(const char *srcstring, - char separator, char **name, char **value); +extern gboolean decodeNVpair(const char *srcstring, char separator, char **name, char **value); extern int compare_version(const char *version1, const char *version2); - extern char *generateReference(const char *custom1, const char *custom2); extern void alter_debug(int nsig); extern void g_hash_destroy_str(gpointer data); -extern gboolean crm_is_true(const char * s); +extern gboolean crm_is_true(const char *s); -extern int crm_str_to_boolean(const char * s, int * ret); +extern int crm_str_to_boolean(const char *s, int *ret); -extern long long crm_get_msec(const char * input); -extern unsigned long long crm_get_interval(const char * input); +extern long long crm_get_msec(const char *input); +extern unsigned long long crm_get_interval(const char *input); extern const char *op_status2text(op_status_t status); -extern char *generate_op_key( - const char *rsc_id, const char *op_type, int interval); +extern char *generate_op_key(const char *rsc_id, const char *op_type, int interval); -extern gboolean parse_op_key( - const char *key, char **rsc_id, char **op_type, int *interval); +extern gboolean parse_op_key(const char *key, char **rsc_id, char **op_type, int *interval); -extern char *generate_notify_key( - const char *rsc_id, const char *notify_type, const char *op_type); +extern char *generate_notify_key(const char *rsc_id, const char *notify_type, const char *op_type); -extern char *generate_transition_magic_v202( - const char *transition_key, int op_status); +extern char *generate_transition_magic_v202(const char *transition_key, int op_status); -extern char *generate_transition_magic( - const char *transition_key, int op_status, int op_rc); +extern char *generate_transition_magic(const char *transition_key, int op_status, int op_rc); -extern gboolean decode_transition_magic( - const char *magic, char **uuid, - int *transition_id, int *action_id, int *op_status, int *op_rc, int *target_rc); +extern gboolean decode_transition_magic(const char *magic, char **uuid, + int *transition_id, int *action_id, int *op_status, + int *op_rc, int *target_rc); -extern char *generate_transition_key(int action, int transition_id, int target_rc, const char *node); +extern char *generate_transition_key(int action, int transition_id, int target_rc, + const char *node); -extern gboolean decode_transition_key( - const char *key, char **uuid, int *action, int *transition_id, int *target_rc); +extern gboolean decode_transition_key(const char *key, char **uuid, int *action, int *transition_id, + int *target_rc); extern char *crm_concat(const char *prefix, const char *suffix, char join); -extern gboolean decode_op_key( - const char *key, char **rsc_id, char **op_type, int *interval); +extern gboolean decode_op_key(const char *key, char **rsc_id, char **op_type, int *interval); -extern void filter_action_parameters(xmlNode *param_set, const char *version); -extern void filter_reload_parameters(xmlNode *param_set, const char *restart_string); +extern void filter_action_parameters(xmlNode * param_set, const char *version); +extern void filter_reload_parameters(xmlNode * param_set, const char *restart_string); -#define safe_str_eq(a, b) crm_str_eq(a, b, FALSE) +# define safe_str_eq(a, b) crm_str_eq(a, b, FALSE) extern gboolean crm_str_eq(const char *a, const char *b, gboolean use_case); extern gboolean safe_str_neq(const char *a, const char *b); extern int crm_parse_int(const char *text, const char *default_text); extern long long crm_int_helper(const char *text, char **end_text); -#define crm_atoi(text, default_text) crm_parse_int(text, default_text) + +# define crm_atoi(text, default_text) crm_parse_int(text, default_text) extern void crm_abort(const char *file, const char *function, int line, - const char *condition, gboolean do_core, gboolean do_fork); + const char *condition, gboolean do_core, gboolean do_fork); -extern char *generate_series_filename( - const char *directory, const char *series, int sequence, gboolean bzip); +extern char *generate_series_filename(const char *directory, const char *series, int sequence, + gboolean bzip); extern int get_last_sequence(const char *directory, const char *series); -extern void write_last_sequence( - const char *directory, const char *series, int sequence, int max); +extern void write_last_sequence(const char *directory, const char *series, int sequence, int max); extern int crm_pid_active(long pid); extern int crm_read_pidfile(const char *filename); extern int crm_lock_pidfile(const char *filename); -extern void crm_make_daemon( - const char *name, gboolean daemonize, const char *pidfile); +extern void crm_make_daemon(const char *name, gboolean daemonize, const char *pidfile); typedef struct pe_cluster_option_s { - const char *name; - const char *alt_name; - const char *type; - const char *values; - const char *default_value; + const char *name; + const char *alt_name; + const char *type; + const char *values; + const char *default_value; + + gboolean(*is_valid) (const char *); - gboolean (*is_valid)(const char *); + const char *description_short; + const char *description_long; - const char *description_short; - const char *description_long; - } pe_cluster_option; -extern const char *cluster_option( - GHashTable* options, gboolean(*validate)(const char*), - const char *name, const char *old_name, const char *def_value); +extern const char *cluster_option(GHashTable * options, gboolean(*validate) (const char *), + const char *name, const char *old_name, const char *def_value); -extern const char *get_cluster_pref( - GHashTable *options, pe_cluster_option *option_list, int len, const char *name); +extern const char *get_cluster_pref(GHashTable * options, pe_cluster_option * option_list, int len, + const char *name); -extern void config_metadata( - const char *name, const char *version, const char *desc_short, const char *desc_long, - pe_cluster_option *option_list, int len); +extern void config_metadata(const char *name, const char *version, const char *desc_short, + const char *desc_long, pe_cluster_option * option_list, int len); -extern void verify_all_options(GHashTable *options, pe_cluster_option *option_list, int len); +extern void verify_all_options(GHashTable * options, pe_cluster_option * option_list, int len); extern gboolean check_time(const char *value); extern gboolean check_timer(const char *value); extern gboolean check_boolean(const char *value); extern gboolean check_number(const char *value); extern int char2score(const char *score); extern char *score2char(int score); -extern gboolean crm_is_writable( - const char *dir, const char *file, - const char *user, const char *group, gboolean need_both); +extern gboolean crm_is_writable(const char *dir, const char *file, + const char *user, const char *group, gboolean need_both); extern long long crm_set_bit(const char *function, long long word, long long bit); extern long long crm_clear_bit(const char *function, long long word, long long bit); +# define set_bit(word, bit) word = crm_set_bit(__PRETTY_FUNCTION__, word, bit) +# define clear_bit(word, bit) word = crm_clear_bit(__PRETTY_FUNCTION__, word, bit) -#define set_bit(word, bit) word = crm_set_bit(__PRETTY_FUNCTION__, word, bit) -#define clear_bit(word, bit) word = crm_clear_bit(__PRETTY_FUNCTION__, word, bit) - -#define set_bit_inplace(word, bit) word |= bit -#define clear_bit_inplace(word, bit) word &= ~bit +# define set_bit_inplace(word, bit) word |= bit +# define clear_bit_inplace(word, bit) word &= ~bit static inline gboolean is_not_set(long long word, long long bit) { - return ((word & bit) == 0); + return ((word & bit) == 0); } static inline gboolean is_set(long long word, long long bit) { - return ((word & bit) == bit); + return ((word & bit) == bit); } static inline gboolean is_set_any(long long word, long long bit) { - return ((word & bit) != 0); + return ((word & bit) != 0); } extern xmlNode *cib_recv_remote_msg(void *session, gboolean encrypted); -extern void cib_send_remote_msg(void *session, xmlNode *msg, gboolean encrypted); +extern void cib_send_remote_msg(void *session, xmlNode * msg, gboolean encrypted); extern char *crm_meta_name(const char *field); -extern const char *crm_meta_value(GHashTable *hash, const char *field); +extern const char *crm_meta_value(GHashTable * hash, const char *field); -extern void crm_set_options(const char *short_options, const char *usage, struct crm_option *long_options, const char *app_desc); +extern void crm_set_options(const char *short_options, const char *usage, + struct crm_option *long_options, const char *app_desc); extern int crm_get_option(int argc, char **argv, int *index); extern void crm_help(char cmd, int exit_code); -extern int rsc_op_expected_rc(lrm_op_t *op); -extern gboolean did_rsc_op_fail(lrm_op_t *op, int target_rc); +extern int rsc_op_expected_rc(lrm_op_t * op); +extern gboolean did_rsc_op_fail(lrm_op_t * op, int target_rc); -extern gboolean attrd_update_delegate(IPC_Channel *cluster, char command, const char *host, const char *name, const char *value, const char *section, const char *set, const char *dampen, const char *user_name); +extern gboolean attrd_update_delegate(IPC_Channel * cluster, char command, const char *host, + const char *name, const char *value, const char *section, + const char *set, const char *dampen, const char *user_name); static inline gboolean -attrd_update(IPC_Channel *cluster, char command, const char *host, const char *name, const char *value, const char *section, const char *set, const char *dampen) +attrd_update(IPC_Channel * cluster, char command, const char *host, const char *name, + const char *value, const char *section, const char *set, const char *dampen) { - return attrd_update_delegate(cluster, command, host, name, value, section, set, dampen, NULL); + return attrd_update_delegate(cluster, command, host, name, value, section, set, dampen, NULL); } -extern gboolean attrd_lazy_update(char command, const char *host, const char *name, const char *value, const char *section, const char *set, const char *dampen); -extern gboolean attrd_update_no_mainloop(int *connection, char command, const char *host, const char *name, const char *value, const char *section, const char *set, const char *dampen); +extern gboolean attrd_lazy_update(char command, const char *host, const char *name, + const char *value, const char *section, const char *set, + const char *dampen); +extern gboolean attrd_update_no_mainloop(int *connection, char command, const char *host, + const char *name, const char *value, const char *section, + const char *set, const char *dampen); extern int node_score_red; extern int node_score_green; extern int node_score_yellow; extern int node_score_infinity; -#include -extern xmlNode *create_operation_update(xmlNode *parent, lrm_op_t *op, const char *caller_version, int target_rc, const char *origin, int level); -extern void free_lrm_op(lrm_op_t *op); +# include +extern xmlNode *create_operation_update(xmlNode * parent, lrm_op_t * op, const char *caller_version, + int target_rc, const char *origin, int level); +extern void free_lrm_op(lrm_op_t * op); -#if USE_GHASH_COMPAT +# if USE_GHASH_COMPAT -typedef struct fake_ghi -{ +typedef struct fake_ghi { GHashTable *hash; - int nth; /* current index over the iteration */ - int lpc; /* internal loop counter inside g_hash_table_find */ + int nth; /* current index over the iteration */ + int lpc; /* internal loop counter inside g_hash_table_find */ gpointer key; gpointer value; } GHashTableIter; -static inline void g_hash_prepend_value(gpointer key, gpointer value, gpointer user_data) +static inline void +g_hash_prepend_value(gpointer key, gpointer value, gpointer user_data) { - GList **values = (GList **)user_data; + GList **values = (GList **) user_data; + *values = g_list_prepend(*values, value); } -static inline GList *g_hash_table_get_values(GHashTable *hash_table) +static inline GList * +g_hash_table_get_values(GHashTable * hash_table) { GList *values = NULL; + g_hash_table_foreach(hash_table, g_hash_prepend_value, &values); return values; } - -static inline gboolean g_hash_table_nth_data(gpointer key, gpointer value, gpointer user_data) +static inline gboolean +g_hash_table_nth_data(gpointer key, gpointer value, gpointer user_data) { - GHashTableIter *iter = (GHashTableIter *)user_data; + GHashTableIter *iter = (GHashTableIter *) user_data; + if (iter->lpc++ == iter->nth) { - iter->key = key; - iter->value = value; - return TRUE; + iter->key = key; + iter->value = value; + return TRUE; } return FALSE; } -static inline void g_hash_table_iter_init(GHashTableIter *iter, GHashTable *hash_table) +static inline void +g_hash_table_iter_init(GHashTableIter * iter, GHashTable * hash_table) { iter->hash = hash_table; iter->nth = 0; iter->lpc = 0; iter->key = NULL; iter->value = NULL; } -static inline gboolean g_hash_table_iter_next(GHashTableIter *iter, gpointer *key, gpointer *value) +static inline gboolean +g_hash_table_iter_next(GHashTableIter * iter, gpointer * key, gpointer * value) { gboolean found = FALSE; + iter->lpc = 0; iter->key = NULL; iter->value = NULL; if (iter->nth < g_hash_table_size(iter->hash)) { - found = !!g_hash_table_find(iter->hash, g_hash_table_nth_data, iter); - iter->nth++; + found = ! !g_hash_table_find(iter->hash, g_hash_table_nth_data, iter); + iter->nth++; } - if (key) *key = iter->key; - if (value) *value = iter->value; + if (key) + *key = iter->key; + if (value) + *value = iter->value; return found; } -#endif /* USE_GHASH_COMPAT */ +# endif /* USE_GHASH_COMPAT */ -#if ENABLE_ACL -static inline gboolean is_privileged(const char *user) +# if ENABLE_ACL +static inline gboolean +is_privileged(const char *user) { if (user == NULL) { - return FALSE; - } else if(strcmp(user, CRM_DAEMON_USER) == 0) { - return TRUE; - } else if(strcmp(user, "root") == 0) { - return TRUE; + return FALSE; + } else if (strcmp(user, CRM_DAEMON_USER) == 0) { + return TRUE; + } else if (strcmp(user, "root") == 0) { + return TRUE; } return FALSE; } -extern void determine_request_user(char **user, IPC_Channel *channel, xmlNode *request, const char *field); -#endif +extern void determine_request_user(char **user, IPC_Channel * channel, xmlNode * request, + const char *field); +# endif extern void *find_library_function(void **handle, const char *lib, const char *fn); extern void *convert_const_pointer(const void *ptr); #endif - diff --git a/include/crm/common/xml.h b/include/crm/common/xml.h index d7de80a240..b9bf931ac8 100644 --- a/include/crm/common/xml.h +++ b/include/crm/common/xml.h @@ -1,346 +1,336 @@ /* * 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 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef CRM_COMMON_XML__H -#define CRM_COMMON_XML__H +# define CRM_COMMON_XML__H -#include -#include -#include +# include +# include +# include -#include -#include -#include +# include +# include +# include -#include -#include +# include +# include -#include -#include +# include +# include typedef xmlNode crm_data_t; /* Encryption costs a LOT, don't do it unless we're hitting message limits * * For now, use 256k as the lower size, which means we can have 4 big data fields * before we hit heartbeat's message limit * * The previous limit was 10k, compressing 184 of 1071 messages accounted for 23% * of the total CPU used by the cib */ -#define CRM_BZ2_BLOCKS 4 -#define CRM_BZ2_WORK 20 -#define CRM_BZ2_THRESHOLD 128 * 1024 - -#define XML_PARANOIA_CHECKS 0 - -extern gboolean add_message_xml( - xmlNode *msg, const char *field, xmlNode *xml); -extern xmlNode *get_message_xml(xmlNode *msg, const char *field); -extern GHashTable *xml2list(xmlNode *parent); -#if CRM_DEPRECATED_SINCE_2_0_3 -extern GHashTable *xml2list_202(xmlNode *parent); -#endif +# define CRM_BZ2_BLOCKS 4 +# define CRM_BZ2_WORK 20 +# define CRM_BZ2_THRESHOLD 128 * 1024 + +# define XML_PARANOIA_CHECKS 0 + +extern gboolean add_message_xml(xmlNode * msg, const char *field, xmlNode * xml); +extern xmlNode *get_message_xml(xmlNode * msg, const char *field); +extern GHashTable *xml2list(xmlNode * parent); + +# if CRM_DEPRECATED_SINCE_2_0_3 +extern GHashTable *xml2list_202(xmlNode * parent); +# endif extern void hash2nvpair(gpointer key, gpointer value, gpointer user_data); extern void hash2field(gpointer key, gpointer value, gpointer user_data); extern void hash2metafield(gpointer key, gpointer value, gpointer user_data); extern void hash2smartfield(gpointer key, gpointer value, gpointer user_data); /* * Replacement function for xmlCopyPropList which at the very least, * doesnt work the way *I* would expect it to. * * Copy all the attributes/properties from src into target. * * Not recursive, does not return anything. * */ -extern void copy_in_properties(xmlNode *target, xmlNode *src); -extern void expand_plus_plus(xmlNode* target, const char *name, const char *value); -extern void fix_plus_plus_recursive(xmlNode* target); +extern void copy_in_properties(xmlNode * target, xmlNode * src); +extern void expand_plus_plus(xmlNode * target, const char *name, const char *value); +extern void fix_plus_plus_recursive(xmlNode * target); -void free_xml_from_parent(xmlNode *parent, xmlNode *a_node); -#define zap_xml_from_parent(parent, xml_obj) free_xml_from_parent(parent, xml_obj); xml_obj = NULL +void free_xml_from_parent(xmlNode * parent, xmlNode * a_node); +# define zap_xml_from_parent(parent, xml_obj) free_xml_from_parent(parent, xml_obj); xml_obj = NULL /* * Create a node named "name" as a child of "parent" * If parent is NULL, creates an unconnected node. * * Returns the created node * */ -extern xmlNode *create_xml_node(xmlNode *parent, const char *name); +extern xmlNode *create_xml_node(xmlNode * parent, const char *name); /* * Make a copy of name and value and use the copied memory to create * an attribute for node. * * If node, name or value are NULL, nothing is done. * * If name or value are an empty string, nothing is done. * * Returns FALSE on failure and TRUE on success. * */ -extern const char *crm_xml_add( - xmlNode *node, const char *name, const char *value); +extern const char *crm_xml_add(xmlNode * node, const char *name, const char *value); -extern const char *crm_xml_replace( - xmlNode *node, const char *name, const char *value); +extern const char *crm_xml_replace(xmlNode * node, const char *name, const char *value); -extern const char *crm_xml_add_int( - xmlNode* node, const char *name, int value); +extern const char *crm_xml_add_int(xmlNode * node, const char *name, int value); /* * Unlink the node and set its doc pointer to NULL so free_xml() * will act appropriately */ -extern void unlink_xml_node(xmlNode *node); +extern void unlink_xml_node(xmlNode * node); /* * */ -extern void purge_diff_markers(xmlNode *a_node); +extern void purge_diff_markers(xmlNode * a_node); /* * Returns a deep copy of src_node * */ -extern xmlNode *copy_xml(xmlNode *src_node); +extern xmlNode *copy_xml(xmlNode * src_node); /* * Add a copy of xml_node to new_parent */ -extern xmlNode *add_node_copy( - xmlNode *new_parent, xmlNode *xml_node); - -extern int add_node_nocopy(xmlNode *parent, const char *name, xmlNode *child); +extern xmlNode *add_node_copy(xmlNode * new_parent, xmlNode * xml_node); +extern int add_node_nocopy(xmlNode * parent, const char *name, xmlNode * child); /* * XML I/O Functions * * Whitespace between tags is discarded. */ extern xmlNode *filename2xml(const char *filename); extern xmlNode *stdin2xml(void); extern xmlNode *string2xml(const char *input); -extern int write_xml_file( - xmlNode *xml_node, const char *filename, gboolean compress); +extern int write_xml_file(xmlNode * xml_node, const char *filename, gboolean compress); -extern char *dump_xml_formatted(xmlNode *msg); +extern char *dump_xml_formatted(xmlNode * msg); -extern char *dump_xml_unformatted(xmlNode *msg); +extern char *dump_xml_unformatted(xmlNode * msg); /* * Diff related Functions - */ -extern xmlNode *diff_xml_object( - xmlNode *left, xmlNode *right, gboolean suppress); - -extern xmlNode *subtract_xml_object( - xmlNode *parent, xmlNode *left, xmlNode *right, gboolean full, const char *marker); + */ +extern xmlNode *diff_xml_object(xmlNode * left, xmlNode * right, gboolean suppress); -extern gboolean can_prune_leaf(xmlNode *xml_node); +extern xmlNode *subtract_xml_object(xmlNode * parent, xmlNode * left, xmlNode * right, + gboolean full, const char *marker); -extern void print_xml_diff(FILE *where, xmlNode *diff); -extern void log_xml_diff(unsigned int log_level, xmlNode *diff, const char *function); +extern gboolean can_prune_leaf(xmlNode * xml_node); -extern gboolean apply_xml_diff( - xmlNode *old, xmlNode *diff, xmlNode **new); +extern void print_xml_diff(FILE * where, xmlNode * diff); +extern void log_xml_diff(unsigned int log_level, xmlNode * diff, const char *function); +extern gboolean apply_xml_diff(xmlNode * old, xmlNode * diff, xmlNode ** new); /* * Searching & Modifying */ -extern xmlNode *find_xml_node( - xmlNode *cib, const char * node_path, gboolean must_find); +extern xmlNode *find_xml_node(xmlNode * cib, const char *node_path, gboolean must_find); -extern xmlNode *find_entity( - xmlNode *parent, const char *node_name, const char *id); +extern xmlNode *find_entity(xmlNode * parent, const char *node_name, const char *id); -extern void xml_remove_prop(xmlNode *obj, const char *name); +extern void xml_remove_prop(xmlNode * obj, const char *name); -extern gboolean replace_xml_child( - xmlNode *parent, xmlNode *child, xmlNode *update, gboolean delete_only); +extern gboolean replace_xml_child(xmlNode * parent, xmlNode * child, xmlNode * update, + gboolean delete_only); -extern gboolean update_xml_child(xmlNode *child, xmlNode *to_update); +extern gboolean update_xml_child(xmlNode * child, xmlNode * to_update); -extern int find_xml_children( - xmlNode **children, xmlNode *root, - const char *tag, const char *field, const char *value, - gboolean search_matches); +extern int find_xml_children(xmlNode ** children, xmlNode * root, + const char *tag, const char *field, const char *value, + gboolean search_matches); -extern int crm_element_value_int(xmlNode *data, const char *name, int *dest); -extern char *crm_element_value_copy(xmlNode *data, const char *name); -extern const char *crm_element_value_const(const xmlNode *data, const char *name); -extern xmlNode *get_xpath_object(const char *xpath, xmlNode *xml_obj, int error_level); -extern xmlNode *get_xpath_object_relative(const char *xpath, xmlNode *xml_obj, int error_level); +extern int crm_element_value_int(xmlNode * data, const char *name, int *dest); +extern char *crm_element_value_copy(xmlNode * data, const char *name); +extern const char *crm_element_value_const(const xmlNode * data, const char *name); +extern xmlNode *get_xpath_object(const char *xpath, xmlNode * xml_obj, int error_level); +extern xmlNode *get_xpath_object_relative(const char *xpath, xmlNode * xml_obj, int error_level); -#define crm_element_name(xml) (xml)?(const char *)(xml)->name:NULL +# define crm_element_name(xml) (xml)?(const char *)(xml)->name:NULL -extern const char *crm_element_value(xmlNode *data, const char *name); +extern const char *crm_element_value(xmlNode * data, const char *name); -extern void xml_validate(const xmlNode *root); +extern void xml_validate(const xmlNode * root); -extern gboolean xml_has_children(const xmlNode *root); +extern gboolean xml_has_children(const xmlNode * root); /* For ABI compatability with version < 1.1.4 */ -extern char *calculate_xml_digest(xmlNode *local_cib, gboolean sort, gboolean do_filter); +extern char *calculate_xml_digest(xmlNode * local_cib, gboolean sort, gboolean do_filter); -extern char *calculate_on_disk_digest(xmlNode *local_cib); -extern char *calculate_operation_digest(xmlNode *local_cib, const char *version); -extern char *calculate_xml_versioned_digest(xmlNode *input, gboolean sort, gboolean do_filter, const char *version); +extern char *calculate_on_disk_digest(xmlNode * local_cib); +extern char *calculate_operation_digest(xmlNode * local_cib, const char *version); +extern char *calculate_xml_versioned_digest(xmlNode * input, gboolean sort, gboolean do_filter, + const char *version); -extern gboolean validate_xml(xmlNode *xml_blob, const char *validation, gboolean to_logs); -extern gboolean validate_xml_verbose(xmlNode *xml_blob); -extern int update_validation(xmlNode **xml_blob, int *best, gboolean transform, gboolean to_logs); +extern gboolean validate_xml(xmlNode * xml_blob, const char *validation, gboolean to_logs); +extern gboolean validate_xml_verbose(xmlNode * xml_blob); +extern int update_validation(xmlNode ** xml_blob, int *best, gboolean transform, gboolean to_logs); extern int get_schema_version(const char *name); extern const char *get_schema_name(int version); extern void crm_xml_cleanup(void); -#if XML_PARANOIA_CHECKS -# define crm_validate_data(obj) xml_validate(obj) -#else -# define crm_validate_data(obj) CRM_LOG_ASSERT(obj != NULL) -#endif +# if XML_PARANOIA_CHECKS +# define crm_validate_data(obj) xml_validate(obj) +# else +# define crm_validate_data(obj) CRM_LOG_ASSERT(obj != NULL) +# endif -static inline xmlNode *__xml_first_child(xmlNode *parent) +static inline xmlNode * +__xml_first_child(xmlNode * parent) { xmlNode *child = NULL; - if(parent) { - child = parent->children; - while(child && child->type != XML_ELEMENT_NODE) { - child = child->next; - } + + if (parent) { + child = parent->children; + while (child && child->type != XML_ELEMENT_NODE) { + child = child->next; + } } return child; } -static inline xmlNode *__xml_next(xmlNode *child) +static inline xmlNode * +__xml_next(xmlNode * child) { - if(child) { - child = child->next; - while(child && child->type != XML_ELEMENT_NODE) { - child = child->next; - } + if (child) { + child = child->next; + while (child && child->type != XML_ELEMENT_NODE) { + child = child->next; + } } return child; } - /* These two child iterator macros are no longer to be used * They exist for compatability reasons and will be removed in a * future release */ # define xml_child_iter(parent, child, code) do { \ if(parent != NULL) { \ xmlNode *child = NULL; \ xmlNode *__crm_xml_iter = parent->children; \ while(__crm_xml_iter != NULL) { \ child = __crm_xml_iter; \ __crm_xml_iter = __crm_xml_iter->next; \ if(child->type == XML_ELEMENT_NODE) { \ code; \ } \ } \ } \ } while(0) # define xml_child_iter_filter(parent, child, filter, code) do { \ if(parent != NULL) { \ xmlNode *child = NULL; \ xmlNode *__crm_xml_iter = parent->children; \ while(__crm_xml_iter != NULL) { \ child = __crm_xml_iter; \ __crm_xml_iter = __crm_xml_iter->next; \ if(child->type == XML_ELEMENT_NODE) { \ if(filter == NULL \ || crm_str_eq(filter, (const char *)child->name, TRUE)) { \ code; \ } \ } \ } \ } \ } while(0) # define xml_prop_iter(parent, prop_name, prop_value, code) do { \ if(parent != NULL) { \ xmlAttrPtr prop_iter = parent->properties; \ const char *prop_name = NULL; \ const char *prop_value = NULL; \ while(prop_iter != NULL) { \ prop_name = (const char *)prop_iter->name; \ prop_value = crm_element_value(parent, prop_name); \ prop_iter = prop_iter->next; \ if(prop_name) { \ code; \ } \ } \ } \ } while(0) # define xml_prop_name_iter(parent, prop_name, code) do { \ if(parent != NULL) { \ xmlAttrPtr prop_iter = parent->properties; \ const char *prop_name = NULL; \ while(prop_iter != NULL) { \ prop_name = (const char *)prop_iter->name; \ prop_iter = prop_iter->next; \ if(prop_name) { \ code; \ } \ } \ } \ } while(0) # define free_xml(a_node) do { \ if((a_node) != NULL) { \ xmlNode *a_doc_top = NULL; \ xmlDoc *a_doc = (a_node)->doc; \ if (a_doc != NULL) { \ a_doc_top = xmlDocGetRootElement(a_doc); \ } \ if(a_doc != NULL && a_doc_top == (a_node)) { \ xmlFreeDoc(a_doc); \ \ } else { \ /* make sure the node is unlinked first */ \ xmlUnlinkNode(a_node); \ xmlFreeNode(a_node); \ } \ } \ } while(0) +extern xmlNode *first_named_child(xmlNode * parent, const char *name); -extern xmlNode *first_named_child(xmlNode *parent, const char *name); - -extern xmlNode *convert_ipc_message(IPC_Message *msg, const char *field); -extern xmlNode *convert_ha_message(xmlNode *parent, HA_Message *msg, const char *field); +extern xmlNode *convert_ipc_message(IPC_Message * msg, const char *field); +extern xmlNode *convert_ha_message(xmlNode * parent, HA_Message * msg, const char *field); -extern HA_Message *convert_xml_message(xmlNode *msg); -extern xmlNode *sorted_xml(xmlNode *input, xmlNode *parent, gboolean recursive); -extern xmlXPathObjectPtr xpath_search(xmlNode *xml_top, const char *path); -extern gboolean cli_config_update(xmlNode **xml, int *best_version, gboolean to_logs); -extern xmlNode *expand_idref(xmlNode *input, xmlNode *top); +extern HA_Message *convert_xml_message(xmlNode * msg); +extern xmlNode *sorted_xml(xmlNode * input, xmlNode * parent, gboolean recursive); +extern xmlXPathObjectPtr xpath_search(xmlNode * xml_top, const char *path); +extern gboolean cli_config_update(xmlNode ** xml, int *best_version, gboolean to_logs); +extern xmlNode *expand_idref(xmlNode * input, xmlNode * top); extern xmlNode *getXpathResult(xmlXPathObjectPtr xpathObj, int index); #endif diff --git a/include/crm/crm.h b/include/crm/crm.h index aa9fc54fc6..db46d7ed47 100644 --- a/include/crm/crm.h +++ b/include/crm/crm.h @@ -1,478 +1,480 @@ /* * 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 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef CRM__H -#define CRM__H +# define CRM__H -#include -#include -#include -#include +# include +# include +# include +# include -#undef MIN -#undef MAX -#include +# undef MIN +# undef MAX +# include -#include +# include -#include +# include -extern int log_data_element( - int log_level, const char *file, const char *function, int line, - const char *prefix, xmlNode *data, int depth, gboolean formatted); +extern int log_data_element(int log_level, const char *file, const char *function, int line, + const char *prefix, xmlNode * data, int depth, gboolean formatted); -#define CRM_FEATURE_SET "3.0.5" -#define MINIMUM_SCHEMA_VERSION "pacemaker-1.0" -#define LATEST_SCHEMA_VERSION "pacemaker-"CRM_DTD_VERSION +# define CRM_FEATURE_SET "3.0.5" +# define MINIMUM_SCHEMA_VERSION "pacemaker-1.0" +# define LATEST_SCHEMA_VERSION "pacemaker-"CRM_DTD_VERSION -#define EOS '\0' -#define DIMOF(a) ((int) (sizeof(a)/sizeof(a[0])) ) +# define EOS '\0' +# define DIMOF(a) ((int) (sizeof(a)/sizeof(a[0])) ) -#ifndef __GNUC__ +# ifndef __GNUC__ # define __builtin_expect(expr, result) (expr) -#endif +# endif /* Some handy macros used by the Linux kernel */ -#define __likely(expr) __builtin_expect(expr, 1) -#define __unlikely(expr) __builtin_expect(expr, 0) - -#define CRM_DEPRECATED_SINCE_2_0_1 0 -#define CRM_DEPRECATED_SINCE_2_0_2 0 -#define CRM_DEPRECATED_SINCE_2_0_3 0 -#define CRM_DEPRECATED_SINCE_2_0_4 0 -#define CRM_DEPRECATED_SINCE_2_0_5 0 -#define CRM_DEPRECATED_SINCE_2_0_6 1 -#define CRM_DEPRECATED_SINCE_2_0_7 1 -#define CRM_DEPRECATED_SINCE_2_0_8 1 -#define CRM_DEPRECATED_SINCE_2_1_0 1 - -#define CRM_META "CRM_meta" - -#define CRM_ASSERT(expr) do { \ +# define __likely(expr) __builtin_expect(expr, 1) +# define __unlikely(expr) __builtin_expect(expr, 0) + +# define CRM_DEPRECATED_SINCE_2_0_1 0 +# define CRM_DEPRECATED_SINCE_2_0_2 0 +# define CRM_DEPRECATED_SINCE_2_0_3 0 +# define CRM_DEPRECATED_SINCE_2_0_4 0 +# define CRM_DEPRECATED_SINCE_2_0_5 0 +# define CRM_DEPRECATED_SINCE_2_0_6 1 +# define CRM_DEPRECATED_SINCE_2_0_7 1 +# define CRM_DEPRECATED_SINCE_2_0_8 1 +# define CRM_DEPRECATED_SINCE_2_1_0 1 + +# define CRM_META "CRM_meta" + +# define CRM_ASSERT(expr) do { \ if(__unlikely((expr) == FALSE)) { \ crm_abort(__FILE__, __PRETTY_FUNCTION__, __LINE__, #expr, TRUE, FALSE); \ } \ } while(0) extern const char *crm_system_name; /* Clean these up at some point, some probably should be runtime options */ -#define SOCKET_LEN 1024 -#define APPNAME_LEN 256 -#define MAX_IPC_FAIL 5 -#define MAX_IPC_DELAY 120 - -#define MSG_LOG 1 -#define DOT_FSA_ACTIONS 1 -#define DOT_ALL_FSA_INPUTS 1 +# define SOCKET_LEN 1024 +# define APPNAME_LEN 256 +# define MAX_IPC_FAIL 5 +# define MAX_IPC_DELAY 120 + +# define MSG_LOG 1 +# define DOT_FSA_ACTIONS 1 +# define DOT_ALL_FSA_INPUTS 1 /* #define FSA_TRACE 1 */ -#define INFINITY_S "INFINITY" -#define MINUS_INFINITY_S "-INFINITY" +# define INFINITY_S "INFINITY" +# define MINUS_INFINITY_S "-INFINITY" -#define INFINITY 1000000 +# define INFINITY 1000000 /* 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" -#define CRM_SYSTEM_STONITHD "stonithd" +# 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" +# define CRM_SYSTEM_STONITHD "stonithd" /* Valid operations */ -#define CRM_OP_NOOP "noop" - -#define CRM_OP_JOIN_ANNOUNCE "join_announce" -#define CRM_OP_JOIN_OFFER "join_offer" -#define CRM_OP_JOIN_REQUEST "join_request" -#define CRM_OP_JOIN_ACKNAK "join_ack_nack" -#define CRM_OP_JOIN_CONFIRM "join_confirm" - -#define CRM_OP_DIE "die_no_respawn" -#define CRM_OP_RETRIVE_CIB "retrieve_cib" -#define CRM_OP_PING "ping" -#define CRM_OP_VOTE "vote" -#define CRM_OP_NOVOTE "no-vote" -#define CRM_OP_HELLO "hello" -#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_LOCAL_SHUTDOWN "start_shutdown" -#define CRM_OP_SHUTDOWN_REQ "req_shutdown" -#define CRM_OP_SHUTDOWN "do_shutdown" -#define CRM_OP_FENCE "stonith" -#define CRM_OP_EVENTCC "event_cc" -#define CRM_OP_TEABORT "te_abort" -#define CRM_OP_TEABORTED "te_abort_confirmed" /* we asked */ -#define CRM_OP_TE_HALT "te_halt" -#define CRM_OP_TECOMPLETE "te_complete" -#define CRM_OP_TETIMEOUT "te_timeout" -#define CRM_OP_TRANSITION "transition" -#define CRM_OP_REGISTER "register" -#define CRM_OP_DEBUG_UP "debug_inc" -#define CRM_OP_DEBUG_DOWN "debug_dec" -#define CRM_OP_INVOKE_LRM "lrm_invoke" -#define CRM_OP_LRM_REFRESH "lrm_refresh" -#define CRM_OP_LRM_QUERY "lrm_query" -#define CRM_OP_LRM_DELETE "lrm_delete" -#define CRM_OP_LRM_FAIL "lrm_fail" -#define CRM_OP_PROBED "probe_complete" -#define CRM_OP_REPROBE "probe_again" -#define CRM_OP_CLEAR_FAILCOUNT "clear_failcount" - -#define CRMD_STATE_ACTIVE "member" -#define CRMD_STATE_INACTIVE "down" - -#define CRMD_JOINSTATE_DOWN CRMD_STATE_INACTIVE -#define CRMD_JOINSTATE_PENDING "pending" -#define CRMD_JOINSTATE_MEMBER CRMD_STATE_ACTIVE -#define CRMD_JOINSTATE_NACK "banned" - -#define CRMD_ACTION_DELETE "delete" -#define CRMD_ACTION_CANCEL "cancel" - -#define CRMD_ACTION_MIGRATE "migrate_to" -#define CRMD_ACTION_MIGRATED "migrate_from" - -#define CRMD_ACTION_START "start" -#define CRMD_ACTION_STARTED "running" - -#define CRMD_ACTION_STOP "stop" -#define CRMD_ACTION_STOPPED "stopped" - -#define CRMD_ACTION_PROMOTE "promote" -#define CRMD_ACTION_PROMOTED "promoted" -#define CRMD_ACTION_DEMOTE "demote" -#define CRMD_ACTION_DEMOTED "demoted" - -#define CRMD_ACTION_NOTIFY "notify" -#define CRMD_ACTION_NOTIFIED "notified" - -#define CRMD_ACTION_STATUS "monitor" +# define CRM_OP_NOOP "noop" + +# define CRM_OP_JOIN_ANNOUNCE "join_announce" +# define CRM_OP_JOIN_OFFER "join_offer" +# define CRM_OP_JOIN_REQUEST "join_request" +# define CRM_OP_JOIN_ACKNAK "join_ack_nack" +# define CRM_OP_JOIN_CONFIRM "join_confirm" + +# define CRM_OP_DIE "die_no_respawn" +# define CRM_OP_RETRIVE_CIB "retrieve_cib" +# define CRM_OP_PING "ping" +# define CRM_OP_VOTE "vote" +# define CRM_OP_NOVOTE "no-vote" +# define CRM_OP_HELLO "hello" +# 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_LOCAL_SHUTDOWN "start_shutdown" +# define CRM_OP_SHUTDOWN_REQ "req_shutdown" +# define CRM_OP_SHUTDOWN "do_shutdown" +# define CRM_OP_FENCE "stonith" +# define CRM_OP_EVENTCC "event_cc" +# define CRM_OP_TEABORT "te_abort" +# define CRM_OP_TEABORTED "te_abort_confirmed" /* we asked */ +# define CRM_OP_TE_HALT "te_halt" +# define CRM_OP_TECOMPLETE "te_complete" +# define CRM_OP_TETIMEOUT "te_timeout" +# define CRM_OP_TRANSITION "transition" +# define CRM_OP_REGISTER "register" +# define CRM_OP_DEBUG_UP "debug_inc" +# define CRM_OP_DEBUG_DOWN "debug_dec" +# define CRM_OP_INVOKE_LRM "lrm_invoke" +# define CRM_OP_LRM_REFRESH "lrm_refresh" +# define CRM_OP_LRM_QUERY "lrm_query" +# define CRM_OP_LRM_DELETE "lrm_delete" +# define CRM_OP_LRM_FAIL "lrm_fail" +# define CRM_OP_PROBED "probe_complete" +# define CRM_OP_REPROBE "probe_again" +# define CRM_OP_CLEAR_FAILCOUNT "clear_failcount" + +# define CRMD_STATE_ACTIVE "member" +# define CRMD_STATE_INACTIVE "down" + +# define CRMD_JOINSTATE_DOWN CRMD_STATE_INACTIVE +# define CRMD_JOINSTATE_PENDING "pending" +# define CRMD_JOINSTATE_MEMBER CRMD_STATE_ACTIVE +# define CRMD_JOINSTATE_NACK "banned" + +# define CRMD_ACTION_DELETE "delete" +# define CRMD_ACTION_CANCEL "cancel" + +# define CRMD_ACTION_MIGRATE "migrate_to" +# define CRMD_ACTION_MIGRATED "migrate_from" + +# define CRMD_ACTION_START "start" +# define CRMD_ACTION_STARTED "running" + +# define CRMD_ACTION_STOP "stop" +# define CRMD_ACTION_STOPPED "stopped" + +# define CRMD_ACTION_PROMOTE "promote" +# define CRMD_ACTION_PROMOTED "promoted" +# define CRMD_ACTION_DEMOTE "demote" +# define CRMD_ACTION_DEMOTED "demoted" + +# define CRMD_ACTION_NOTIFY "notify" +# define CRMD_ACTION_NOTIFIED "notified" + +# define CRMD_ACTION_STATUS "monitor" /* short names */ -#define RSC_DELETE CRMD_ACTION_DELETE -#define RSC_CANCEL CRMD_ACTION_CANCEL +# define RSC_DELETE CRMD_ACTION_DELETE +# define RSC_CANCEL CRMD_ACTION_CANCEL -#define RSC_MIGRATE CRMD_ACTION_MIGRATE -#define RSC_MIGRATED CRMD_ACTION_MIGRATED +# define RSC_MIGRATE CRMD_ACTION_MIGRATE +# define RSC_MIGRATED CRMD_ACTION_MIGRATED -#define RSC_START CRMD_ACTION_START -#define RSC_STARTED CRMD_ACTION_STARTED +# define RSC_START CRMD_ACTION_START +# define RSC_STARTED CRMD_ACTION_STARTED -#define RSC_STOP CRMD_ACTION_STOP -#define RSC_STOPPED CRMD_ACTION_STOPPED +# define RSC_STOP CRMD_ACTION_STOP +# define RSC_STOPPED CRMD_ACTION_STOPPED -#define RSC_PROMOTE CRMD_ACTION_PROMOTE -#define RSC_PROMOTED CRMD_ACTION_PROMOTED -#define RSC_DEMOTE CRMD_ACTION_DEMOTE -#define RSC_DEMOTED CRMD_ACTION_DEMOTED +# define RSC_PROMOTE CRMD_ACTION_PROMOTE +# define RSC_PROMOTED CRMD_ACTION_PROMOTED +# define RSC_DEMOTE CRMD_ACTION_DEMOTE +# define RSC_DEMOTED CRMD_ACTION_DEMOTED -#define RSC_NOTIFY CRMD_ACTION_NOTIFY -#define RSC_NOTIFIED CRMD_ACTION_NOTIFIED +# define RSC_NOTIFY CRMD_ACTION_NOTIFY +# define RSC_NOTIFIED CRMD_ACTION_NOTIFIED -#define RSC_STATUS CRMD_ACTION_STATUS +# define RSC_STATUS CRMD_ACTION_STATUS -typedef GList* GListPtr; +typedef GList *GListPtr; /* LOG_DEBUG = 7, make LOG_TRACE ::= -VVVVV */ -#define LOG_TRACE 12 -#define LOG_DEBUG_2 LOG_TRACE -#define LOG_DEBUG_3 LOG_TRACE -#define LOG_DEBUG_4 LOG_TRACE -#define LOG_DEBUG_5 LOG_TRACE -#define LOG_DEBUG_6 LOG_TRACE +# define LOG_TRACE 12 +# define LOG_DEBUG_2 LOG_TRACE +# define LOG_DEBUG_3 LOG_TRACE +# define LOG_DEBUG_4 LOG_TRACE +# define LOG_DEBUG_5 LOG_TRACE +# define LOG_DEBUG_6 LOG_TRACE -#define LOG_MSG LOG_TRACE +# define LOG_MSG LOG_TRACE -#if SUPPORT_TRACING +# if SUPPORT_TRACING struct _pcmk_ddebug_query { - const char *files; - const char *formats; - const char *functions; - unsigned long long total; - unsigned long long matches; + const char *files; + const char *formats; + const char *functions; + unsigned long long total; + unsigned long long matches; }; /* * An instance of this structure is created in a special * ELF section at every dynamic debug callsite. At runtime, * the special section is treated as an array of these. */ struct _pcmk_ddebug { - /* - * These fields are used to drive the user interface - * for selecting and displaying debug callsites. - */ - const char *function; - const char *filename; - const char *format; - unsigned int lineno:24; - /* - * The bump field will add to the level at the callsite. - * The value here are changed dynamically when the user - * writes commands to FIXME ;-) - */ - int bump; -} __attribute__((aligned(8))); + /* + * These fields are used to drive the user interface + * for selecting and displaying debug callsites. + */ + const char *function; + const char *filename; + const char *format; + unsigned int lineno:24; + /* + * The bump field will add to the level at the callsite. + * The value here are changed dynamically when the user + * writes commands to FIXME ;-) + */ + int bump; +} __attribute__ ((aligned(8))); /* will be assigned by ld linker magic */ extern struct _pcmk_ddebug __start___verbose[]; extern struct _pcmk_ddebug __stop___verbose[]; -# define CRM_TRACE_INIT_DATA(name) \ +# define CRM_TRACE_INIT_DATA(name) \ void name(void); \ void name(void) { CRM_ASSERT(__start___verbose != __stop___verbose); } \ void __attribute__ ((constructor)) name(void); -#define CRM_LOG_ASSERT(expr) do { \ +# define CRM_LOG_ASSERT(expr) do { \ static struct _pcmk_ddebug descriptor \ __attribute__((section("__verbose"), aligned(8))) = \ { __func__, __FILE__, #expr, __LINE__, LOG_TRACE}; \ \ if(__unlikely((expr) == FALSE)) { \ crm_abort(__FILE__, __PRETTY_FUNCTION__, __LINE__, #expr, \ descriptor.bump != LOG_TRACE, TRUE); \ } \ } while(0) -#define CRM_CHECK(expr, failure_action) do { \ +# define CRM_CHECK(expr, failure_action) do { \ static struct _pcmk_ddebug descriptor \ __attribute__((section("__verbose"), aligned(8))) = \ { __func__, __FILE__, #expr, __LINE__, LOG_TRACE}; \ \ if(__unlikely((expr) == FALSE)) { \ crm_abort(__FILE__, __PRETTY_FUNCTION__, __LINE__, #expr, \ descriptor.bump != LOG_TRACE, TRUE); \ failure_action; \ } \ } while(0) /* * Throughout the macros below, note the leading, pre-comma, space in the * various ' , ##args' occurences to aid portability across versions of 'gcc'. * http://gcc.gnu.org/onlinedocs/cpp/Variadic-Macros.html#Variadic-Macros */ -# define do_crm_log(level, fmt, args...) do { \ +# define do_crm_log(level, fmt, args...) do { \ static struct _pcmk_ddebug descriptor \ __attribute__((section("__verbose"), aligned(8))) = \ { __func__, __FILE__, fmt, __LINE__, LOG_TRACE}; \ \ if(__likely((level) <= crm_log_level)) { \ cl_log((level), "%s: " fmt, __PRETTY_FUNCTION__ , ##args); \ \ } else if(__unlikely(descriptor.bump != LOG_TRACE)) { \ cl_log(descriptor.bump, "TRACE: %s: %s:%d " fmt, __PRETTY_FUNCTION__ , __FILE__, __LINE__, ##args); \ } \ } while(0) -# define do_crm_log_unlikely(level, fmt, args...) do { \ +# define do_crm_log_unlikely(level, fmt, args...) do { \ static struct _pcmk_ddebug descriptor \ __attribute__((section("__verbose"), aligned(8))) = \ { __func__, __FILE__, fmt, __LINE__, LOG_TRACE }; \ \ if(__unlikely((level) <= crm_log_level)) { \ cl_log((level), "%s: " fmt, __PRETTY_FUNCTION__ , ##args); \ \ } else if(__unlikely(descriptor.bump != LOG_TRACE)) { \ cl_log(descriptor.bump, "TRACE: %s: %s:%d " fmt, __PRETTY_FUNCTION__ , __FILE__, __LINE__, ##args); \ } \ } while(0) -# define do_crm_log_xml(level, text, xml) do { \ +# define do_crm_log_xml(level, text, xml) do { \ static struct _pcmk_ddebug descriptor \ __attribute__((section("__verbose"), aligned(8))) = \ { __func__, __FILE__, __PRETTY_FUNCTION__, __LINE__, LOG_TRACE }; \ \ if(xml == NULL) { \ } else if(__likely((level) <= crm_log_level)) { \ log_data_element(level, __FILE__, __PRETTY_FUNCTION__, 0, text, xml, 0, TRUE); \ \ } else if(__unlikely(descriptor.bump != LOG_TRACE)) { \ log_data_element(descriptor.bump, __FILE__, __PRETTY_FUNCTION__, __LINE__, text, xml, 0, TRUE); \ } \ } while(0) -# define do_crm_log_alias(level, file, function, line, fmt, args...) do { \ +# define do_crm_log_alias(level, file, function, line, fmt, args...) do { \ if(line) { \ cl_log(level, "TRACE: %s: %s:%d "fmt, function, file, line, ##args); \ } else { \ cl_log(level, "%s: "fmt, function, ##args); \ } \ } while(0) -#else +# else -# define CRM_TRACE_INIT_DATA(name) +# define CRM_TRACE_INIT_DATA(name) -#define CRM_LOG_ASSERT(expr) do { \ +# define CRM_LOG_ASSERT(expr) do { \ if(__unlikely((expr) == FALSE)) { \ crm_abort(__FILE__, __PRETTY_FUNCTION__, __LINE__, #expr, FALSE, TRUE); \ } \ } while(0) -#define CRM_CHECK(expr, failure_action) do { \ +# define CRM_CHECK(expr, failure_action) do { \ if(__unlikely((expr) == FALSE)) { \ crm_abort(__FILE__,__PRETTY_FUNCTION__,__LINE__, #expr, FALSE, TRUE); \ failure_action; \ } \ } while(0) -# define do_crm_log(level, fmt, args...) do { \ +# define do_crm_log(level, fmt, args...) do { \ if(__likely((level) <= crm_log_level)) { \ cl_log((level), "%s: " fmt, __PRETTY_FUNCTION__ , ##args); \ } \ } while(0) -# define do_crm_log_unlikely(level, fmt, args...) do { \ +# define do_crm_log_unlikely(level, fmt, args...) do { \ if(__unlikely((level) <= crm_log_level)) { \ cl_log((level), "%s: " fmt, __PRETTY_FUNCTION__ , ##args); \ } \ } while(0) -# define do_crm_log_xml(level, text, xml) do { \ +# define do_crm_log_xml(level, text, xml) do { \ if(xml == NULL) { \ } else if(__unlikely((level) <= crm_log_level)) { \ log_data_element(level, __FILE__, __PRETTY_FUNCTION__, 0, text, xml, 0, TRUE); \ } \ } while(0) -# define do_crm_log_alias(level, file, function, line, fmt, args...) do { \ +# define do_crm_log_alias(level, file, function, line, fmt, args...) do { \ cl_log(level, "%s: "fmt, function, ##args); \ } while(0) -#endif +# endif + +# define do_crm_log_always(level, fmt, args...) cl_log(level, "%s: " fmt, __PRETTY_FUNCTION__ , ##args) -#define do_crm_log_always(level, fmt, args...) cl_log(level, "%s: " fmt, __PRETTY_FUNCTION__ , ##args) - -#define crm_crit(fmt, args...) do_crm_log_always(LOG_CRIT, fmt , ##args) -#define crm_err(fmt, args...) do_crm_log(LOG_ERR, fmt , ##args) -#define crm_warn(fmt, args...) do_crm_log(LOG_WARNING, fmt , ##args) -#define crm_notice(fmt, args...) do_crm_log(LOG_NOTICE, fmt , ##args) -#define crm_info(fmt, args...) do_crm_log(LOG_INFO, fmt , ##args) -#define crm_debug(fmt, args...) do_crm_log_unlikely(LOG_DEBUG, fmt , ##args) -#define crm_trace(fmt, args...) do_crm_log_unlikely(LOG_TRACE, fmt , ##args) -#define crm_debug_2 crm_trace -#define crm_debug_3 crm_trace -#define crm_debug_4 crm_trace -#define crm_debug_5 crm_trace -#define crm_debug_6 crm_trace - -#define crm_perror(level, fmt, args...) do { \ +# define crm_crit(fmt, args...) do_crm_log_always(LOG_CRIT, fmt , ##args) +# define crm_err(fmt, args...) do_crm_log(LOG_ERR, fmt , ##args) +# define crm_warn(fmt, args...) do_crm_log(LOG_WARNING, fmt , ##args) +# define crm_notice(fmt, args...) do_crm_log(LOG_NOTICE, fmt , ##args) +# define crm_info(fmt, args...) do_crm_log(LOG_INFO, fmt , ##args) +# define crm_debug(fmt, args...) do_crm_log_unlikely(LOG_DEBUG, fmt , ##args) +# define crm_trace(fmt, args...) do_crm_log_unlikely(LOG_TRACE, fmt , ##args) +# define crm_debug_2 crm_trace +# define crm_debug_3 crm_trace +# define crm_debug_4 crm_trace +# define crm_debug_5 crm_trace +# define crm_debug_6 crm_trace + +# define crm_perror(level, fmt, args...) do { \ const char *err = strerror(errno); \ fprintf(stderr, fmt ": %s (%d)\n", ##args, err, errno); \ do_crm_log(level, fmt ": %s (%d)", ##args, err, errno); \ } while(0) -#include +# include -#define crm_log_xml_crit(xml, text) do_crm_log_xml(LOG_CRIT, text, xml) -#define crm_log_xml_err(xml, text) do_crm_log_xml(LOG_ERR, text, xml) -#define crm_log_xml_warn(xml, text) do_crm_log_xml(LOG_WARNING, text, xml) -#define crm_log_xml_notice(xml, text) do_crm_log_xml(LOG_NOTICE, text, xml) -#define crm_log_xml_info(xml, text) do_crm_log_xml(LOG_INFO, text, xml) -#define crm_log_xml_debug(xml, text) do_crm_log_xml(LOG_DEBUG, text, xml) -#define crm_log_xml_trace(xml, text) do_crm_log_xml(LOG_TRACE, text, xml) +# define crm_log_xml_crit(xml, text) do_crm_log_xml(LOG_CRIT, text, xml) +# define crm_log_xml_err(xml, text) do_crm_log_xml(LOG_ERR, text, xml) +# define crm_log_xml_warn(xml, text) do_crm_log_xml(LOG_WARNING, text, xml) +# define crm_log_xml_notice(xml, text) do_crm_log_xml(LOG_NOTICE, text, xml) +# define crm_log_xml_info(xml, text) do_crm_log_xml(LOG_INFO, text, xml) +# define crm_log_xml_debug(xml, text) do_crm_log_xml(LOG_DEBUG, text, xml) +# define crm_log_xml_trace(xml, text) do_crm_log_xml(LOG_TRACE, text, xml) -#define crm_log_xml do_crm_log_xml -#define crm_log_xml_debug_2 crm_log_xml_trace -#define crm_log_xml_debug_3 crm_log_xml_trace -#define crm_log_xml_debug_4 crm_log_xml_trace -#define crm_log_xml_debug_5 crm_log_xml_trace +# define crm_log_xml do_crm_log_xml +# define crm_log_xml_debug_2 crm_log_xml_trace +# define crm_log_xml_debug_3 crm_log_xml_trace +# define crm_log_xml_debug_4 crm_log_xml_trace +# define crm_log_xml_debug_5 crm_log_xml_trace -#define crm_str(x) (const char*)(x?x:"") +# define crm_str(x) (const char*)(x?x:"") -#define crm_malloc0(malloc_obj, length) do { \ +# define crm_malloc0(malloc_obj, length) do { \ malloc_obj = malloc(length); \ if(malloc_obj == NULL) { \ crm_err("Failed allocation of %lu bytes", (unsigned long)length); \ CRM_ASSERT(malloc_obj != NULL); \ } \ memset(malloc_obj, 0, length); \ } while(0) -#define crm_malloc(malloc_obj, length) do { \ +# define crm_malloc(malloc_obj, length) do { \ malloc_obj = malloc(length); \ if(malloc_obj == NULL) { \ crm_err("Failed allocation of %lu bytes", (unsigned long)length); \ CRM_ASSERT(malloc_obj != NULL); \ } \ } while(0) -#define crm_realloc(realloc_obj, length) do { \ +# define crm_realloc(realloc_obj, length) do { \ realloc_obj = realloc(realloc_obj, length); \ CRM_ASSERT(realloc_obj != NULL); \ } while(0) - -#define crm_free(free_obj) do { free(free_obj); free_obj=NULL; } while(0) -#define crm_msg_del(msg) do { if(msg != NULL) { ha_msg_del(msg); msg = NULL; } } while(0) -#define crm_strdup(str) crm_strdup_fn(str, __FILE__, __PRETTY_FUNCTION__, __LINE__) +# define crm_free(free_obj) do { free(free_obj); free_obj=NULL; } while(0) +# define crm_msg_del(msg) do { if(msg != NULL) { ha_msg_del(msg); msg = NULL; } } while(0) + +# define crm_strdup(str) crm_strdup_fn(str, __FILE__, __PRETTY_FUNCTION__, __LINE__) -#define crm_str_hash g_str_hash_traditional +# define crm_str_hash g_str_hash_traditional extern guint g_str_hash_traditional(gconstpointer v); extern void update_all_trace_data(void); -static inline void slist_basic_destroy(GListPtr list) +static inline void +slist_basic_destroy(GListPtr list) { GListPtr gIter = NULL; - for(gIter = list; gIter != NULL; gIter = gIter->next) { - free(gIter->data); + + for (gIter = list; gIter != NULL; gIter = gIter->next) { + free(gIter->data); } g_list_free(list); } /* These two macros are no longer to be used * They exist for compatability reasons and will be removed in a * future release * Use something like this instead: GListPtr gIter = rsc->children; for(; gIter != NULL; gIter = gIter->next) { resource_t *child_rsc = (resource_t*)gIter->data; ... } * */ -#define slist_destroy(child_type, child, parent, a) do { \ +# define slist_destroy(child_type, child, parent, a) do { \ GListPtr __crm_iter_head = parent; \ child_type *child = NULL; \ while(__crm_iter_head != NULL) { \ child = (child_type *) __crm_iter_head->data; \ __crm_iter_head = __crm_iter_head->next; \ { a; } \ } \ g_list_free(parent); \ } while(0) -#define slist_iter(child, child_type, parent, counter, a) do { \ +# define slist_iter(child, child_type, parent, counter, a) do { \ GListPtr __crm_iter_head = parent; \ child_type *child = NULL; \ int counter = 0; \ for(; __crm_iter_head != NULL; counter++) { \ child = (child_type *) __crm_iter_head->data; \ __crm_iter_head = __crm_iter_head->next; \ { a; } \ } \ } while(0) #endif diff --git a/include/crm/msg_xml.h b/include/crm/msg_xml.h index 998acf811e..db2bc16f64 100644 --- a/include/crm/msg_xml.h +++ b/include/crm/msg_xml.h @@ -1,311 +1,311 @@ /* * 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 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef XML_TAGS__H -#define XML_TAGS__H - -#define CIB_OPTIONS_FIRST "cib-bootstrap-options" - -#define F_CRM_DATA "crm_xml" -#define F_CRM_TASK "crm_task" -#define F_CRM_HOST_TO "crm_host_to" -#define F_CRM_MSG_TYPE F_SUBTYPE -#define F_CRM_SYS_TO "crm_sys_to" -#define F_CRM_SYS_FROM "crm_sys_from" -#define F_CRM_HOST_FROM F_ORIG -#define F_CRM_REFERENCE XML_ATTR_REFERENCE -#define F_CRM_VERSION XML_ATTR_VERSION -#define F_CRM_ORIGIN "origin" -#define F_CRM_USER "crm_user" -#define F_CRM_JOIN_ID "join_id" -#define F_CRM_ELECTION_ID "election-id" -#define F_CRM_ELECTION_AGE_S "election-age-sec" -#define F_CRM_ELECTION_AGE_US "election-age-nano-sec" -#define F_CRM_ELECTION_OWNER "election-owner" -#define F_CRM_TGRAPH "crm-tgraph" -#define F_CRM_TGRAPH_INPUT "crm-tgraph-in" +# define XML_TAGS__H + +# define CIB_OPTIONS_FIRST "cib-bootstrap-options" + +# define F_CRM_DATA "crm_xml" +# define F_CRM_TASK "crm_task" +# define F_CRM_HOST_TO "crm_host_to" +# define F_CRM_MSG_TYPE F_SUBTYPE +# define F_CRM_SYS_TO "crm_sys_to" +# define F_CRM_SYS_FROM "crm_sys_from" +# define F_CRM_HOST_FROM F_ORIG +# define F_CRM_REFERENCE XML_ATTR_REFERENCE +# define F_CRM_VERSION XML_ATTR_VERSION +# define F_CRM_ORIGIN "origin" +# define F_CRM_USER "crm_user" +# define F_CRM_JOIN_ID "join_id" +# define F_CRM_ELECTION_ID "election-id" +# define F_CRM_ELECTION_AGE_S "election-age-sec" +# define F_CRM_ELECTION_AGE_US "election-age-nano-sec" +# define F_CRM_ELECTION_OWNER "election-owner" +# define F_CRM_TGRAPH "crm-tgraph" +# define F_CRM_TGRAPH_INPUT "crm-tgraph-in" /*---- Common tags/attrs */ -#define XML_DIFF_MARKER "__crm_diff_marker__" -#define XML_ATTR_TAGNAME F_XML_TAGNAME -#define XML_TAG_CIB "cib" -#define XML_TAG_FAILED "failed" - -#define XML_ATTR_CRM_VERSION "crm_feature_set" -#define XML_ATTR_DIGEST "digest" -#define XML_ATTR_VALIDATION "validate-with" - -#define XML_ATTR_QUORUM_PANIC "no-quorum-panic" -#define XML_ATTR_HAVE_QUORUM "have-quorum" -#define XML_ATTR_EXPECTED_VOTES "expected-quorum-votes" -#define XML_ATTR_GENERATION "epoch" -#define XML_ATTR_GENERATION_ADMIN "admin_epoch" -#define XML_ATTR_NUMUPDATES "num_updates" -#define XML_ATTR_TIMEOUT "timeout" -#define XML_ATTR_ORIGIN "crm-debug-origin" -#define XML_ATTR_TSTAMP "crm-timestamp" -#define XML_CIB_ATTR_WRITTEN "cib-last-written" -#define XML_ATTR_VERSION "version" -#define XML_ATTR_DESC "description" -#define XML_ATTR_ID "id" -#define XML_ATTR_IDREF "id-ref" -#define XML_ATTR_ID_LONG "long-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 "op" -#define XML_ATTR_DC "is_dc" -#define XML_ATTR_DC_UUID "dc-uuid" -#define XML_ATTR_UPDATE_ORIG "update-origin" -#define XML_ATTR_UPDATE_CLIENT "update-client" -#define XML_ATTR_UPDATE_USER "update-user" - -#define XML_BOOLEAN_TRUE "true" -#define XML_BOOLEAN_FALSE "false" -#define XML_BOOLEAN_YES XML_BOOLEAN_TRUE -#define XML_BOOLEAN_NO XML_BOOLEAN_FALSE - -#define XML_TAG_OPTIONS "options" +# define XML_DIFF_MARKER "__crm_diff_marker__" +# define XML_ATTR_TAGNAME F_XML_TAGNAME +# define XML_TAG_CIB "cib" +# define XML_TAG_FAILED "failed" + +# define XML_ATTR_CRM_VERSION "crm_feature_set" +# define XML_ATTR_DIGEST "digest" +# define XML_ATTR_VALIDATION "validate-with" + +# define XML_ATTR_QUORUM_PANIC "no-quorum-panic" +# define XML_ATTR_HAVE_QUORUM "have-quorum" +# define XML_ATTR_EXPECTED_VOTES "expected-quorum-votes" +# define XML_ATTR_GENERATION "epoch" +# define XML_ATTR_GENERATION_ADMIN "admin_epoch" +# define XML_ATTR_NUMUPDATES "num_updates" +# define XML_ATTR_TIMEOUT "timeout" +# define XML_ATTR_ORIGIN "crm-debug-origin" +# define XML_ATTR_TSTAMP "crm-timestamp" +# define XML_CIB_ATTR_WRITTEN "cib-last-written" +# define XML_ATTR_VERSION "version" +# define XML_ATTR_DESC "description" +# define XML_ATTR_ID "id" +# define XML_ATTR_IDREF "id-ref" +# define XML_ATTR_ID_LONG "long-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 "op" +# define XML_ATTR_DC "is_dc" +# define XML_ATTR_DC_UUID "dc-uuid" +# define XML_ATTR_UPDATE_ORIG "update-origin" +# define XML_ATTR_UPDATE_CLIENT "update-client" +# define XML_ATTR_UPDATE_USER "update-user" + +# define XML_BOOLEAN_TRUE "true" +# define XML_BOOLEAN_FALSE "false" +# define XML_BOOLEAN_YES XML_BOOLEAN_TRUE +# define XML_BOOLEAN_NO XML_BOOLEAN_FALSE + +# define XML_TAG_OPTIONS "options" /*---- top level tags/attrs */ -#define XML_MSG_TAG "crm_message" -#define XML_MSG_TAG_DATA "msg_data" -#define XML_ATTR_REQUEST "request" -#define XML_ATTR_RESPONSE "response" +# define XML_MSG_TAG "crm_message" +# define XML_MSG_TAG_DATA "msg_data" +# define XML_ATTR_REQUEST "request" +# define XML_ATTR_RESPONSE "response" -#define XML_ATTR_UNAME "uname" -#define XML_ATTR_UUID "id" -#define XML_ATTR_REFERENCE "reference" +# define XML_ATTR_UNAME "uname" +# define XML_ATTR_UUID "id" +# define XML_ATTR_REFERENCE "reference" -#define XML_FAIL_TAG_RESOURCE "failed_resource" +# 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_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 "result" -#define XML_PING_ATTR_SYSFROM "crm_subsystem" +# define XML_CRM_TAG_PING "ping_response" +# define XML_PING_ATTR_STATUS "result" +# define XML_PING_ATTR_SYSFROM "crm_subsystem" -#define XML_TAG_FRAGMENT "cib_fragment" -#define XML_ATTR_RESULT "result" -#define XML_ATTR_SECTION "section" +# define XML_TAG_FRAGMENT "cib_fragment" +# define XML_ATTR_RESULT "result" +# define XML_ATTR_SECTION "section" -#define XML_FAIL_TAG_CIB "failed_update" +# 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" +# 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_SECTION_ALL "all" -#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_DOMAINS "domains" -#define XML_CIB_TAG_CONSTRAINTS "constraints" -#define XML_CIB_TAG_CRMCONFIG "crm_config" -#define XML_CIB_TAG_OPCONFIG "op_defaults" -#define XML_CIB_TAG_RSCCONFIG "rsc_defaults" -#define XML_CIB_TAG_ACLS "acls" - -#define XML_CIB_TAG_STATE "node_state" -#define XML_CIB_TAG_NODE "node" -#define XML_CIB_TAG_DOMAIN "domain" -#define XML_CIB_TAG_CONSTRAINT "constraint" -#define XML_CIB_TAG_NVPAIR "nvpair" - -#define XML_CIB_TAG_PROPSET "cluster_property_set" -#define XML_TAG_ATTR_SETS "instance_attributes" -#define XML_TAG_META_SETS "meta_attributes" -#define XML_TAG_ATTRS "attributes" -#define XML_TAG_PARAMS "parameters" -#define XML_TAG_PARAM "param" -#define XML_TAG_UTILIZATION "utilization" - -#define XML_TAG_RESOURCE_REF "resource_ref" -#define XML_CIB_TAG_RESOURCE "primitive" -#define XML_CIB_TAG_GROUP "group" -#define XML_CIB_TAG_INCARNATION "clone" -#define XML_CIB_TAG_MASTER "master" - -#define XML_CIB_TAG_RSC_TEMPLATE "template" - -#define XML_RSC_ATTR_RESTART "restart-type" -#define XML_RSC_ATTR_ORDERED "ordered" -#define XML_RSC_ATTR_INTERLEAVE "interleave" -#define XML_RSC_ATTR_INCARNATION "clone" -#define XML_RSC_ATTR_INCARNATION_MAX "clone-max" -#define XML_RSC_ATTR_INCARNATION_NODEMAX "clone-node-max" -#define XML_RSC_ATTR_MASTER_MAX "master-max" -#define XML_RSC_ATTR_MASTER_NODEMAX "master-node-max" -#define XML_RSC_ATTR_STATE "clone-state" -#define XML_RSC_ATTR_MANAGED "is-managed" -#define XML_RSC_ATTR_TARGET_ROLE "target-role" -#define XML_RSC_ATTR_UNIQUE "globally-unique" -#define XML_RSC_ATTR_NOTIFY "notify" -#define XML_RSC_ATTR_STICKINESS "resource-stickiness" -#define XML_RSC_ATTR_FAIL_STICKINESS "migration-threshold" -#define XML_RSC_ATTR_FAIL_TIMEOUT "failure-timeout" -#define XML_RSC_ATTR_MULTIPLE "multiple-active" -#define XML_RSC_ATTR_PRIORITY "priority" -#define XML_OP_ATTR_ON_FAIL "on-fail" -#define XML_OP_ATTR_START_DELAY "start-delay" -#define XML_OP_ATTR_ALLOW_MIGRATE "allow-migrate" -#define XML_OP_ATTR_ORIGIN "interval-origin" -#define XML_OP_ATTR_PENDING "record-pending" - -#define XML_CIB_TAG_LRM "lrm" -#define XML_LRM_TAG_RESOURCES "lrm_resources" -#define XML_LRM_TAG_RESOURCE "lrm_resource" -#define XML_LRM_TAG_AGENTS "lrm_agents" -#define XML_LRM_TAG_AGENT "lrm_agent" -#define XML_LRM_TAG_RSC_OP "lrm_rsc_op" -#define XML_AGENT_ATTR_CLASS "class" -#define XML_AGENT_ATTR_PROVIDER "provider" -#define XML_LRM_TAG_ATTRIBUTES "attributes" - -#define XML_CIB_ATTR_REPLACE "replace" -#define XML_CIB_ATTR_SOURCE "source" - -#define XML_CIB_ATTR_HEALTH "health" -#define XML_CIB_ATTR_WEIGHT "weight" -#define XML_CIB_ATTR_PRIORITY "priority" -#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_HASTATE "ha" - -#define XML_CIB_ATTR_SHUTDOWN "shutdown" -#define XML_CIB_ATTR_STONITH "stonith" - -#define XML_LRM_ATTR_INTERVAL "interval" -#define XML_LRM_ATTR_TASK "operation" -#define XML_LRM_ATTR_TASK_KEY "operation_key" -#define XML_LRM_ATTR_TARGET "on_node" -#define XML_LRM_ATTR_TARGET_UUID "on_node_uuid" -#define XML_LRM_ATTR_RSCID "rsc-id" -#define XML_LRM_ATTR_OPSTATUS "op-status" -#define XML_LRM_ATTR_RC "rc-code" -#define XML_LRM_ATTR_CALLID "call-id" -#define XML_LRM_ATTR_OP_DIGEST "op-digest" -#define XML_LRM_ATTR_OP_RESTART "op-force-restart" -#define XML_LRM_ATTR_RESTART_DIGEST "op-restart-digest" - -#define XML_LRM_ATTR_MIGRATE_SOURCE "migrate_source" -#define XML_LRM_ATTR_MIGRATE_TARGET "migrate_target" - -#define XML_TAG_GRAPH "transition_graph" -#define XML_GRAPH_TAG_RSC_OP "rsc_op" -#define XML_GRAPH_TAG_PSEUDO_EVENT "pseudo_event" -#define XML_GRAPH_TAG_CRM_EVENT "crm_event" - -#define XML_TAG_RULE "rule" -#define XML_RULE_ATTR_SCORE "score" -#define XML_RULE_ATTR_SCORE_ATTRIBUTE "score-attribute" -#define XML_RULE_ATTR_SCORE_MANGLED "score-attribute-mangled" -#define XML_RULE_ATTR_ROLE "role" -#define XML_RULE_ATTR_RESULT "result" -#define XML_RULE_ATTR_BOOLEAN_OP "boolean-op" - -#define XML_TAG_EXPRESSION "expression" -#define XML_EXPR_ATTR_ATTRIBUTE "attribute" -#define XML_EXPR_ATTR_OPERATION "operation" -#define XML_EXPR_ATTR_VALUE "value" -#define XML_EXPR_ATTR_TYPE "type" - -#define XML_CONS_TAG_RSC_DEPEND "rsc_colocation" -#define XML_CONS_TAG_RSC_ORDER "rsc_order" -#define XML_CONS_TAG_RSC_LOCATION "rsc_location" -#define XML_CONS_TAG_RSC_TICKET "rsc_ticket" -#define XML_CONS_TAG_RSC_SET "resource_set" -#define XML_CONS_ATTR_SYMMETRICAL "symmetrical" - -#define XML_COLOC_ATTR_SOURCE "rsc" -#define XML_COLOC_ATTR_SOURCE_ROLE "rsc-role" -#define XML_COLOC_ATTR_TARGET "with-rsc" -#define XML_COLOC_ATTR_TARGET_ROLE "with-rsc-role" -#define XML_COLOC_ATTR_NODE_ATTR "node-attribute" -#define XML_COLOC_ATTR_SOURCE_INSTANCE "rsc-instance" -#define XML_COLOC_ATTR_TARGET_INSTANCE "with-rsc-instance" - -#define XML_ORDER_ATTR_FIRST "first" -#define XML_ORDER_ATTR_THEN "then" -#define XML_ORDER_ATTR_FIRST_ACTION "first-action" -#define XML_ORDER_ATTR_THEN_ACTION "then-action" -#define XML_ORDER_ATTR_FIRST_INSTANCE "first-instance" -#define XML_ORDER_ATTR_THEN_INSTANCE "then-instance" -#define XML_ORDER_ATTR_KIND "kind" - -#define XML_TICKET_ATTR_TICKET "ticket" -#define XML_TICKET_ATTR_LOSS_POLICY "loss-policy" - -#define XML_NVPAIR_ATTR_NAME "name" -#define XML_NVPAIR_ATTR_VALUE "value" - -#define XML_NODE_ATTR_STATE "state" - -#define XML_CONFIG_ATTR_DC_DEADTIME "dc-deadtime" -#define XML_CONFIG_ATTR_ELECTION_FAIL "election-timeout" -#define XML_CONFIG_ATTR_FORCE_QUIT "shutdown-escalation" -#define XML_CONFIG_ATTR_RECHECK "cluster-recheck-interval" - -#define XML_CIB_TAG_GENERATION_TUPPLE "generation_tuple" - -#define XML_ATTR_TRANSITION_MAGIC "transition-magic" -#define XML_ATTR_TRANSITION_KEY "transition-key" - -#define XML_ATTR_TE_NOWAIT "op_no_wait" -#define XML_ATTR_TE_TARGET_RC "op_target_rc" -#define XML_ATTR_TE_ALLOWFAIL "op_allow_fail" -#define XML_ATTR_LRM_PROBE "lrm-is-probe" -#define XML_TAG_TRANSIENT_NODEATTRS "transient_attributes" - -#define XML_TAG_DIFF_ADDED "diff-added" -#define XML_TAG_DIFF_REMOVED "diff-removed" - -#define XML_ACL_TAG_USER "acl_user" -#define XML_ACL_TAG_ROLE "acl_role" -#define XML_ACL_TAG_ROLE_REF "role_ref" -#define XML_ACL_TAG_READ "read" -#define XML_ACL_TAG_WRITE "write" -#define XML_ACL_TAG_DENY "deny" -#define XML_ACL_ATTR_REF "ref" -#define XML_ACL_ATTR_TAG "tag" -#define XML_ACL_ATTR_XPATH "xpath" -#define XML_ACL_ATTR_ATTRIBUTE "attribute" - -#define XML_CIB_TAG_TICKETS "tickets" - -#include - -#define ID(x) crm_element_value(x, XML_ATTR_ID) -#define INSTANCE(x) crm_element_value(x, XML_CIB_ATTR_INSTANCE) -#define TSTAMP(x) crm_element_value(x, XML_ATTR_TSTAMP) -#define TYPE(x) crm_element_name(x) -#define NAME(x) crm_element_value(x, XML_NVPAIR_ATTR_NAME) -#define VALUE(x) crm_element_value(x, XML_NVPAIR_ATTR_VALUE) +# define XML_CIB_TAG_SECTION_ALL "all" +# 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_DOMAINS "domains" +# define XML_CIB_TAG_CONSTRAINTS "constraints" +# define XML_CIB_TAG_CRMCONFIG "crm_config" +# define XML_CIB_TAG_OPCONFIG "op_defaults" +# define XML_CIB_TAG_RSCCONFIG "rsc_defaults" +# define XML_CIB_TAG_ACLS "acls" + +# define XML_CIB_TAG_STATE "node_state" +# define XML_CIB_TAG_NODE "node" +# define XML_CIB_TAG_DOMAIN "domain" +# define XML_CIB_TAG_CONSTRAINT "constraint" +# define XML_CIB_TAG_NVPAIR "nvpair" + +# define XML_CIB_TAG_PROPSET "cluster_property_set" +# define XML_TAG_ATTR_SETS "instance_attributes" +# define XML_TAG_META_SETS "meta_attributes" +# define XML_TAG_ATTRS "attributes" +# define XML_TAG_PARAMS "parameters" +# define XML_TAG_PARAM "param" +# define XML_TAG_UTILIZATION "utilization" + +# define XML_TAG_RESOURCE_REF "resource_ref" +# define XML_CIB_TAG_RESOURCE "primitive" +# define XML_CIB_TAG_GROUP "group" +# define XML_CIB_TAG_INCARNATION "clone" +# define XML_CIB_TAG_MASTER "master" + +# define XML_CIB_TAG_RSC_TEMPLATE "template" + +# define XML_RSC_ATTR_RESTART "restart-type" +# define XML_RSC_ATTR_ORDERED "ordered" +# define XML_RSC_ATTR_INTERLEAVE "interleave" +# define XML_RSC_ATTR_INCARNATION "clone" +# define XML_RSC_ATTR_INCARNATION_MAX "clone-max" +# define XML_RSC_ATTR_INCARNATION_NODEMAX "clone-node-max" +# define XML_RSC_ATTR_MASTER_MAX "master-max" +# define XML_RSC_ATTR_MASTER_NODEMAX "master-node-max" +# define XML_RSC_ATTR_STATE "clone-state" +# define XML_RSC_ATTR_MANAGED "is-managed" +# define XML_RSC_ATTR_TARGET_ROLE "target-role" +# define XML_RSC_ATTR_UNIQUE "globally-unique" +# define XML_RSC_ATTR_NOTIFY "notify" +# define XML_RSC_ATTR_STICKINESS "resource-stickiness" +# define XML_RSC_ATTR_FAIL_STICKINESS "migration-threshold" +# define XML_RSC_ATTR_FAIL_TIMEOUT "failure-timeout" +# define XML_RSC_ATTR_MULTIPLE "multiple-active" +# define XML_RSC_ATTR_PRIORITY "priority" +# define XML_OP_ATTR_ON_FAIL "on-fail" +# define XML_OP_ATTR_START_DELAY "start-delay" +# define XML_OP_ATTR_ALLOW_MIGRATE "allow-migrate" +# define XML_OP_ATTR_ORIGIN "interval-origin" +# define XML_OP_ATTR_PENDING "record-pending" + +# define XML_CIB_TAG_LRM "lrm" +# define XML_LRM_TAG_RESOURCES "lrm_resources" +# define XML_LRM_TAG_RESOURCE "lrm_resource" +# define XML_LRM_TAG_AGENTS "lrm_agents" +# define XML_LRM_TAG_AGENT "lrm_agent" +# define XML_LRM_TAG_RSC_OP "lrm_rsc_op" +# define XML_AGENT_ATTR_CLASS "class" +# define XML_AGENT_ATTR_PROVIDER "provider" +# define XML_LRM_TAG_ATTRIBUTES "attributes" + +# define XML_CIB_ATTR_REPLACE "replace" +# define XML_CIB_ATTR_SOURCE "source" + +# define XML_CIB_ATTR_HEALTH "health" +# define XML_CIB_ATTR_WEIGHT "weight" +# define XML_CIB_ATTR_PRIORITY "priority" +# 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_HASTATE "ha" + +# define XML_CIB_ATTR_SHUTDOWN "shutdown" +# define XML_CIB_ATTR_STONITH "stonith" + +# define XML_LRM_ATTR_INTERVAL "interval" +# define XML_LRM_ATTR_TASK "operation" +# define XML_LRM_ATTR_TASK_KEY "operation_key" +# define XML_LRM_ATTR_TARGET "on_node" +# define XML_LRM_ATTR_TARGET_UUID "on_node_uuid" +# define XML_LRM_ATTR_RSCID "rsc-id" +# define XML_LRM_ATTR_OPSTATUS "op-status" +# define XML_LRM_ATTR_RC "rc-code" +# define XML_LRM_ATTR_CALLID "call-id" +# define XML_LRM_ATTR_OP_DIGEST "op-digest" +# define XML_LRM_ATTR_OP_RESTART "op-force-restart" +# define XML_LRM_ATTR_RESTART_DIGEST "op-restart-digest" + +# define XML_LRM_ATTR_MIGRATE_SOURCE "migrate_source" +# define XML_LRM_ATTR_MIGRATE_TARGET "migrate_target" + +# define XML_TAG_GRAPH "transition_graph" +# define XML_GRAPH_TAG_RSC_OP "rsc_op" +# define XML_GRAPH_TAG_PSEUDO_EVENT "pseudo_event" +# define XML_GRAPH_TAG_CRM_EVENT "crm_event" + +# define XML_TAG_RULE "rule" +# define XML_RULE_ATTR_SCORE "score" +# define XML_RULE_ATTR_SCORE_ATTRIBUTE "score-attribute" +# define XML_RULE_ATTR_SCORE_MANGLED "score-attribute-mangled" +# define XML_RULE_ATTR_ROLE "role" +# define XML_RULE_ATTR_RESULT "result" +# define XML_RULE_ATTR_BOOLEAN_OP "boolean-op" + +# define XML_TAG_EXPRESSION "expression" +# define XML_EXPR_ATTR_ATTRIBUTE "attribute" +# define XML_EXPR_ATTR_OPERATION "operation" +# define XML_EXPR_ATTR_VALUE "value" +# define XML_EXPR_ATTR_TYPE "type" + +# define XML_CONS_TAG_RSC_DEPEND "rsc_colocation" +# define XML_CONS_TAG_RSC_ORDER "rsc_order" +# define XML_CONS_TAG_RSC_LOCATION "rsc_location" +# define XML_CONS_TAG_RSC_TICKET "rsc_ticket" +# define XML_CONS_TAG_RSC_SET "resource_set" +# define XML_CONS_ATTR_SYMMETRICAL "symmetrical" + +# define XML_COLOC_ATTR_SOURCE "rsc" +# define XML_COLOC_ATTR_SOURCE_ROLE "rsc-role" +# define XML_COLOC_ATTR_TARGET "with-rsc" +# define XML_COLOC_ATTR_TARGET_ROLE "with-rsc-role" +# define XML_COLOC_ATTR_NODE_ATTR "node-attribute" +# define XML_COLOC_ATTR_SOURCE_INSTANCE "rsc-instance" +# define XML_COLOC_ATTR_TARGET_INSTANCE "with-rsc-instance" + +# define XML_ORDER_ATTR_FIRST "first" +# define XML_ORDER_ATTR_THEN "then" +# define XML_ORDER_ATTR_FIRST_ACTION "first-action" +# define XML_ORDER_ATTR_THEN_ACTION "then-action" +# define XML_ORDER_ATTR_FIRST_INSTANCE "first-instance" +# define XML_ORDER_ATTR_THEN_INSTANCE "then-instance" +# define XML_ORDER_ATTR_KIND "kind" + +# define XML_TICKET_ATTR_TICKET "ticket" +# define XML_TICKET_ATTR_LOSS_POLICY "loss-policy" + +# define XML_NVPAIR_ATTR_NAME "name" +# define XML_NVPAIR_ATTR_VALUE "value" + +# define XML_NODE_ATTR_STATE "state" + +# define XML_CONFIG_ATTR_DC_DEADTIME "dc-deadtime" +# define XML_CONFIG_ATTR_ELECTION_FAIL "election-timeout" +# define XML_CONFIG_ATTR_FORCE_QUIT "shutdown-escalation" +# define XML_CONFIG_ATTR_RECHECK "cluster-recheck-interval" + +# define XML_CIB_TAG_GENERATION_TUPPLE "generation_tuple" + +# define XML_ATTR_TRANSITION_MAGIC "transition-magic" +# define XML_ATTR_TRANSITION_KEY "transition-key" + +# define XML_ATTR_TE_NOWAIT "op_no_wait" +# define XML_ATTR_TE_TARGET_RC "op_target_rc" +# define XML_ATTR_TE_ALLOWFAIL "op_allow_fail" +# define XML_ATTR_LRM_PROBE "lrm-is-probe" +# define XML_TAG_TRANSIENT_NODEATTRS "transient_attributes" + +# define XML_TAG_DIFF_ADDED "diff-added" +# define XML_TAG_DIFF_REMOVED "diff-removed" + +# define XML_ACL_TAG_USER "acl_user" +# define XML_ACL_TAG_ROLE "acl_role" +# define XML_ACL_TAG_ROLE_REF "role_ref" +# define XML_ACL_TAG_READ "read" +# define XML_ACL_TAG_WRITE "write" +# define XML_ACL_TAG_DENY "deny" +# define XML_ACL_ATTR_REF "ref" +# define XML_ACL_ATTR_TAG "tag" +# define XML_ACL_ATTR_XPATH "xpath" +# define XML_ACL_ATTR_ATTRIBUTE "attribute" + +# define XML_CIB_TAG_TICKETS "tickets" + +# include + +# define ID(x) crm_element_value(x, XML_ATTR_ID) +# define INSTANCE(x) crm_element_value(x, XML_CIB_ATTR_INSTANCE) +# define TSTAMP(x) crm_element_value(x, XML_ATTR_TSTAMP) +# define TYPE(x) crm_element_name(x) +# define NAME(x) crm_element_value(x, XML_NVPAIR_ATTR_NAME) +# define VALUE(x) crm_element_value(x, XML_NVPAIR_ATTR_VALUE) #endif diff --git a/include/crm/pengine/common.h b/include/crm/pengine/common.h index f16968f46f..a1df20a974 100644 --- a/include/crm/pengine/common.h +++ b/include/crm/pengine/common.h @@ -1,140 +1,141 @@ /* * 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 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef PE_COMMON__H -#define PE_COMMON__H -#include +# define PE_COMMON__H +# include extern gboolean was_processing_error; extern gboolean was_processing_warning; /* order is significant here * items listed in order of accending severeness * more severe actions take precedent over lower ones */ enum action_fail_response { - action_fail_ignore, - action_fail_recover, - action_fail_migrate, /* recover by moving it somewhere else */ - action_fail_block, - action_fail_stop, - action_fail_standby, - action_fail_fence + action_fail_ignore, + action_fail_recover, + action_fail_migrate, /* recover by moving it somewhere else */ + action_fail_block, + action_fail_stop, + action_fail_standby, + action_fail_fence }; -/* the "done" action must be the "pre" action +1 */ +/* the "done" action must be the "pre" action +1 */ enum action_tasks { - no_action, - monitor_rsc, - stop_rsc, - stopped_rsc, - start_rsc, - started_rsc, - action_notify, - action_notified, - action_promote, - action_promoted, - action_demote, - action_demoted, - shutdown_crm, - stonith_node + no_action, + monitor_rsc, + stop_rsc, + stopped_rsc, + start_rsc, + started_rsc, + action_notify, + action_notified, + action_promote, + action_promoted, + action_demote, + action_demoted, + shutdown_crm, + stonith_node }; enum rsc_recovery_type { - recovery_stop_start, - recovery_stop_only, - recovery_block + recovery_stop_start, + recovery_stop_only, + recovery_block }; enum rsc_start_requirement { - rsc_req_nothing, - rsc_req_quorum, - rsc_req_stonith + rsc_req_nothing, + rsc_req_quorum, + rsc_req_stonith }; enum rsc_role_e { - RSC_ROLE_UNKNOWN, - RSC_ROLE_STOPPED, - RSC_ROLE_STARTED, - RSC_ROLE_SLAVE, - RSC_ROLE_MASTER, + RSC_ROLE_UNKNOWN, + RSC_ROLE_STOPPED, + RSC_ROLE_STARTED, + RSC_ROLE_SLAVE, + RSC_ROLE_MASTER, }; -#define RSC_ROLE_MAX RSC_ROLE_MASTER+1 -#define RSC_ROLE_UNKNOWN_S "Unknown" -#define RSC_ROLE_STOPPED_S "Stopped" -#define RSC_ROLE_STARTED_S "Started" -#define RSC_ROLE_SLAVE_S "Slave" -#define RSC_ROLE_MASTER_S "Master" +# define RSC_ROLE_MAX RSC_ROLE_MASTER+1 + +# define RSC_ROLE_UNKNOWN_S "Unknown" +# define RSC_ROLE_STOPPED_S "Stopped" +# define RSC_ROLE_STARTED_S "Started" +# define RSC_ROLE_SLAVE_S "Slave" +# define RSC_ROLE_MASTER_S "Master" /* *INDENT-OFF* */ enum pe_print_options { pe_print_log = 0x0001, pe_print_html = 0x0002, pe_print_ncurses = 0x0004, pe_print_printf = 0x0008, pe_print_dev = 0x0010, pe_print_details = 0x0020, pe_print_max_details = 0x0040, pe_print_rsconly = 0x0080, pe_print_ops = 0x0100, pe_print_suppres_nl = 0x0200, }; /* *INDENT-ON* */ extern int merge_weights(int w1, int w2); extern const char *task2text(enum action_tasks task); extern enum action_tasks text2task(const char *task); extern enum rsc_role_e text2role(const char *role); extern const char *role2text(enum rsc_role_e role); extern const char *fail2text(enum action_fail_response fail); -extern void add_hash_param(GHashTable *hash, const char *name, const char *value); +extern void add_hash_param(GHashTable * hash, const char *name, const char *value); extern void append_hashtable(gpointer key, gpointer value, gpointer user_data); extern void pe_metadata(void); -extern void verify_pe_options(GHashTable *options); -extern const char *pe_pref(GHashTable *options, const char *name); -extern void calculate_active_ops(GList* sorted_op_list, int *start_index, int *stop_index); +extern void verify_pe_options(GHashTable * options); +extern const char *pe_pref(GHashTable * options, const char *name); +extern void calculate_active_ops(GList * sorted_op_list, int *start_index, int *stop_index); /* Helper macros to avoid NULL pointers */ -#define safe_val3(def, t,u,v) (t?t->u?t->u->v:def:def) -#define safe_val5(def, t,u,v,w,x) (t?t->u?t->u->v?t->u->v->w?t->u->v->w->x:def:def:def:def) +# define safe_val3(def, t,u,v) (t?t->u?t->u->v:def:def) +# define safe_val5(def, t,u,v,w,x) (t?t->u?t->u->v?t->u->v->w?t->u->v->w->x:def:def:def:def) -#define pe_err(fmt...) { was_processing_error = TRUE; crm_config_error = TRUE; crm_err(fmt); } -#define pe_warn(fmt...) { was_processing_warning = TRUE; crm_config_warning = TRUE; crm_warn(fmt); } -#define pe_proc_err(fmt...) { was_processing_error = TRUE; crm_err(fmt); } -#define pe_proc_warn(fmt...) { was_processing_warning = TRUE; crm_warn(fmt); } +# define pe_err(fmt...) { was_processing_error = TRUE; crm_config_error = TRUE; crm_err(fmt); } +# define pe_warn(fmt...) { was_processing_warning = TRUE; crm_config_warning = TRUE; crm_warn(fmt); } +# define pe_proc_err(fmt...) { was_processing_error = TRUE; crm_err(fmt); } +# define pe_proc_warn(fmt...) { was_processing_warning = TRUE; crm_warn(fmt); } -static inline const char *recovery2text(enum rsc_recovery_type type) +static inline const char * +recovery2text(enum rsc_recovery_type type) { - switch(type) { - case recovery_stop_only: - return "shutting it down"; - case recovery_stop_start: - return "attempting recovery"; - case recovery_block: - return "waiting for an administrator"; + switch (type) { + case recovery_stop_only: + return "shutting it down"; + case recovery_stop_start: + return "attempting recovery"; + case recovery_block: + return "waiting for an administrator"; } return "Unknown"; } - #endif diff --git a/include/crm/pengine/complex.h b/include/crm/pengine/complex.h index f7cd23d7a8..fd34d96457 100644 --- a/include/crm/pengine/complex.h +++ b/include/crm/pengine/complex.h @@ -1,116 +1,104 @@ /* * 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 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef PENGINE_COMPLEX__H -#define PENGINE_COMPLEX__H +# define PENGINE_COMPLEX__H -#define n_object_classes 3 +# define n_object_classes 3 /*#define PE_OBJ_F_ ""*/ -#define PE_OBJ_T_NATIVE "native" -#define PE_OBJ_T_GROUP "group" -#define PE_OBJ_T_INCARNATION "clone" -#define PE_OBJ_T_MASTER "master" - -enum pe_obj_types -{ - pe_unknown = -1, - pe_native = 0, - pe_group = 1, - pe_clone = 2, - pe_master = 3 +# define PE_OBJ_T_NATIVE "native" +# define PE_OBJ_T_GROUP "group" +# define PE_OBJ_T_INCARNATION "clone" +# define PE_OBJ_T_MASTER "master" + +enum pe_obj_types { + pe_unknown = -1, + pe_native = 0, + pe_group = 1, + pe_clone = 2, + pe_master = 3 }; extern enum pe_obj_types get_resource_type(const char *name); extern const char *get_resource_typename(enum pe_obj_types type); - -typedef struct resource_object_functions_s -{ - gboolean (*unpack)(resource_t *, pe_working_set_t *); - resource_t *(*find_rsc)(resource_t *parent, const char *search, node_t *node, int flags); - /* parameter result must be free'd */ - char *(*parameter)( - resource_t *, node_t *, gboolean, const char *, - pe_working_set_t *); - void (*print)(resource_t *, const char *, long, void *); - gboolean (*active)(resource_t *,gboolean); - enum rsc_role_e (*state)(const resource_t *, gboolean); - node_t *(*location)(resource_t *, GListPtr*, gboolean); - void (*free)(resource_t *); +typedef struct resource_object_functions_s { + gboolean(*unpack) (resource_t *, pe_working_set_t *); + resource_t *(*find_rsc) (resource_t * parent, const char *search, node_t * node, int flags); + /* parameter result must be free'd */ + char *(*parameter) (resource_t *, node_t *, gboolean, const char *, pe_working_set_t *); + void (*print) (resource_t *, const char *, long, void *); + gboolean(*active) (resource_t *, gboolean); + enum rsc_role_e (*state) (const resource_t *, gboolean); + node_t *(*location) (resource_t *, GListPtr *, gboolean); + void (*free) (resource_t *); } resource_object_functions_t; -extern void common_update_score(resource_t *rsc, const char *id, int score); +extern void common_update_score(resource_t * rsc, const char *id, int score); -extern char *native_parameter( - resource_t *rsc, node_t *node, gboolean create, const char *name, - pe_working_set_t *data_set); +extern char *native_parameter(resource_t * rsc, node_t * node, gboolean create, const char *name, + pe_working_set_t * data_set); -extern gboolean native_unpack(resource_t *rsc, pe_working_set_t *data_set); -extern gboolean group_unpack(resource_t *rsc, pe_working_set_t *data_set); -extern gboolean clone_unpack(resource_t *rsc, pe_working_set_t *data_set); -extern gboolean master_unpack(resource_t *rsc, pe_working_set_t *data_set); +extern gboolean native_unpack(resource_t * rsc, pe_working_set_t * data_set); +extern gboolean group_unpack(resource_t * rsc, pe_working_set_t * data_set); +extern gboolean clone_unpack(resource_t * rsc, pe_working_set_t * data_set); +extern gboolean master_unpack(resource_t * rsc, pe_working_set_t * data_set); -extern resource_t *native_find_rsc( - resource_t *rsc, const char *id, node_t *node, int flags); +extern resource_t *native_find_rsc(resource_t * rsc, const char *id, node_t * node, int flags); -extern gboolean native_active(resource_t *rsc, gboolean all); -extern gboolean group_active(resource_t *rsc, gboolean all); -extern gboolean clone_active(resource_t *rsc, gboolean all); -extern gboolean master_active(resource_t *rsc, gboolean all); +extern gboolean native_active(resource_t * rsc, gboolean all); +extern gboolean group_active(resource_t * rsc, gboolean all); +extern gboolean clone_active(resource_t * rsc, gboolean all); +extern gboolean master_active(resource_t * rsc, gboolean all); -extern void native_print( - resource_t *rsc, const char *pre_text, long options, void *print_data); -extern void group_print( - resource_t *rsc, const char *pre_text, long options, void *print_data); -extern void clone_print( - resource_t *rsc, const char *pre_text, long options, void *print_data); -extern void master_print( - resource_t *rsc, const char *pre_text, long options, void *print_data); +extern void native_print(resource_t * rsc, const char *pre_text, long options, void *print_data); +extern void group_print(resource_t * rsc, const char *pre_text, long options, void *print_data); +extern void clone_print(resource_t * rsc, const char *pre_text, long options, void *print_data); +extern void master_print(resource_t * rsc, const char *pre_text, long options, void *print_data); -extern void native_free(resource_t *rsc); -extern void group_free(resource_t *rsc); -extern void clone_free(resource_t *rsc); -extern void master_free(resource_t *rsc); +extern void native_free(resource_t * rsc); +extern void group_free(resource_t * rsc); +extern void clone_free(resource_t * rsc); +extern void master_free(resource_t * rsc); -extern enum rsc_role_e native_resource_state(const resource_t *rsc, gboolean current); -extern enum rsc_role_e group_resource_state(const resource_t *rsc, gboolean current); -extern enum rsc_role_e clone_resource_state(const resource_t *rsc, gboolean current); -extern enum rsc_role_e master_resource_state(const resource_t *rsc, gboolean current); +extern enum rsc_role_e native_resource_state(const resource_t * rsc, gboolean current); +extern enum rsc_role_e group_resource_state(const resource_t * rsc, gboolean current); +extern enum rsc_role_e clone_resource_state(const resource_t * rsc, gboolean current); +extern enum rsc_role_e master_resource_state(const resource_t * rsc, gboolean current); -extern node_t *native_location(resource_t *rsc, GListPtr *list, gboolean current); +extern node_t *native_location(resource_t * rsc, GListPtr * list, gboolean current); extern resource_object_functions_t resource_class_functions[]; -extern gboolean common_unpack(xmlNode * xml_obj, resource_t **rsc, - resource_t *parent, pe_working_set_t *data_set); +extern gboolean common_unpack(xmlNode * xml_obj, resource_t ** rsc, + resource_t * parent, pe_working_set_t * data_set); -extern void common_print(resource_t *rsc, const char *pre_text, long options, void *print_data); +extern void common_print(resource_t * rsc, const char *pre_text, long options, void *print_data); -extern void common_free(resource_t *rsc); -extern void native_add_running( - resource_t *rsc, node_t *node, pe_working_set_t *data_set); -extern void get_meta_attributes(GHashTable *meta_hash, resource_t *rsc, - node_t *node, pe_working_set_t *data_set); -extern void get_rsc_attributes(GHashTable *meta_hash, resource_t *rsc, - node_t *node, pe_working_set_t *data_set); +extern void common_free(resource_t * rsc); +extern void native_add_running(resource_t * rsc, node_t * node, pe_working_set_t * data_set); +extern void get_meta_attributes(GHashTable * meta_hash, resource_t * rsc, + node_t * node, pe_working_set_t * data_set); +extern void get_rsc_attributes(GHashTable * meta_hash, resource_t * rsc, + node_t * node, pe_working_set_t * data_set); typedef struct resource_alloc_functions_s resource_alloc_functions_t; -extern resource_t *uber_parent(resource_t *rsc); -extern node_t *rsc_known_on(resource_t *rsc, GListPtr *list); +extern resource_t *uber_parent(resource_t * rsc); +extern node_t *rsc_known_on(resource_t * rsc, GListPtr * list); #endif diff --git a/include/crm/pengine/rules.h b/include/crm/pengine/rules.h index 1fe7e60cad..5455e80978 100644 --- a/include/crm/pengine/rules.h +++ b/include/crm/pengine/rules.h @@ -1,49 +1,49 @@ /* * 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 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef PENGINE_RULES__H -#define PENGINE_RULES__H +# define PENGINE_RULES__H -#include -#include -#include +# include +# include +# include enum expression_type { - not_expr, - nested_rule, - attr_expr, - loc_expr, - role_expr, - time_expr + not_expr, + nested_rule, + attr_expr, + loc_expr, + role_expr, + time_expr }; -extern enum expression_type find_expression_type(xmlNode *expr); +extern enum expression_type find_expression_type(xmlNode * expr); -extern gboolean test_ruleset( - xmlNode *ruleset, GHashTable *node_hash, ha_time_t *now); +extern gboolean test_ruleset(xmlNode * ruleset, GHashTable * node_hash, ha_time_t * now); -extern gboolean test_rule(xmlNode *rule, GHashTable *node_hash, - enum rsc_role_e role, ha_time_t *now); +extern gboolean test_rule(xmlNode * rule, GHashTable * node_hash, + enum rsc_role_e role, ha_time_t * now); -extern gboolean test_expression(xmlNode *expr, GHashTable *node_hash, - enum rsc_role_e role, ha_time_t *now); +extern gboolean test_expression(xmlNode * expr, GHashTable * node_hash, + enum rsc_role_e role, ha_time_t * now); -extern void unpack_instance_attributes( - xmlNode *top, xmlNode *xml_obj, const char *set_name, GHashTable *node_hash, - GHashTable *hash, const char *always_first, gboolean overwrite, ha_time_t *now); +extern void unpack_instance_attributes(xmlNode * top, xmlNode * xml_obj, const char *set_name, + GHashTable * node_hash, GHashTable * hash, + const char *always_first, gboolean overwrite, + ha_time_t * now); #endif diff --git a/include/crm/pengine/status.h b/include/crm/pengine/status.h index 62758113fb..51012294e9 100644 --- a/include/crm/pengine/status.h +++ b/include/crm/pengine/status.h @@ -1,310 +1,306 @@ /* * 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 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef PENGINE_STATUS__H -#define PENGINE_STATUS__H +# define PENGINE_STATUS__H -#include -#include -#include +# include +# include +# include typedef struct node_s node_t; typedef struct pe_action_s action_t; typedef struct pe_action_s pe_action_t; typedef struct resource_s resource_t; typedef struct ticket_s ticket_t; typedef enum no_quorum_policy_e { - no_quorum_freeze, - no_quorum_stop, - no_quorum_ignore, - no_quorum_suicide + no_quorum_freeze, + no_quorum_stop, + no_quorum_ignore, + no_quorum_suicide } no_quorum_policy_t; enum node_type { - node_ping, - node_member + node_ping, + node_member }; enum pe_restart { - pe_restart_restart, - pe_restart_ignore + pe_restart_restart, + pe_restart_ignore }; enum pe_find { - pe_find_renamed = 0x001, - pe_find_partial = 0x002, - pe_find_clone = 0x004, - pe_find_current = 0x008, + pe_find_renamed = 0x001, + pe_find_partial = 0x002, + pe_find_clone = 0x004, + pe_find_current = 0x008, pe_find_inactive = 0x010, }; -#define pe_flag_have_quorum 0x00000001ULL -#define pe_flag_symmetric_cluster 0x00000002ULL -#define pe_flag_is_managed_default 0x00000004ULL -#define pe_flag_maintenance_mode 0x00000008ULL - -#define pe_flag_stonith_enabled 0x00000010ULL -#define pe_flag_have_stonith_resource 0x00000020ULL - -#define pe_flag_stop_rsc_orphans 0x00000100ULL -#define pe_flag_stop_action_orphans 0x00000200ULL -#define pe_flag_stop_everything 0x00000400ULL - -#define pe_flag_start_failure_fatal 0x00001000ULL -#define pe_flag_remove_after_stop 0x00002000ULL - -#define pe_flag_startup_probes 0x00010000ULL -#define pe_flag_have_status 0x00020000ULL - -typedef struct pe_working_set_s -{ - xmlNode *input; - ha_time_t *now; - - /* options extracted from the input */ - char *dc_uuid; - node_t *dc_node; - const char *stonith_action; - const char *placement_strategy; - - unsigned long long flags; - - int stonith_timeout; - int default_resource_stickiness; - no_quorum_policy_t no_quorum_policy; - - GHashTable *config_hash; - GHashTable *domains; - GHashTable *tickets; - - GListPtr nodes; - GListPtr resources; - GListPtr placement_constraints; - GListPtr ordering_constraints; - GListPtr colocation_constraints; - GListPtr ticket_constraints; - - GListPtr actions; - xmlNode *failed; - xmlNode *op_defaults; - xmlNode *rsc_defaults; - - /* stats */ - int num_synapse; - int max_valid_nodes; - int order_id; - int action_id; - - /* final output */ - xmlNode *graph; +# define pe_flag_have_quorum 0x00000001ULL +# define pe_flag_symmetric_cluster 0x00000002ULL +# define pe_flag_is_managed_default 0x00000004ULL +# define pe_flag_maintenance_mode 0x00000008ULL + +# define pe_flag_stonith_enabled 0x00000010ULL +# define pe_flag_have_stonith_resource 0x00000020ULL + +# define pe_flag_stop_rsc_orphans 0x00000100ULL +# define pe_flag_stop_action_orphans 0x00000200ULL +# define pe_flag_stop_everything 0x00000400ULL + +# define pe_flag_start_failure_fatal 0x00001000ULL +# define pe_flag_remove_after_stop 0x00002000ULL + +# define pe_flag_startup_probes 0x00010000ULL +# define pe_flag_have_status 0x00020000ULL + +typedef struct pe_working_set_s { + xmlNode *input; + ha_time_t *now; + + /* options extracted from the input */ + char *dc_uuid; + node_t *dc_node; + const char *stonith_action; + const char *placement_strategy; + + unsigned long long flags; + + int stonith_timeout; + int default_resource_stickiness; + no_quorum_policy_t no_quorum_policy; + + GHashTable *config_hash; + GHashTable *domains; + GHashTable *tickets; + + GListPtr nodes; + GListPtr resources; + GListPtr placement_constraints; + GListPtr ordering_constraints; + GListPtr colocation_constraints; + GListPtr ticket_constraints; + + GListPtr actions; + xmlNode *failed; + xmlNode *op_defaults; + xmlNode *rsc_defaults; + + /* stats */ + int num_synapse; + int max_valid_nodes; + int order_id; + int action_id; + + /* final output */ + xmlNode *graph; } pe_working_set_t; -struct node_shared_s { - const char *id; - const char *uname; - gboolean online; - gboolean standby; - gboolean standby_onfail; - gboolean pending; - gboolean unclean; - gboolean shutdown; - gboolean expected_up; - gboolean is_dc; - int num_resources; - GListPtr running_rsc; /* resource_t* */ - GListPtr allocated_rsc; /* resource_t* */ - - GHashTable *attrs; /* char* => char* */ - enum node_type type; - - GHashTable *utilization; -}; - -struct node_s { - int weight; - gboolean fixed; - int count; - struct node_shared_s *details; +struct node_shared_s { + const char *id; + const char *uname; + gboolean online; + gboolean standby; + gboolean standby_onfail; + gboolean pending; + gboolean unclean; + gboolean shutdown; + gboolean expected_up; + gboolean is_dc; + int num_resources; + GListPtr running_rsc; /* resource_t* */ + GListPtr allocated_rsc; /* resource_t* */ + + GHashTable *attrs; /* char* => char* */ + enum node_type type; + + GHashTable *utilization; }; -#include +struct node_s { + int weight; + gboolean fixed; + int count; + struct node_shared_s *details; +}; + +# include -#define pe_rsc_orphan 0x00000001ULL -#define pe_rsc_managed 0x00000002ULL +# define pe_rsc_orphan 0x00000001ULL +# define pe_rsc_managed 0x00000002ULL -#define pe_rsc_notify 0x00000010ULL -#define pe_rsc_unique 0x00000020ULL -#define pe_rsc_can_migrate 0x00000040ULL +# define pe_rsc_notify 0x00000010ULL +# define pe_rsc_unique 0x00000020ULL +# define pe_rsc_can_migrate 0x00000040ULL -#define pe_rsc_provisional 0x00000100ULL -#define pe_rsc_allocating 0x00000200ULL -#define pe_rsc_merging 0x00000400ULL +# define pe_rsc_provisional 0x00000100ULL +# define pe_rsc_allocating 0x00000200ULL +# define pe_rsc_merging 0x00000400ULL -#define pe_rsc_failed 0x00010000ULL -#define pe_rsc_shutdown 0x00020000ULL -#define pe_rsc_runnable 0x00040000ULL -#define pe_rsc_start_pending 0x00080000ULL +# define pe_rsc_failed 0x00010000ULL +# define pe_rsc_shutdown 0x00020000ULL +# define pe_rsc_runnable 0x00040000ULL +# define pe_rsc_start_pending 0x00080000ULL -#define pe_rsc_starting 0x00100000ULL -#define pe_rsc_stopping 0x00200000ULL +# define pe_rsc_starting 0x00100000ULL +# define pe_rsc_stopping 0x00200000ULL -#define pe_rsc_failure_ignored 0x01000000ULL +# define pe_rsc_failure_ignored 0x01000000ULL -enum pe_graph_flags -{ - pe_graph_none = 0x00000, - pe_graph_updated_first = 0x00001, - pe_graph_updated_then = 0x00002, - pe_graph_disable = 0x00004, +enum pe_graph_flags { + pe_graph_none = 0x00000, + pe_graph_updated_first = 0x00001, + pe_graph_updated_then = 0x00002, + pe_graph_disable = 0x00004, }; -enum pe_action_flags -{ - pe_action_pseudo = 0x00001, - pe_action_runnable = 0x00002, - pe_action_optional = 0x00004, - pe_action_print_always = 0x00008, - - pe_action_have_node_attrs = 0x00010, - pe_action_failure_is_fatal = 0x00020, - pe_action_implied_by_stonith = 0x00040, - pe_action_allow_reload_conversion = 0x00080, - - pe_action_dumped = 0x00100, - pe_action_processed = 0x00200, - pe_action_clear = 0x00400, - pe_action_dangle = 0x00800, +enum pe_action_flags { + pe_action_pseudo = 0x00001, + pe_action_runnable = 0x00002, + pe_action_optional = 0x00004, + pe_action_print_always = 0x00008, + + pe_action_have_node_attrs = 0x00010, + pe_action_failure_is_fatal = 0x00020, + pe_action_implied_by_stonith = 0x00040, + pe_action_allow_reload_conversion = 0x00080, + + pe_action_dumped = 0x00100, + pe_action_processed = 0x00200, + pe_action_clear = 0x00400, + pe_action_dangle = 0x00800, }; -struct resource_s { - char *id; - char *clone_name; - char *long_name; - xmlNode *xml; - xmlNode *orig_xml; - xmlNode *ops_xml; - - resource_t *parent; - void *variant_opaque; - enum pe_obj_types variant; - resource_object_functions_t *fns; - resource_alloc_functions_t *cmds; - - enum rsc_recovery_type recovery_type; - enum pe_restart restart_type; - - int priority; - int stickiness; - int sort_index; - int failure_timeout; - int effective_priority; - int migration_threshold; - - unsigned long long flags; - - GListPtr rsc_cons_lhs; /* rsc_colocation_t* */ - GListPtr rsc_cons; /* rsc_colocation_t* */ - GListPtr rsc_location; /* rsc_to_node_t* */ - GListPtr actions; /* action_t* */ - GListPtr rsc_tickets; /* rsc_ticket* */ - - node_t *allocated_to; - GListPtr running_on; /* node_t* */ - GHashTable *known_on; /* node_t* */ - GHashTable *allowed_nodes; /* node_t* */ - - enum rsc_role_e role; - enum rsc_role_e next_role; - - GHashTable *meta; - GHashTable *parameters; - GHashTable *utilization; - - GListPtr children; /* resource_t* */ - GListPtr dangling_migrations; /* node_t* */ +struct resource_s { + char *id; + char *clone_name; + char *long_name; + xmlNode *xml; + xmlNode *orig_xml; + xmlNode *ops_xml; + + resource_t *parent; + void *variant_opaque; + enum pe_obj_types variant; + resource_object_functions_t *fns; + resource_alloc_functions_t *cmds; + + enum rsc_recovery_type recovery_type; + enum pe_restart restart_type; + + int priority; + int stickiness; + int sort_index; + int failure_timeout; + int effective_priority; + int migration_threshold; + + unsigned long long flags; + + GListPtr rsc_cons_lhs; /* rsc_colocation_t* */ + GListPtr rsc_cons; /* rsc_colocation_t* */ + GListPtr rsc_location; /* rsc_to_node_t* */ + GListPtr actions; /* action_t* */ + GListPtr rsc_tickets; /* rsc_ticket* */ + + node_t *allocated_to; + GListPtr running_on; /* node_t* */ + GHashTable *known_on; /* node_t* */ + GHashTable *allowed_nodes; /* node_t* */ + + enum rsc_role_e role; + enum rsc_role_e next_role; + + GHashTable *meta; + GHashTable *parameters; + GHashTable *utilization; + + GListPtr children; /* resource_t* */ + GListPtr dangling_migrations; /* node_t* */ }; -struct pe_action_s -{ - int id; - int priority; - - resource_t *rsc; - node_t *node; - xmlNode *op_entry; - - char *task; - char *uuid; - - enum pe_action_flags flags; - enum rsc_start_requirement needs; - enum action_fail_response on_fail; - enum rsc_role_e fail_role; - - action_t *pre_notify; - action_t *pre_notified; - action_t *post_notify; - action_t *post_notified; - - int seen_count; - - GHashTable *meta; - GHashTable *extra; - - GListPtr actions_before; /* action_warpper_t* */ - GListPtr actions_after; /* action_warpper_t* */ +struct pe_action_s { + int id; + int priority; + + resource_t *rsc; + node_t *node; + xmlNode *op_entry; + + char *task; + char *uuid; + + enum pe_action_flags flags; + enum rsc_start_requirement needs; + enum action_fail_response on_fail; + enum rsc_role_e fail_role; + + action_t *pre_notify; + action_t *pre_notified; + action_t *post_notify; + action_t *post_notified; + + int seen_count; + + GHashTable *meta; + GHashTable *extra; + + GListPtr actions_before; /* action_warpper_t* */ + GListPtr actions_after; /* action_warpper_t* */ }; typedef struct notify_data_s { - GHashTable *keys; - - const char *action; - - action_t *pre; - action_t *post; - action_t *pre_done; - action_t *post_done; - - GListPtr active; /* notify_entry_t* */ - GListPtr inactive; /* notify_entry_t* */ - GListPtr start; /* notify_entry_t* */ - GListPtr stop; /* notify_entry_t* */ - GListPtr demote; /* notify_entry_t* */ - GListPtr promote; /* notify_entry_t* */ - GListPtr master; /* notify_entry_t* */ - GListPtr slave; /* notify_entry_t* */ - + GHashTable *keys; + + const char *action; + + action_t *pre; + action_t *post; + action_t *pre_done; + action_t *post_done; + + GListPtr active; /* notify_entry_t* */ + GListPtr inactive; /* notify_entry_t* */ + GListPtr start; /* notify_entry_t* */ + GListPtr stop; /* notify_entry_t* */ + GListPtr demote; /* notify_entry_t* */ + GListPtr promote; /* notify_entry_t* */ + GListPtr master; /* notify_entry_t* */ + GListPtr slave; /* notify_entry_t* */ + } notify_data_t; struct ticket_s { - char *id; - gboolean granted; - time_t last_granted; + char *id; + gboolean granted; + time_t last_granted; }; -gboolean cluster_status(pe_working_set_t *data_set); -extern void set_working_set_defaults(pe_working_set_t *data_set); -extern void cleanup_calculations(pe_working_set_t *data_set); +gboolean cluster_status(pe_working_set_t * data_set); +extern void set_working_set_defaults(pe_working_set_t * data_set); +extern void cleanup_calculations(pe_working_set_t * data_set); extern resource_t *pe_find_resource(GListPtr rsc_list, const char *id_rh); extern node_t *pe_find_node(GListPtr node_list, const char *uname); extern node_t *pe_find_node_id(GListPtr node_list, const char *id); -extern GListPtr find_operations( - const char *rsc, const char *node, gboolean active_filter, pe_working_set_t *data_set); +extern GListPtr find_operations(const char *rsc, const char *node, gboolean active_filter, + pe_working_set_t * data_set); #endif diff --git a/include/crm/stonith-ng-internal.h b/include/crm/stonith-ng-internal.h index 90e8aec076..95a0577eab 100644 --- a/include/crm/stonith-ng-internal.h +++ b/include/crm/stonith-ng-internal.h @@ -1,54 +1,51 @@ /* * Copyright (C) 2011 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 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef STONITH_NG_INTERNAL__H -#define STONITH_NG_INTERNAL__H +# define STONITH_NG_INTERNAL__H +typedef struct async_command_s { -typedef struct async_command_s -{ + int id; + int stdout; + int options; + int timeout; - int id; - int stdout; - int options; - int timeout; + char *op; + char *origin; + char *client; + char *remote; - char *op; - char *origin; - char *client; - char *remote; + char *victim; + char *action; + char *device; - char *victim; - char *action; - char *device; - - GListPtr device_list; - GListPtr device_next; + GListPtr device_list; + GListPtr device_next; - ProcTrack_ops *pt_ops; - ProcTrackKillInfo killseq[3]; + ProcTrack_ops *pt_ops; + ProcTrackKillInfo killseq[3]; } async_command_t; - -extern int run_stonith_agent( - const char *agent, const char *action, const char *victim, GHashTable *dev_hash, GHashTable *port_map, - int *agent_result, char **output, async_command_t *track); +extern int run_stonith_agent(const char *agent, const char *action, const char *victim, + GHashTable * dev_hash, GHashTable * port_map, int *agent_result, + char **output, async_command_t * track); extern gboolean is_redhat_agent(const char *agent); #endif diff --git a/include/crm/stonith-ng.h b/include/crm/stonith-ng.h index 0e50098b38..6ffe069331 100644 --- a/include/crm/stonith-ng.h +++ b/include/crm/stonith-ng.h @@ -1,211 +1,212 @@ /* * 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 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef STONITH_NG__H -#define STONITH_NG__H +# define STONITH_NG__H -#include -#include -#include +# include +# include +# include /* *INDENT-OFF* */ enum stonith_state { stonith_connected_command, stonith_connected_query, stonith_disconnected, }; enum stonith_call_options { st_opt_none = 0x00000000, st_opt_verbose = 0x00000001, st_opt_allow_suicide = 0x00000002, st_opt_local_first = 0x00000004, st_opt_discard_reply = 0x00000010, st_opt_all_replies = 0x00000020, st_opt_scope_local = 0x00000100, st_opt_sync_call = 0x00001000, }; #define stonith_default_options = stonith_none enum stonith_errors { stonith_ok = 0, stonith_pending = -1, st_err_generic = -2, st_err_internal = -3, st_err_not_supported = -4, st_err_connection = -5, st_err_missing = -6, st_err_exists = -7, st_err_timeout = -8, st_err_ipc = -9, st_err_peer = -10, st_err_unknown_operation = -11, st_err_unknown_device = -12, st_err_unknown_port = -13, st_err_none_available = -14, st_err_authentication = -15, st_err_signal = -16, st_err_agent_fork = -17, st_err_agent_args = -18, st_err_agent = -19, }; #define F_STONITH_CLIENTID "st_clientid" #define F_STONITH_CALLOPTS "st_callopt" #define F_STONITH_CALLID "st_callid" #define F_STONITH_CALLDATA "st_calldata" #define F_STONITH_OPERATION "st_op" #define F_STONITH_TARGET "st_target" #define F_STONITH_REMOTE "st_remote_op" #define F_STONITH_RC "st_rc" #define F_STONITH_TIMEOUT "st_timeout" #define F_STONITH_CALLBACK_TOKEN "st_async_id" #define F_STONITH_CLIENTNAME "st_clientname" #define F_STONITH_NOTIFY_TYPE "st_notify_type" #define F_STONITH_NOTIFY_ACTIVATE "st_notify_activate" #define F_STONITH_NOTIFY_DEACTIVATE "st_notify_deactivate" #define F_STONITH_DELEGATE "st_delegate" #define F_STONITH_ORIGIN "st_origin" #define F_STONITH_HISTORY_LIST "st_history" #define F_STONITH_DATE "st_date" #define F_STONITH_STATE "st_state" #define T_STONITH_NG "stonith-ng" #define T_STONITH_REPLY "st-reply" #define F_STONITH_DEVICE "st_device_id" #define F_STONITH_ACTION "st_device_action" #define T_STONITH_NOTIFY "st_notify" #define T_STONITH_NOTIFY_DISCONNECT "st_notify_disconnect" #define STONITH_ATTR_ARGMAP "pcmk_arg_map" #define STONITH_ATTR_HOSTARG "pcmk_host_argument" #define STONITH_ATTR_HOSTMAP "pcmk_host_map" #define STONITH_ATTR_HOSTLIST "pcmk_host_list" #define STONITH_ATTR_HOSTCHECK "pcmk_host_check" #define STONITH_ATTR_ACTION_OP "option" /* To be replaced by 'action' at some point */ #define STONITH_OP_EXEC "st_execute" #define STONITH_OP_QUERY "st_query" #define STONITH_OP_FENCE "st_fence" #define STONITH_OP_CONFIRM "st_confirm" #define STONITH_OP_DEVICE_ADD "st_device_register" #define STONITH_OP_DEVICE_DEL "st_device_remove" #define STONITH_OP_DEVICE_METADATA "st_device_metadata" #define STONITH_OP_FENCE_HISTORY "st_fence_history" #define stonith_channel "st_command" #define stonith_channel_callback "st_callback" enum op_state { st_query, st_exec, st_done, st_failed, }; typedef struct stonith_key_value_s { char *key; char *value; struct stonith_key_value_s *next; } stonith_key_value_t; typedef struct stonith_history_s { char *target; char *action; char *origin; char *delegate; int completed; int state; struct stonith_history_s *next; } stonith_history_t; typedef struct stonith_s stonith_t; typedef struct stonith_api_operations_s { int (*free) (stonith_t *st); int (*connect) (stonith_t *st, const char *name, int *stonith_fd); int (*disconnect)(stonith_t *st); int (*remove_device)( stonith_t *st, int options, const char *name); int (*register_device)( stonith_t *st, int options, const char *id, const char *namespace, const char *agent, stonith_key_value_t *params); int (*metadata)(stonith_t *st, int options, const char *device, const char *namespace, char **output, int timeout); int (*list)(stonith_t *stonith, int call_options, const char *namespace, stonith_key_value_t **devices, int timeout); int (*call)(stonith_t *st, int options, const char *id, const char *action, const char *port, int timeout); int (*query)(stonith_t *st, int options, const char *node, stonith_key_value_t **devices, int timeout); int (*fence)(stonith_t *st, int options, const char *node, const char *action, int timeout); int (*confirm)(stonith_t *st, int options, const char *node); int (*history)(stonith_t *st, int options, const char *node, stonith_history_t **output, int timeout); int (*register_notification)( stonith_t *st, const char *event, void (*notify)(stonith_t *st, const char *event, xmlNode *msg)); int (*remove_notification)(stonith_t *st, const char *event); int (*register_callback)( stonith_t *st, int call_id, int timeout, bool only_success, void *userdata, const char *callback_name, void (*callback)(stonith_t *st, const xmlNode *msg, int call, int rc, xmlNode *output, void *userdata)); int (*remove_callback)(stonith_t *st, int call_id, bool all_callbacks); } stonith_api_operations_t; struct stonith_s { enum stonith_state state; int call_id; int call_timeout; void *private; stonith_api_operations_t *cmds; }; /* *INDENT-ON* */ /* Core functions */ extern stonith_t *stonith_api_new(void); -extern void stonith_api_delete(stonith_t *st); +extern void stonith_api_delete(stonith_t * st); extern const char *stonith_error2string(enum stonith_errors return_code); -extern void stonith_dump_pending_callbacks(stonith_t *st); +extern void stonith_dump_pending_callbacks(stonith_t * st); extern const char *get_stonith_provider(const char *agent, const char *provider); -extern bool stonith_dispatch(stonith_t *st); +extern bool stonith_dispatch(stonith_t * st); -extern stonith_key_value_t *stonith_key_value_add(stonith_key_value_t *kvp, const char *key, const char *value); -extern void stonith_key_value_freeall(stonith_key_value_t *kvp, int keys, int values); +extern stonith_key_value_t *stonith_key_value_add(stonith_key_value_t * kvp, const char *key, + const char *value); +extern void stonith_key_value_freeall(stonith_key_value_t * kvp, int keys, int values); #endif diff --git a/include/crm/transition.h b/include/crm/transition.h index 5ebf894fef..50ee734bfa 100644 --- a/include/crm/transition.h +++ b/include/crm/transition.h @@ -1,161 +1,154 @@ /* * 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 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include #include #include typedef enum { - action_type_pseudo, - action_type_rsc, - action_type_crm + action_type_pseudo, + action_type_rsc, + action_type_crm } action_type_e; typedef struct te_timer_s crm_action_timer_t; - typedef struct synapse_s { - int id; - int priority; + int id; + int priority; - gboolean ready; - gboolean failed; - gboolean executed; - gboolean confirmed; + gboolean ready; + gboolean failed; + gboolean executed; + gboolean confirmed; - GListPtr actions; /* crm_action_t* */ - GListPtr inputs; /* crm_action_t* */ + GListPtr actions; /* crm_action_t* */ + GListPtr inputs; /* crm_action_t* */ } synapse_t; typedef struct crm_action_s { - int id; - int timeout; - int interval; - GHashTable *params; - action_type_e type; - - crm_action_timer_t *timer; - synapse_t *synapse; - - gboolean sent_update; /* sent to the CIB */ - gboolean executed; /* sent to the CRM */ - gboolean confirmed; - - gboolean failed; - gboolean can_fail; - - xmlNode *xml; - + int id; + int timeout; + int interval; + GHashTable *params; + action_type_e type; + + crm_action_timer_t *timer; + synapse_t *synapse; + + gboolean sent_update; /* sent to the CIB */ + gboolean executed; /* sent to the CRM */ + gboolean confirmed; + + gboolean failed; + gboolean can_fail; + + xmlNode *xml; + } crm_action_t; enum timer_reason { - timeout_action, - timeout_action_warn, - timeout_abort, + timeout_action, + timeout_action_warn, + timeout_abort, }; -struct te_timer_s -{ - int source_id; - int timeout; - enum timer_reason reason; - crm_action_t *action; +struct te_timer_s { + int source_id; + int timeout; + enum timer_reason reason; + crm_action_t *action; }; - /* order matters here */ enum transition_action { - tg_done, - tg_stop, - tg_restart, - tg_shutdown, + tg_done, + tg_stop, + tg_restart, + tg_shutdown, }; -typedef struct crm_graph_s -{ - int id; - char *source; - int abort_priority; - - gboolean complete; - const char *abort_reason; - enum transition_action completion_action; - - int num_actions; - int num_synapses; - - int batch_limit; - int network_delay; - int stonith_timeout; - int transition_timeout; - - int fired; - int pending; - int skipped; - int completed; - int incomplete; - - GListPtr synapses; /* synpase_t* */ - +typedef struct crm_graph_s { + int id; + char *source; + int abort_priority; + + gboolean complete; + const char *abort_reason; + enum transition_action completion_action; + + int num_actions; + int num_synapses; + + int batch_limit; + int network_delay; + int stonith_timeout; + int transition_timeout; + + int fired; + int pending; + int skipped; + int completed; + int incomplete; + + GListPtr synapses; /* synpase_t* */ + } crm_graph_t; -typedef struct crm_graph_functions_s -{ - gboolean (*pseudo)(crm_graph_t *graph, crm_action_t *action); - gboolean (*rsc)(crm_graph_t *graph, crm_action_t *action); - gboolean (*crmd)(crm_graph_t *graph, crm_action_t *action); - gboolean (*stonith)(crm_graph_t *graph, crm_action_t *action); +typedef struct crm_graph_functions_s { + gboolean(*pseudo) (crm_graph_t * graph, crm_action_t * action); + gboolean(*rsc) (crm_graph_t * graph, crm_action_t * action); + gboolean(*crmd) (crm_graph_t * graph, crm_action_t * action); + gboolean(*stonith) (crm_graph_t * graph, crm_action_t * action); } crm_graph_functions_t; enum transition_status { - transition_active, - transition_pending, /* active but no actions performed this time */ - transition_complete, - transition_stopped, - transition_terminated, - transition_action_failed, - transition_failed, + transition_active, + transition_pending, /* active but no actions performed this time */ + transition_complete, + transition_stopped, + transition_terminated, + transition_action_failed, + transition_failed, }; - extern void set_default_graph_functions(void); -extern void set_graph_functions(crm_graph_functions_t *fns); -extern crm_graph_t *unpack_graph(xmlNode *xml_graph, const char *reference); -extern int run_graph(crm_graph_t *graph); -extern gboolean update_graph(crm_graph_t *graph, crm_action_t *action); -extern void destroy_graph(crm_graph_t *graph); +extern void set_graph_functions(crm_graph_functions_t * fns); +extern crm_graph_t *unpack_graph(xmlNode * xml_graph, const char *reference); +extern int run_graph(crm_graph_t * graph); +extern gboolean update_graph(crm_graph_t * graph, crm_action_t * action); +extern void destroy_graph(crm_graph_t * graph); extern const char *transition_status(enum transition_status state); -extern void print_graph(unsigned int log_level, crm_graph_t *graph); -extern void print_action( - int log_level, const char *prefix, crm_action_t *action); -extern void update_abort_priority( - crm_graph_t *graph, int priority, - enum transition_action action, const char *abort_reason); +extern void print_graph(unsigned int log_level, crm_graph_t * graph); +extern void print_action(int log_level, const char *prefix, crm_action_t * action); +extern void update_abort_priority(crm_graph_t * graph, int priority, + enum transition_action action, const char *abort_reason); extern const char *actiontype2text(action_type_e type); #ifdef TESTING -# define te_log_action(log_level, fmt, args...) { \ +# define te_log_action(log_level, fmt, args...) { \ do_crm_log(log_level, fmt, ##args); \ fprintf(stderr, fmt"\n", ##args); \ } #else -# define te_log_action(log_level, fmt, args...) do_crm_log(log_level, fmt, ##args) +# define te_log_action(log_level, fmt, args...) do_crm_log(log_level, fmt, ##args) #endif #include -extern lrm_op_t *convert_graph_action(xmlNode *resource, crm_action_t *action, int status, int rc); +extern lrm_op_t *convert_graph_action(xmlNode * resource, crm_action_t * action, int status, + int rc); diff --git a/include/crm_internal.h b/include/crm_internal.h index 16965f70e3..f1633ad4ea 100644 --- a/include/crm_internal.h +++ b/include/crm_internal.h @@ -1,90 +1,90 @@ /* crm_internal.h */ /* * Copyright (C) 2006 - 2008 * 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 of the License, or * (at your option) any later version. * * This program 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef CRM_INTERNAL__H -#define CRM_INTERNAL__H +# define CRM_INTERNAL__H -#include -#include +# include +# include /* Prototypes for libreplace functions */ -#ifndef HAVE_DAEMON +# ifndef HAVE_DAEMON int daemon(int nochdir, int noclose); -#endif +# endif -#ifndef HAVE_SETENV -int setenv(const char *name, const char * value, int overwrite); -#endif +# ifndef HAVE_SETENV +int setenv(const char *name, const char *value, int overwrite); +# endif -#ifndef HAVE_UNSETENV +# ifndef HAVE_UNSETENV int unsetenv(const char *name); -#endif +# endif -#ifndef HAVE_STRERROR -char * strerror(int errnum); -#endif +# ifndef HAVE_STRERROR +char *strerror(int errnum); +# endif -#ifndef HAVE_SCANDIR -# include -int scandir (const char *dir_name, struct dirent ***array, - int (*select_fn) (const struct dirent *), - int (*compare_fn) (const void *, const void *)); -#endif +# ifndef HAVE_SCANDIR +# include +int scandir(const char *dir_name, struct dirent ***array, + int (*select_fn) (const struct dirent *), + int (*compare_fn) (const void *, const void *)); +# endif -#ifndef HAVE_ALPHASORT -# include +# ifndef HAVE_ALPHASORT +# include int alphasort(const void *dirent1, const void *dirent2); -#endif +# endif -#ifndef HAVE_INET_PTON +# ifndef HAVE_INET_PTON int inet_pton(int af, const char *src, void *dst); -#endif +# endif -#ifndef HAVE_STRNLEN +# ifndef HAVE_STRNLEN size_t strnlen(const char *s, size_t maxlen); -#endif +# endif -#ifndef HAVE_STRNDUP +# ifndef HAVE_STRNDUP char *strndup(const char *str, size_t len); -#endif +# endif -#ifndef HAVE_STRLCPY -size_t strlcpy(char * dest, const char *source, size_t len); -#endif +# ifndef HAVE_STRLCPY +size_t strlcpy(char *dest, const char *source, size_t len); +# endif -#ifndef HAVE_STRLCAT -size_t strlcat(char * dest, const char *source, size_t len); -#endif +# ifndef HAVE_STRLCAT +size_t strlcat(char *dest, const char *source, size_t len); +# endif /* * Some compilers do not define __FUNCTION__ */ /* Sun studio compiler */ -# ifdef __SUNPRO_C -# define __FUNCTION__ __func__ -# endif +# ifdef __SUNPRO_C +# define __FUNCTION__ __func__ +# endif -# ifdef __MY_UNKNOWN_C -# define __FUNCTION__ "__FUNCTION__" -# endif +# ifdef __MY_UNKNOWN_C +# define __FUNCTION__ "__FUNCTION__" +# endif -#endif /* CRM_INTERNAL__H */ +#endif /* CRM_INTERNAL__H */ diff --git a/include/portability.h b/include/portability.h index 4604f4d59b..bee2585faf 100644 --- a/include/portability.h +++ b/include/portability.h @@ -1,104 +1,107 @@ #ifndef PORTABILITY_H # define PORTABILITY_H /* * Copyright (C) 2001 Alan Robertson * This software licensed under the GNU LGPL. * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser 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 library 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 * Lesser 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#define EOS '\0' -#define DIMOF(a) ((int) (sizeof(a)/sizeof(a[0])) ) -#define STRLEN_CONST(conststr) ((size_t)((sizeof(conststr)/sizeof(char))-1)) -#define STRNCMP_CONST(varstr, conststr) strncmp((varstr), conststr, STRLEN_CONST(conststr)+1) -#define STRLEN(c) STRLEN_CONST(c) +# define EOS '\0' +# define DIMOF(a) ((int) (sizeof(a)/sizeof(a[0])) ) +# define STRLEN_CONST(conststr) ((size_t)((sizeof(conststr)/sizeof(char))-1)) +# define STRNCMP_CONST(varstr, conststr) strncmp((varstr), conststr, STRLEN_CONST(conststr)+1) +# define STRLEN(c) STRLEN_CONST(c) /* Needs to be defined before any other includes, otherwise some system * headers do not behave as expected! Major black magic... */ -#undef _GNU_SOURCE /* in case it was defined on the command line */ -#define _GNU_SOURCE +# undef _GNU_SOURCE /* in case it was defined on the command line */ +# define _GNU_SOURCE /* Please leave this as the first #include - Solaris needs it there */ -#ifdef HAVE_CONFIG_H -#include -#endif - -#include -#ifdef BSD -# define SCANSEL_CAST (void *) -#else -# define SCANSEL_CAST /* Nothing */ -#endif - -#if defined(ANSI_ONLY) && !defined(inline) -# define inline /* nothing */ -# undef NETSNMP_ENABLE_INLINE -# define NETSNMP_NO_INLINE 1 -#endif - -#ifndef HAVE_DAEMON +# ifdef HAVE_CONFIG_H +# include +# endif + +# include +# ifdef BSD +# define SCANSEL_CAST (void *) +# else +# define SCANSEL_CAST /* Nothing */ +# endif + +# if defined(ANSI_ONLY) && !defined(inline) +# define inline /* nothing */ +# undef NETSNMP_ENABLE_INLINE +# define NETSNMP_NO_INLINE 1 +# endif + +# ifndef HAVE_DAEMON /* We supply a replacement function, but need a prototype */ int daemon(int nochdir, int noclose); -#endif /* HAVE_DAEMON */ +# endif /* HAVE_DAEMON */ -#ifndef HAVE_SETENV +# ifndef HAVE_SETENV /* We supply a replacement function, but need a prototype */ -int setenv(const char *name, const char * value, int why); -#endif /* HAVE_SETENV */ +int setenv(const char *name, const char *value, int why); +# endif /* HAVE_SETENV */ -#ifndef HAVE_STRERROR +# ifndef HAVE_STRERROR /* We supply a replacement function, but need a prototype */ -char * strerror(int errnum); -#endif /* HAVE_STRERROR */ +char *strerror(int errnum); +# endif /* HAVE_STRERROR */ -#ifndef HAVE_ALPHASORT -# include +# ifndef HAVE_ALPHASORT +# include int -alphasort(const void *dirent1, const void *dirent2); -#endif /* HAVE_ALPHASORT */ + alphasort(const void *dirent1, const void *dirent2); +# endif /* HAVE_ALPHASORT */ -#ifndef HAVE_INET_PTON +# ifndef HAVE_INET_PTON /* We supply a replacement function, but need a prototype */ int -inet_pton(int af, const char *src, void *dst); - -#endif /* HAVE_INET_PTON */ - -#ifndef HAVE_STRNLEN - size_t strnlen(const char *s, size_t maxlen); -#else -# define USE_GNU -#endif - -#ifndef HAVE_STRNDUP - char *strndup(const char *str, size_t len); -#else -# define USE_GNU -#endif - -#ifdef HAVE_STRUCT_UCRED_DARWIN -# include -# ifndef SYS_NMLN -# define SYS_NMLN _SYS_NAMELEN -# endif /* SYS_NMLN */ -#endif - -#define POINTER_TO_SIZE_T(p) ((size_t)(p)) /*pointer cast as size_t*/ -#define POINTER_TO_SSIZE_T(p) ((ssize_t)(p)) /*pointer cast as ssize_t*/ -#define POINTER_TO_ULONG(p) ((unsigned long)(p)) /*pointer cast as unsigned long*/ - -#endif /* PORTABILITY_H */ + inet_pton(int af, const char *src, void *dst); + +# endif /* HAVE_INET_PTON */ + +# ifndef HAVE_STRNLEN +size_t strnlen(const char *s, size_t maxlen); +# else +# define USE_GNU +# endif + +# ifndef HAVE_STRNDUP +char *strndup(const char *str, size_t len); +# else +# define USE_GNU +# endif + +# ifdef HAVE_STRUCT_UCRED_DARWIN +# include +# ifndef SYS_NMLN +# define SYS_NMLN _SYS_NAMELEN +# endif /* SYS_NMLN */ +# endif + +# define POINTER_TO_SIZE_T(p) ((size_t)(p)) + /*pointer cast as size_t */ +# define POINTER_TO_SSIZE_T(p) ((ssize_t)(p)) + /*pointer cast as ssize_t */ +# define POINTER_TO_ULONG(p) ((unsigned long)(p)) + /*pointer cast as unsigned long */ + +#endif /* PORTABILITY_H */ diff --git a/lib/ais/plugin.h b/lib/ais/plugin.h index e985d07101..fa817cd48a 100755 --- a/lib/ais/plugin.h +++ b/lib/ais/plugin.h @@ -1,25 +1,25 @@ /* * Copyright (C) 2004 Andrew Beekhof * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser 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 library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef AIS_CRM_PLUGIN__H -#define AIS_CRM_PLUGIN__H +# define AIS_CRM_PLUGIN__H extern GHashTable *membership_notify_list; -extern int send_cluster_msg_raw(const AIS_Message *ais_msg); +extern int send_cluster_msg_raw(const AIS_Message * ais_msg); #endif diff --git a/lib/ais/utils.h b/lib/ais/utils.h index 547a7c7b3e..3b7352e6a0 100644 --- a/lib/ais/utils.h +++ b/lib/ais/utils.h @@ -1,235 +1,247 @@ /* * Copyright (C) 2004 Andrew Beekhof * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser 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 library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef AIS_CRM_UTILS__H -#define AIS_CRM_UTILS__H - -#include - -#ifdef AIS_WHITETANK -# include -# include - -# define OPENAIS_EXTERNAL_SERVICE insane_ais_header_hack_in__totem_h -# include -# include -# include -# include -# include -# include -# include -# define COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED OPENAIS_FLOW_CONTROL_NOT_REQUIRED +# define AIS_CRM_UTILS__H + +# include + +# ifdef AIS_WHITETANK +# include +# include + +# define OPENAIS_EXTERNAL_SERVICE insane_ais_header_hack_in__totem_h +# include +# include +# include +# include +# include +# include +# include +# define COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED OPENAIS_FLOW_CONTROL_NOT_REQUIRED /* New names for old things */ typedef unsigned int hdb_handle_t; -#define corosync_api_v1 objdb_iface_ver0 -#define corosync_lib_handler openais_lib_handler -#define corosync_exec_handler openais_exec_handler -#define corosync_service_engine openais_service_handler -extern int openais_response_send (void *conn, void *msg, int mlen); -extern int openais_dispatch_send (void *conn, void *msg, int mlen); +# define corosync_api_v1 objdb_iface_ver0 +# define corosync_lib_handler openais_lib_handler +# define corosync_exec_handler openais_exec_handler +# define corosync_service_engine openais_service_handler -#endif +extern int openais_response_send(void *conn, void *msg, int mlen); +extern int openais_dispatch_send(void *conn, void *msg, int mlen); -#ifdef SUPPORT_COROSYNC -# include -# include -# include -# include +# endif -# include -# include -# include +# ifdef SUPPORT_COROSYNC +# include +# include +# include +# include -# include +# include +# include +# include + +# include LOGSYS_DECLARE_SUBSYS("pcmk"); -#endif +# endif /* #include "plugin.h" */ -#define SIZEOF(a) (sizeof(a) / sizeof(a[0])) +# define SIZEOF(a) (sizeof(a) / sizeof(a[0])) typedef struct crm_child_s { - int pid; - long flag; - long flags; - int start_seq; - int respawn_count; - gboolean respawn; - const char *name; - const char *uid; - const char *command; - void *conn; - void *async_conn; - + int pid; + long flag; + long flags; + int start_seq; + int respawn_count; + gboolean respawn; + const char *name; + const char *uid; + const char *command; + void *conn; + void *async_conn; + } crm_child_t; extern void destroy_ais_node(gpointer data); extern void delete_member(uint32_t id, const char *uname); -extern int update_member( - unsigned int id, uint64_t born, uint64_t seq, int32_t votes, - uint32_t procs, const char *uname, const char *state, const char *version); +extern int update_member(unsigned int id, uint64_t born, uint64_t seq, int32_t votes, + uint32_t procs, const char *uname, const char *state, const char *version); extern const char *member_uname(uint32_t id); -extern char *append_member(char *data, crm_node_t *node); +extern char *append_member(char *data, crm_node_t * node); extern void member_loop_fn(gpointer key, gpointer value, gpointer user_data); -extern gboolean stop_child(crm_child_t *child, int signal); -extern gboolean spawn_child(crm_child_t *child); +extern gboolean stop_child(crm_child_t * child, int signal); +extern gboolean spawn_child(crm_child_t * child); -extern void swap_sender(AIS_Message *msg); -extern char *get_ais_data(const AIS_Message *msg); +extern void swap_sender(AIS_Message * msg); +extern char *get_ais_data(const AIS_Message * msg); -extern gboolean route_ais_message(const AIS_Message *msg, gboolean local); -extern gboolean process_ais_message(const AIS_Message *msg); +extern gboolean route_ais_message(const AIS_Message * msg, gboolean local); +extern gboolean process_ais_message(const AIS_Message * msg); -extern int send_cluster_msg( - enum crm_ais_msg_types type, const char *host, const char *data); +extern int send_cluster_msg(enum crm_ais_msg_types type, const char *host, const char *data); extern int send_client_msg(void *conn, enum crm_ais_msg_class class, - enum crm_ais_msg_types type, const char *data); + enum crm_ais_msg_types type, const char *data); extern void send_member_notification(void); -extern void log_ais_message(int level, const AIS_Message *msg); +extern void log_ais_message(int level, const AIS_Message * msg); extern hdb_handle_t config_find_init(struct corosync_api_v1 *config, char *name); -extern hdb_handle_t config_find_next(struct corosync_api_v1 *config, char *name, hdb_handle_t top_handle); +extern hdb_handle_t config_find_next(struct corosync_api_v1 *config, char *name, + hdb_handle_t top_handle); extern void config_find_done(struct corosync_api_v1 *config, hdb_handle_t local_handle); extern int get_config_opt(struct corosync_api_v1 *config, - hdb_handle_t object_service_handle, - char *key, char **value, const char *fallback); + hdb_handle_t object_service_handle, + char *key, char **value, const char *fallback); extern int ais_get_boolean(const char *s); extern long long ais_get_int(const char *text, char **end_text); extern char *ais_concat(const char *prefix, const char *suffix, char join); -extern int send_client_ipc(void *conn, const AIS_Message *ais_msg); +extern int send_client_ipc(void *conn, const AIS_Message * ais_msg); extern GHashTable *membership_list; extern pthread_t crm_wait_thread; extern int plugin_log_level; extern char *local_uname; extern int local_uname_len; extern unsigned int local_nodeid; -static inline const char *level2char(int level) +static inline const char * +level2char(int level) { - switch(level) { - case LOG_CRIT: return "CRIT"; - case LOG_ERR: return "ERROR"; - case LOG_WARNING: return "WARN"; - case LOG_NOTICE: return "notice"; - case LOG_INFO: return "info"; + switch (level) { + case LOG_CRIT: + return "CRIT"; + case LOG_ERR: + return "ERROR"; + case LOG_WARNING: + return "WARN"; + case LOG_NOTICE: + return "notice"; + case LOG_INFO: + return "info"; } return "debug"; } -#define do_ais_log(level, fmt, args...) do { \ +# define do_ais_log(level, fmt, args...) do { \ if(plugin_log_level < (level)) { \ continue; \ } else if((level) > LOG_DEBUG) { \ log_printf(LOG_DEBUG, "debug%d: %s: " fmt, \ level-LOG_INFO, __PRETTY_FUNCTION__ , ##args); \ } else { \ log_printf(level, "%s: %s: " fmt, level2char(level), \ __PRETTY_FUNCTION__ , ##args); \ } \ } while(0) -#define ais_perror(fmt, args...) log_printf( \ +# define ais_perror(fmt, args...) log_printf( \ LOG_ERR, "%s: " fmt ": (%d) %s", \ __PRETTY_FUNCTION__ , ##args, errno, strerror(errno)) -#define ais_crit(fmt, args...) do_ais_log(LOG_CRIT, fmt , ##args) -#define ais_err(fmt, args...) do_ais_log(LOG_ERR, fmt , ##args) -#define ais_warn(fmt, args...) do_ais_log(LOG_WARNING, fmt , ##args) -#define ais_notice(fmt, args...) do_ais_log(LOG_NOTICE, fmt , ##args) -#define ais_info(fmt, args...) do_ais_log(LOG_INFO, fmt , ##args) -#define ais_debug(fmt, args...) do_ais_log(LOG_DEBUG, fmt , ##args) -#define ais_debug_2(fmt, args...) do_ais_log(LOG_DEBUG+1, fmt , ##args) -#define ais_debug_3(fmt, args...) do_ais_log(LOG_DEBUG+2, fmt , ##args) -#define ais_debug_4(fmt, args...) do_ais_log(LOG_DEBUG+3, fmt , ##args) -#define ais_debug_5(fmt, args...) do_ais_log(LOG_DEBUG+4, fmt , ##args) -#define ais_debug_6(fmt, args...) do_ais_log(LOG_DEBUG+5, fmt , ##args) - -#define ais_malloc0(malloc_obj, length) do { \ +# define ais_crit(fmt, args...) do_ais_log(LOG_CRIT, fmt , ##args) +# define ais_err(fmt, args...) do_ais_log(LOG_ERR, fmt , ##args) +# define ais_warn(fmt, args...) do_ais_log(LOG_WARNING, fmt , ##args) +# define ais_notice(fmt, args...) do_ais_log(LOG_NOTICE, fmt , ##args) +# define ais_info(fmt, args...) do_ais_log(LOG_INFO, fmt , ##args) +# define ais_debug(fmt, args...) do_ais_log(LOG_DEBUG, fmt , ##args) +# define ais_debug_2(fmt, args...) do_ais_log(LOG_DEBUG+1, fmt , ##args) +# define ais_debug_3(fmt, args...) do_ais_log(LOG_DEBUG+2, fmt , ##args) +# define ais_debug_4(fmt, args...) do_ais_log(LOG_DEBUG+3, fmt , ##args) +# define ais_debug_5(fmt, args...) do_ais_log(LOG_DEBUG+4, fmt , ##args) +# define ais_debug_6(fmt, args...) do_ais_log(LOG_DEBUG+5, fmt , ##args) + +# define ais_malloc0(malloc_obj, length) do { \ malloc_obj = malloc(length); \ if(malloc_obj == NULL) { \ abort(); \ } \ memset(malloc_obj, 0, length); \ } while(0) -#define ais_free(obj) do { \ +# define ais_free(obj) do { \ if(obj) { \ free(obj); \ obj = NULL; \ } \ } while(0) -#define AIS_ASSERT(expr) if((expr) == FALSE) { \ +# define AIS_ASSERT(expr) if((expr) == FALSE) { \ ais_crit("Assertion failure line %d: %s", __LINE__, #expr); \ abort(); \ } -#define AIS_CHECK(expr, failure_action) if((expr) == FALSE) { \ +# define AIS_CHECK(expr, failure_action) if((expr) == FALSE) { \ int p = fork(); \ if(p == 0) { abort(); } \ ais_err("Child %d spawned to record non-fatal assertion failure line %d: %s", p, __LINE__, #expr); \ failure_action; \ } -static inline char *ais_strdup(const char *src) +static inline char * +ais_strdup(const char *src) { - char *dup = NULL; - if(src == NULL) { - return NULL; - } - ais_malloc0(dup, strlen(src) + 1); - return strcpy(dup, src); + char *dup = NULL; + + if (src == NULL) { + return NULL; + } + ais_malloc0(dup, strlen(src) + 1); + return strcpy(dup, src); } -static inline gboolean ais_str_eq(const char *a, const char *b) +static inline gboolean +ais_str_eq(const char *a, const char *b) { - if(a == NULL || b == NULL) { - return FALSE; - - } else if(a == b) { - return TRUE; - - } else if(strcasecmp(a, b) == 0) { - return TRUE; + if (a == NULL || b == NULL) { + return FALSE; + + } else if (a == b) { + return TRUE; + + } else if (strcasecmp(a, b) == 0) { + return TRUE; } return FALSE; } -static inline int libais_connection_active(void *conn) { - if(conn != NULL) { return TRUE; } +static inline int +libais_connection_active(void *conn) +{ + if (conn != NULL) { + return TRUE; + } return FALSE; } -struct pcmk_env_s -{ - const char *debug; - const char *syslog; - const char *logfile; - const char *use_logd; - const char *quorum; +struct pcmk_env_s { + const char *debug; + const char *syslog; + const char *logfile; + const char *use_logd; + const char *quorum; }; extern struct pcmk_env_s pcmk_env; -extern int pcmk_user_lookup(const char *name, uid_t *uid, gid_t *gid); +extern int pcmk_user_lookup(const char *name, uid_t * uid, gid_t * gid); #endif diff --git a/lib/cib/cib_private.h b/lib/cib/cib_private.h index b8d9850ead..7626a312cd 100644 --- a/lib/cib/cib_private.h +++ b/lib/cib/cib_private.h @@ -1,79 +1,78 @@ /* * Copyright (C) 2004 Andrew Beekhof * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser 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 library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef CIB_PRIVATE__H -#define CIB_PRIVATE__H +# define CIB_PRIVATE__H -#include +# include extern GHashTable *cib_op_callback_table; -typedef struct cib_notify_client_s -{ - const char *event; - const char *obj_id; /* implement one day */ - const char *obj_type; /* implement one day */ - void (*callback)(const char *event, xmlNode *msg); - +typedef struct cib_notify_client_s { + const char *event; + const char *obj_id; /* implement one day */ + const char *obj_type; /* implement one day */ + void (*callback) (const char *event, xmlNode * msg); + } cib_notify_client_t; -typedef struct cib_callback_client_s -{ - void (*callback)(xmlNode*, int, int, xmlNode*, void*); - const char *id; - void *user_data; - gboolean only_success; - struct timer_rec_s *timer; - +typedef struct cib_callback_client_s { + void (*callback) (xmlNode *, int, int, xmlNode *, void *); + const char *id; + void *user_data; + gboolean only_success; + struct timer_rec_s *timer; + } cib_callback_client_t; -struct timer_rec_s -{ - int call_id; - int timeout; - guint ref; - cib_t *cib; +struct timer_rec_s { + int call_id; + int timeout; + guint ref; + cib_t *cib; }; -typedef enum cib_errors (*cib_op_t)(const char *, int, const char *, xmlNode *, - xmlNode*, xmlNode*, xmlNode**, xmlNode**); +typedef enum cib_errors (*cib_op_t) (const char *, int, const char *, xmlNode *, + xmlNode *, xmlNode *, xmlNode **, xmlNode **); extern cib_t *cib_new_variant(void); enum cib_errors -cib_perform_op(const char *op, int call_options, cib_op_t *fn, gboolean is_query, - const char *section, xmlNode *req, xmlNode *input, - gboolean manage_counters, gboolean *config_changed, - xmlNode *current_cib, xmlNode **result_cib, xmlNode **diff, xmlNode **output); -extern xmlNode *cib_create_op( - int call_id, const char *token, const char *op, const char *host, - const char *section, xmlNode *data, int call_options, const char *user_name); +cib_perform_op(const char *op, int call_options, cib_op_t * fn, gboolean is_query, + const char *section, xmlNode * req, xmlNode * input, + gboolean manage_counters, gboolean * config_changed, + xmlNode * current_cib, xmlNode ** result_cib, xmlNode ** diff, xmlNode ** output); -extern int get_channel_token(IPC_Channel *ch, char **token); -void cib_native_callback(cib_t *cib, xmlNode *msg, int call_id, int rc); -void cib_native_notify(gpointer data, gpointer user_data); -int cib_native_register_notification(cib_t* cib, const char *callback, int enabled); -gboolean cib_client_register_callback( - cib_t *cib, int call_id, int timeout, gboolean only_success, void *user_data, - const char *callback_name, void (*callback)(xmlNode*, int, int, xmlNode*,void*)); +extern xmlNode *cib_create_op(int call_id, const char *token, const char *op, const char *host, + const char *section, xmlNode * data, int call_options, + const char *user_name); -extern gboolean acl_enabled(GHashTable *config_hash); -extern gboolean acl_filter_cib(xmlNode *request, xmlNode *current_cib, xmlNode *orig_cib, xmlNode **filtered_cib); -extern gboolean acl_check_diff(xmlNode *request, xmlNode *current_cib, xmlNode *result_cib, xmlNode *diff); +extern int get_channel_token(IPC_Channel * ch, char **token); +void cib_native_callback(cib_t * cib, xmlNode * msg, int call_id, int rc); +void cib_native_notify(gpointer data, gpointer user_data); +int cib_native_register_notification(cib_t * cib, const char *callback, int enabled); +gboolean cib_client_register_callback(cib_t * cib, int call_id, int timeout, gboolean only_success, + void *user_data, const char *callback_name, + void (*callback) (xmlNode *, int, int, xmlNode *, void *)); +extern gboolean acl_enabled(GHashTable * config_hash); +extern gboolean acl_filter_cib(xmlNode * request, xmlNode * current_cib, xmlNode * orig_cib, + xmlNode ** filtered_cib); +extern gboolean acl_check_diff(xmlNode * request, xmlNode * current_cib, xmlNode * result_cib, + xmlNode * diff); #endif diff --git a/lib/common/stack.h b/lib/common/stack.h index 44fb489637..58b7bb4483 100644 --- a/lib/common/stack.h +++ b/lib/common/stack.h @@ -1,64 +1,61 @@ /* * Copyright (C) 2004 Andrew Beekhof * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser 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 library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef CRM_STACK__H -#define CRM_STACK__H +# define CRM_STACK__H -#include +# include -#if SUPPORT_HEARTBEAT +# if SUPPORT_HEARTBEAT extern ll_cluster_t *heartbeat_cluster; -extern gboolean send_ha_message(ll_cluster_t *hb_conn, xmlNode *msg, - const char *node, gboolean force_ordered); -extern gboolean ha_msg_dispatch(ll_cluster_t *cluster_conn, gpointer user_data); +extern gboolean send_ha_message(ll_cluster_t * hb_conn, xmlNode * msg, + const char *node, gboolean force_ordered); +extern gboolean ha_msg_dispatch(ll_cluster_t * cluster_conn, gpointer user_data); -extern gboolean register_heartbeat_conn( - ll_cluster_t *hb_cluster, char **uuid, char **uname, - void (*hb_message)(HA_Message *msg, void* private_data), - void (*hb_destroy)(gpointer user_data)); +extern gboolean register_heartbeat_conn(ll_cluster_t * hb_cluster, char **uuid, char **uname, + void (*hb_message) (HA_Message * msg, void *private_data), + void (*hb_destroy) (gpointer user_data)); -#endif +# endif -#if SUPPORT_COROSYNC +# if SUPPORT_COROSYNC -extern gboolean send_ais_message( - xmlNode *msg, gboolean local, - const char *node, enum crm_ais_msg_types dest); +extern gboolean send_ais_message(xmlNode * msg, gboolean local, + const char *node, enum crm_ais_msg_types dest); extern enum cluster_type_e find_corosync_variant(void); extern void terminate_ais_connection(void); -extern gboolean init_ais_connection( - gboolean (*dispatch)(AIS_Message*,char*,int), - void (*destroy)(gpointer), char **our_uuid, char **our_uname, int *nodeid); -extern gboolean init_ais_connection_once( - gboolean (*dispatch)(AIS_Message*,char*,int), - void (*destroy)(gpointer), char **our_uuid, char **our_uname, int *nodeid); +extern gboolean init_ais_connection(gboolean(*dispatch) (AIS_Message *, char *, int), + void (*destroy) (gpointer), char **our_uuid, char **our_uname, + int *nodeid); +extern gboolean init_ais_connection_once(gboolean(*dispatch) (AIS_Message *, char *, int), + void (*destroy) (gpointer), char **our_uuid, + char **our_uname, int *nodeid); -#endif +# endif -enum crm_quorum_source -{ +enum crm_quorum_source { crm_quorum_cman, crm_quorum_corosync, crm_quorum_pacemaker, }; extern enum crm_quorum_source get_quorum_source(void); #endif diff --git a/lib/pengine/unpack.h b/lib/pengine/unpack.h index acd90c0269..a5447e10b5 100644 --- a/lib/pengine/unpack.h +++ b/lib/pengine/unpack.h @@ -1,96 +1,94 @@ /* * Copyright (C) 2004 Andrew Beekhof * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser 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 library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef PENGINE_UNPACK__H -#define PENGINE_UNPACK__H +# define PENGINE_UNPACK__H -extern gboolean unpack_resources( - xmlNode *xml_resources, pe_working_set_t *data_set); +extern gboolean unpack_resources(xmlNode * xml_resources, pe_working_set_t * data_set); -extern gboolean unpack_config(xmlNode *config, pe_working_set_t *data_set); +extern gboolean unpack_config(xmlNode * config, pe_working_set_t * data_set); -extern gboolean unpack_nodes(xmlNode *xml_nodes, pe_working_set_t *data_set); +extern gboolean unpack_nodes(xmlNode * xml_nodes, pe_working_set_t * data_set); -extern gboolean unpack_domains(xmlNode *xml_domains, pe_working_set_t *data_set); +extern gboolean unpack_domains(xmlNode * xml_domains, pe_working_set_t * data_set); -extern gboolean unpack_status(xmlNode *status, pe_working_set_t *data_set); +extern gboolean unpack_status(xmlNode * status, pe_working_set_t * data_set); extern gint sort_op_by_callid(gconstpointer a, gconstpointer b); -extern gboolean unpack_lrm_resources( - node_t *node, xmlNode * lrm_state, pe_working_set_t *data_set); +extern gboolean unpack_lrm_resources(node_t * node, xmlNode * lrm_state, + pe_working_set_t * data_set); -extern gboolean add_node_attrs( - xmlNode * attrs, node_t *node, gboolean overwrite, pe_working_set_t *data_set); +extern gboolean add_node_attrs(xmlNode * attrs, node_t * node, gboolean overwrite, + pe_working_set_t * data_set); -extern gboolean determine_online_status( - xmlNode * node_state, node_t *this_node, pe_working_set_t *data_set); +extern gboolean determine_online_status(xmlNode * node_state, node_t * this_node, + pe_working_set_t * data_set); -extern const char *param_value( - GHashTable *hash, xmlNode * parent, const char *name); +extern const char *param_value(GHashTable * hash, xmlNode * parent, const char *name); extern char *clone_zero(const char *last_rsc_id); extern char *increment_clone(char *last_rsc_id); /* * The man pages for both curses and ncurses suggest inclusion of "curses.h". * We believe the following to be acceptable and portable. */ -#if defined(HAVE_LIBNCURSES) || defined(HAVE_LIBCURSES) -# if defined(HAVE_NCURSES_H) && !defined(HAVE_INCOMPATIBLE_PRINTW) -# include -# define CURSES_ENABLED 1 -# elif defined(HAVE_NCURSES_NCURSES_H) && !defined(HAVE_INCOMPATIBLE_PRINTW) -# include -# define CURSES_ENABLED 1 -# elif defined(HAVE_CURSES_H) && !defined(HAVE_INCOMPATIBLE_PRINTW) -# include -# define CURSES_ENABLED 1 -# elif defined(HAVE_CURSES_CURSES_H) && !defined(HAVE_INCOMPATIBLE_PRINTW) -# include -# define CURSES_ENABLED 1 +# if defined(HAVE_LIBNCURSES) || defined(HAVE_LIBCURSES) +# if defined(HAVE_NCURSES_H) && !defined(HAVE_INCOMPATIBLE_PRINTW) +# include +# define CURSES_ENABLED 1 +# elif defined(HAVE_NCURSES_NCURSES_H) && !defined(HAVE_INCOMPATIBLE_PRINTW) +# include +# define CURSES_ENABLED 1 +# elif defined(HAVE_CURSES_H) && !defined(HAVE_INCOMPATIBLE_PRINTW) +# include +# define CURSES_ENABLED 1 +# elif defined(HAVE_CURSES_CURSES_H) && !defined(HAVE_INCOMPATIBLE_PRINTW) +# include +# define CURSES_ENABLED 1 +# else +# define CURSES_ENABLED 0 +# endif # else # define CURSES_ENABLED 0 # endif -#else -# define CURSES_ENABLED 0 -#endif -#if CURSES_ENABLED -# define status_printw(fmt, args...) printw(fmt, ##args) -#else -# define status_printw(fmt, args...) \ +# if CURSES_ENABLED +# define status_printw(fmt, args...) printw(fmt, ##args) +# else +# define status_printw(fmt, args...) \ crm_err("printw support requires ncurses to be available during configure"); \ do_crm_log(LOG_WARNING, fmt, ##args); -#endif +# endif -#define status_print(fmt, args...) \ +# define status_print(fmt, args...) \ if(options & pe_print_html) { \ FILE *stream = print_data; \ fprintf(stream, fmt, ##args); \ } else if(options & pe_print_ncurses) { \ status_printw(fmt, ##args); \ } else if(options & pe_print_printf) { \ FILE *stream = print_data; \ fprintf(stream, fmt, ##args); \ } else if(options & pe_print_log) { \ int log_level = *(int*)print_data; \ do_crm_log(log_level, fmt, ##args); \ } #endif diff --git a/lib/pengine/utils.h b/lib/pengine/utils.h index 5c2c3eaa6e..488a6df825 100644 --- a/lib/pengine/utils.h +++ b/lib/pengine/utils.h @@ -1,163 +1,165 @@ /* * Copyright (C) 2004 Andrew Beekhof * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser 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 library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef PE_UTILS__H -#define PE_UTILS__H -#include -#include +# define PE_UTILS__H +# include +# include extern pe_working_set_t *pe_dataset; -extern node_t *node_copy(node_t *this_node) ; -extern time_t get_timet_now(pe_working_set_t *data_set); -extern int get_failcount(node_t *node, resource_t *rsc, int *last_failure, pe_working_set_t *data_set); +extern node_t *node_copy(node_t * this_node); +extern time_t get_timet_now(pe_working_set_t * data_set); +extern int get_failcount(node_t * node, resource_t * rsc, int *last_failure, + pe_working_set_t * data_set); /* Binary like operators for lists of nodes */ -extern void node_list_exclude(GHashTable *list, GListPtr list2, gboolean merge_scores); +extern void node_list_exclude(GHashTable * list, GListPtr list2, gboolean merge_scores); extern GListPtr node_list_dup(GListPtr list, gboolean reset, gboolean filter); -extern GListPtr node_list_from_hash(GHashTable *hash, gboolean reset, gboolean filter); +extern GListPtr node_list_from_hash(GHashTable * hash, gboolean reset, gboolean filter); extern GHashTable *node_hash_from_list(GListPtr list); -static inline gpointer pe_hash_table_lookup(GHashTable *hash, gconstpointer key) +static inline gpointer +pe_hash_table_lookup(GHashTable * hash, gconstpointer key) { - if(hash) { - return g_hash_table_lookup(hash, key); + if (hash) { + return g_hash_table_lookup(hash, key); } return NULL; -} +} extern GListPtr node_list_and(GListPtr list1, GListPtr list2, gboolean filter); extern GListPtr node_list_xor(GListPtr list1, GListPtr list2, gboolean filter); -extern GListPtr node_list_minus(GListPtr list1,GListPtr list2,gboolean filter); +extern GListPtr node_list_minus(GListPtr list1, GListPtr list2, gboolean filter); extern void pe_free_shallow(GListPtr alist); extern void pe_free_shallow_adv(GListPtr alist, gboolean with_data); /* For creating the transition graph */ -extern xmlNode *action2xml(action_t *action, gboolean as_input); +extern xmlNode *action2xml(action_t * action, gboolean as_input); /* Printing functions for debug */ -extern void print_node( - const char *pre_text, node_t *node, gboolean details); +extern void print_node(const char *pre_text, node_t * node, gboolean details); -extern void print_resource( - int log_level, const char *pre_text, resource_t *rsc, gboolean details); +extern void print_resource(int log_level, const char *pre_text, resource_t * rsc, gboolean details); extern void dump_node_scores_worker(int level, const char *file, const char *function, int line, - resource_t *rsc, const char *comment, GHashTable *nodes); + resource_t * rsc, const char *comment, GHashTable * nodes); -extern void dump_node_capacity(int level, const char *comment, node_t *node); -extern void dump_rsc_utilization(int level, const char *comment, resource_t *rsc, node_t *node); +extern void dump_node_capacity(int level, const char *comment, node_t * node); +extern void dump_rsc_utilization(int level, const char *comment, resource_t * rsc, node_t * node); -#if SUPPORT_TRACING -# define dump_node_scores(level, rsc, text, nodes) do { \ +# if SUPPORT_TRACING +# define dump_node_scores(level, rsc, text, nodes) do { \ static struct _pcmk_ddebug descriptor \ __attribute__((section("__verbose"), aligned(8))) = \ { __func__, __FILE__, "node-scores", __LINE__, LOG_TRACE }; \ \ if((level) == 0 || __unlikely((level) < crm_log_level)) { \ dump_node_scores_worker(level, __FILE__, NULL, 0, rsc, text, nodes); \ \ } else if(__unlikely(descriptor.bump != LOG_TRACE)) { \ dump_node_scores_worker(LOG_NOTICE, __FILE__, __PRETTY_FUNCTION__, __LINE__, rsc, text, nodes); \ } \ } while(0) -#else -# define dump_node_scores(level, rsc, text, nodes) do { \ +# else +# define dump_node_scores(level, rsc, text, nodes) do { \ if((level) == 0 || __unlikely((level) < crm_log_level)) { \ dump_node_scores_worker(level, __FILE__, NULL, 0, rsc, text, nodes); \ } \ } while(0) -#endif +# endif /* Sorting functions */ extern gint sort_rsc_priority(gconstpointer a, gconstpointer b); extern gint sort_rsc_index(gconstpointer a, gconstpointer b); -extern xmlNode *find_rsc_op_entry(resource_t *rsc, const char *key); +extern xmlNode *find_rsc_op_entry(resource_t * rsc, const char *key); -extern action_t *custom_action( - resource_t *rsc, char *key, const char *task, node_t *on_node, - gboolean optional, gboolean foo, pe_working_set_t *data_set); +extern action_t *custom_action(resource_t * rsc, char *key, const char *task, node_t * on_node, + gboolean optional, gboolean foo, pe_working_set_t * data_set); -#define delete_key(rsc) generate_op_key(rsc->id, CRMD_ACTION_DELETE, 0) -#define delete_action(rsc, node, optional) custom_action( \ +# define delete_key(rsc) generate_op_key(rsc->id, CRMD_ACTION_DELETE, 0) +# define delete_action(rsc, node, optional) custom_action( \ rsc, delete_key(rsc), CRMD_ACTION_DELETE, node, \ optional, TRUE, data_set); -#define stopped_key(rsc) generate_op_key(rsc->id, CRMD_ACTION_STOPPED, 0) -#define stopped_action(rsc, node, optional) custom_action( \ +# define stopped_key(rsc) generate_op_key(rsc->id, CRMD_ACTION_STOPPED, 0) +# define stopped_action(rsc, node, optional) custom_action( \ rsc, stopped_key(rsc), CRMD_ACTION_STOPPED, node, \ optional, TRUE, data_set); -#define stop_key(rsc) generate_op_key(rsc->id, CRMD_ACTION_STOP, 0) -#define stop_action(rsc, node, optional) custom_action( \ +# define stop_key(rsc) generate_op_key(rsc->id, CRMD_ACTION_STOP, 0) +# define stop_action(rsc, node, optional) custom_action( \ rsc, stop_key(rsc), CRMD_ACTION_STOP, node, \ optional, TRUE, data_set); -#define start_key(rsc) generate_op_key(rsc->id, CRMD_ACTION_START, 0) -#define start_action(rsc, node, optional) custom_action( \ +# define start_key(rsc) generate_op_key(rsc->id, CRMD_ACTION_START, 0) +# define start_action(rsc, node, optional) custom_action( \ rsc, start_key(rsc), CRMD_ACTION_START, node, \ optional, TRUE, data_set) -#define started_key(rsc) generate_op_key(rsc->id, CRMD_ACTION_STARTED, 0) -#define started_action(rsc, node, optional) custom_action( \ +# define started_key(rsc) generate_op_key(rsc->id, CRMD_ACTION_STARTED, 0) +# define started_action(rsc, node, optional) custom_action( \ rsc, started_key(rsc), CRMD_ACTION_STARTED, node, \ optional, TRUE, data_set) -#define promote_key(rsc) generate_op_key(rsc->id, CRMD_ACTION_PROMOTE, 0) -#define promote_action(rsc, node, optional) custom_action( \ +# define promote_key(rsc) generate_op_key(rsc->id, CRMD_ACTION_PROMOTE, 0) +# define promote_action(rsc, node, optional) custom_action( \ rsc, promote_key(rsc), CRMD_ACTION_PROMOTE, node, \ optional, TRUE, data_set) -#define promoted_key(rsc) generate_op_key(rsc->id, CRMD_ACTION_PROMOTED, 0) -#define promoted_action(rsc, node, optional) custom_action( \ +# define promoted_key(rsc) generate_op_key(rsc->id, CRMD_ACTION_PROMOTED, 0) +# define promoted_action(rsc, node, optional) custom_action( \ rsc, promoted_key(rsc), CRMD_ACTION_PROMOTED, node, \ optional, TRUE, data_set) -#define demote_key(rsc) generate_op_key(rsc->id, CRMD_ACTION_DEMOTE, 0) -#define demote_action(rsc, node, optional) custom_action( \ +# define demote_key(rsc) generate_op_key(rsc->id, CRMD_ACTION_DEMOTE, 0) +# define demote_action(rsc, node, optional) custom_action( \ rsc, demote_key(rsc), CRMD_ACTION_DEMOTE, node, \ optional, TRUE, data_set) -#define demoted_key(rsc) generate_op_key(rsc->id, CRMD_ACTION_DEMOTED, 0) -#define demoted_action(rsc, node, optional) custom_action( \ +# define demoted_key(rsc) generate_op_key(rsc->id, CRMD_ACTION_DEMOTED, 0) +# define demoted_action(rsc, node, optional) custom_action( \ rsc, demoted_key(rsc), CRMD_ACTION_DEMOTED, node, \ optional, TRUE, data_set) -extern action_t *find_first_action(GListPtr input, const char *uuid, const char *task, node_t *on_node); -extern enum action_tasks get_complex_task(resource_t *rsc, const char *name, gboolean allow_non_atomic); +extern action_t *find_first_action(GListPtr input, const char *uuid, const char *task, + node_t * on_node); +extern enum action_tasks get_complex_task(resource_t * rsc, const char *name, + gboolean allow_non_atomic); -extern GListPtr find_actions(GListPtr input, const char *key, node_t *on_node); -extern GListPtr find_actions_exact( - GListPtr input, const char *key, node_t *on_node); -extern GListPtr find_recurring_actions(GListPtr input, node_t *not_on_node); +extern GListPtr find_actions(GListPtr input, const char *key, node_t * on_node); +extern GListPtr find_actions_exact(GListPtr input, const char *key, node_t * on_node); +extern GListPtr find_recurring_actions(GListPtr input, node_t * not_on_node); -extern void pe_free_action(action_t *action); +extern void pe_free_action(action_t * action); extern void -resource_location(resource_t *rsc, node_t *node, int score, const char *tag, - pe_working_set_t *data_set); + +resource_location(resource_t * rsc, node_t * node, int score, const char *tag, + pe_working_set_t * data_set); extern gint sort_op_by_callid(gconstpointer a, gconstpointer b); -extern gboolean get_target_role(resource_t *rsc, enum rsc_role_e *role); +extern gboolean get_target_role(resource_t * rsc, enum rsc_role_e *role); -extern resource_t *find_clone_instance(resource_t *rsc, const char *sub_id, pe_working_set_t *data_set); +extern resource_t *find_clone_instance(resource_t * rsc, const char *sub_id, + pe_working_set_t * data_set); #endif diff --git a/lib/pengine/variant.h b/lib/pengine/variant.h index ec83487fad..3839a2b138 100644 --- a/lib/pengine/variant.h +++ b/lib/pengine/variant.h @@ -1,96 +1,96 @@ /* * Copyright (C) 2004 Andrew Beekhof * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser 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 library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef PE_VARIANT__H -#define PE_VARIANT__H +# define PE_VARIANT__H -#if VARIANT_CLONE +# if VARIANT_CLONE typedef struct clone_variant_data_s { - resource_t *self; - - int clone_max; - int clone_node_max; - - int master_max; - int master_node_max; - - int total_clones; - int active_clones; - int max_nodes; - - int masters_active; - int masters_allocated; - - gboolean interleave; - gboolean ordered; - gboolean applied_master_prefs; - gboolean merged_master_weights; - - notify_data_t *stop_notify; - notify_data_t *start_notify; - notify_data_t *demote_notify; - notify_data_t *promote_notify; - - xmlNode *xml_obj_child; - - gboolean notify_confirm; - + resource_t *self; + + int clone_max; + int clone_node_max; + + int master_max; + int master_node_max; + + int total_clones; + int active_clones; + int max_nodes; + + int masters_active; + int masters_allocated; + + gboolean interleave; + gboolean ordered; + gboolean applied_master_prefs; + gboolean merged_master_weights; + + notify_data_t *stop_notify; + notify_data_t *start_notify; + notify_data_t *demote_notify; + notify_data_t *promote_notify; + + xmlNode *xml_obj_child; + + gboolean notify_confirm; + } clone_variant_data_t; -# define get_clone_variant_data(data, rsc) \ +# define get_clone_variant_data(data, rsc) \ CRM_ASSERT(rsc != NULL); \ CRM_ASSERT(rsc->variant == pe_clone || rsc->variant == pe_master); \ data = (clone_variant_data_t *)rsc->variant_opaque; -#elif VARIANT_GROUP +# elif VARIANT_GROUP typedef struct group_variant_data_s { - int num_children; - resource_t *self; - resource_t *first_child; - resource_t *last_child; - - gboolean colocated; - gboolean ordered; - - gboolean child_starting; - gboolean child_stopping; - + int num_children; + resource_t *self; + resource_t *first_child; + resource_t *last_child; + + gboolean colocated; + gboolean ordered; + + gboolean child_starting; + gboolean child_stopping; + } group_variant_data_t; -# define get_group_variant_data(data, rsc) \ +# define get_group_variant_data(data, rsc) \ CRM_ASSERT(rsc != NULL); \ CRM_ASSERT(rsc->variant == pe_group); \ CRM_ASSERT(rsc->variant_opaque != NULL); \ data = (group_variant_data_t *)rsc->variant_opaque; \ -#elif VARIANT_NATIVE +# elif VARIANT_NATIVE typedef struct native_variant_data_s { - int dummy; + int dummy; } native_variant_data_t; -# define get_native_variant_data(data, rsc) \ +# define get_native_variant_data(data, rsc) \ CRM_ASSERT(rsc != NULL); \ CRM_ASSERT(rsc->variant == pe_native); \ CRM_ASSERT(rsc->variant_opaque != NULL); \ data = (native_variant_data_t *)rsc->variant_opaque; -#endif +# endif #endif diff --git a/mcp/corosync.c b/mcp/corosync.c index 0163f229e9..2b0969ca7f 100644 --- a/mcp/corosync.c +++ b/mcp/corosync.c @@ -1,599 +1,599 @@ /* * Copyright (C) 2010 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 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include #include #include #include /* for calls to stat() */ #include /* For basename() and dirname() */ #include #include /* For getpwname() */ #include #include #include #include #ifdef SUPPORT_CMAN # include #endif static struct cpg_name cpg_group = { .length = 0, .value[0] = 0, }; gboolean use_cman = FALSE; static cpg_handle_t cpg_handle; static corosync_cfg_handle_t cfg_handle; static corosync_cfg_state_notification_t cfg_buffer; /* =::=::=::= CFG - Shutdown stuff =::=::=::= */ static void cfg_shutdown_callback(corosync_cfg_handle_t h, corosync_cfg_shutdown_flags_t flags) { crm_info("Corosync wants to shut down: %s", (flags == COROSYNC_CFG_SHUTDOWN_FLAG_IMMEDIATE) ? "immediate" : (flags == COROSYNC_CFG_SHUTDOWN_FLAG_REGARDLESS) ? "forced" : "optional"); /* Never allow corosync to shut down while we're running */ corosync_cfg_replyto_shutdown(h, COROSYNC_CFG_SHUTDOWN_FLAG_NO); } static corosync_cfg_callbacks_t cfg_callbacks = { .corosync_cfg_shutdown_callback = cfg_shutdown_callback, .corosync_cfg_state_track_callback = NULL, }; static gboolean pcmk_cfg_dispatch(int sender, gpointer user_data) { corosync_cfg_handle_t *handle = (corosync_cfg_handle_t *) user_data; cs_error_t rc = corosync_cfg_dispatch(*handle, CS_DISPATCH_ALL); if (rc != CS_OK) { return FALSE; } return TRUE; } static void cfg_connection_destroy(gpointer user_data) { crm_err("Connection destroyed"); cfg_handle = 0; pcmk_shutdown(SIGTERM); return; } gboolean cluster_disconnect_cfg(void) { if (cfg_handle) { corosync_cfg_finalize(cfg_handle); cfg_handle = 0; } pcmk_shutdown(SIGTERM); return TRUE; } #define cs_repeat(counter, max, code) do { \ code; \ if(rc == CS_ERR_TRY_AGAIN) { \ counter++; \ crm_debug("Retrying operation after %ds", counter); \ sleep(counter); \ } \ } while(rc == CS_ERR_TRY_AGAIN && counter < max) gboolean cluster_connect_cfg(uint32_t * nodeid) { cs_error_t rc; int fd = 0, retries = 0; cs_repeat(retries, 30, rc = corosync_cfg_initialize(&cfg_handle, &cfg_callbacks)); if (rc != CS_OK) { crm_err("corosync cfg init error %d", rc); return FALSE; } rc = corosync_cfg_fd_get(cfg_handle, &fd); if (rc != CS_OK) { crm_err("corosync cfg fd_get error %d", rc); goto bail; } retries = 0; cs_repeat(retries, 30, rc = corosync_cfg_local_get(cfg_handle, nodeid)); if (rc != CS_OK) { crm_err("corosync cfg local_get error %d", rc); goto bail; } crm_debug("Our nodeid: %d", *nodeid); retries = 0; cs_repeat(retries, 30, rc = corosync_cfg_state_track(cfg_handle, 0, &cfg_buffer)); if (rc != CS_OK) { crm_err("corosync cfg stack_track error %d", rc); goto bail; } crm_debug("Adding fd=%d to mainloop", fd); G_main_add_fd(G_PRIORITY_HIGH, fd, FALSE, pcmk_cfg_dispatch, &cfg_handle, cfg_connection_destroy); return TRUE; - bail: + bail: corosync_cfg_finalize(cfg_handle); return FALSE; } /* =::=::=::= CPG - Closed Process Group Messaging =::=::=::= */ static gboolean pcmk_cpg_dispatch(int sender, gpointer user_data) { cpg_handle_t *handle = (cpg_handle_t *) user_data; cs_error_t rc = cpg_dispatch(*handle, CS_DISPATCH_ALL); if (rc != CS_OK) { return FALSE; } return TRUE; } static void cpg_connection_destroy(gpointer user_data) { crm_err("Connection destroyed"); cpg_handle = 0; return; } static void pcmk_cpg_deliver(cpg_handle_t handle, const struct cpg_name *groupName, uint32_t nodeid, uint32_t pid, void *msg, size_t msg_len) { if (nodeid != local_nodeid) { uint32_t procs = 0; xmlNode *xml = string2xml(msg); const char *uname = crm_element_value(xml, "uname"); crm_element_value_int(xml, "proclist", (int *)&procs); /* crm_debug("Got proclist %.32x from %s", procs, uname); */ if (update_node_processes(nodeid, uname, procs)) { update_process_clients(); } } } static void pcmk_cpg_membership(cpg_handle_t handle, const struct cpg_name *groupName, const struct cpg_address *member_list, size_t member_list_entries, const struct cpg_address *left_list, size_t left_list_entries, const struct cpg_address *joined_list, size_t joined_list_entries) { /* Don't care about CPG membership */ update_process_peers(); } cpg_callbacks_t cpg_callbacks = { .cpg_deliver_fn = pcmk_cpg_deliver, .cpg_confchg_fn = pcmk_cpg_membership, }; gboolean cluster_disconnect_cpg(void) { if (cpg_handle) { cpg_finalize(cpg_handle); cpg_handle = 0; } return TRUE; } gboolean cluster_connect_cpg(void) { cs_error_t rc; unsigned int nodeid; int fd; int retries = 0; strcpy(cpg_group.value, "pcmk"); cpg_group.length = strlen(cpg_group.value) + 1; retries = 0; cs_repeat(retries, 30, rc = cpg_initialize(&cpg_handle, &cpg_callbacks)); if (rc != CS_OK) { crm_err("corosync cpg init error %d", rc); return FALSE; } rc = cpg_fd_get(cpg_handle, &fd); if (rc != CS_OK) { crm_err("corosync cpg fd_get error %d", rc); goto bail; } retries = 0; cs_repeat(retries, 30, rc = cpg_local_get(cpg_handle, &nodeid)); if (rc != CS_OK) { crm_err("corosync cpg local_get error %d", rc); goto bail; } crm_debug("Our nodeid: %d", nodeid); retries = 0; cs_repeat(retries, 30, rc = cpg_join(cpg_handle, &cpg_group)); if (rc != CS_OK) { crm_err("Could not join the CPG group '%s': %d", crm_system_name, rc); goto bail; } crm_debug("Adding fd=%d to mainloop", fd); G_main_add_fd(G_PRIORITY_HIGH, fd, FALSE, pcmk_cpg_dispatch, &cpg_handle, cpg_connection_destroy); return TRUE; - bail: + bail: cpg_finalize(cpg_handle); return FALSE; } gboolean send_cpg_message(struct iovec * iov) { int rc = CS_OK; int retries = 0; errno = 0; do { rc = cpg_mcast_joined(cpg_handle, CPG_TYPE_AGREED, iov, 1); if (rc == CS_ERR_TRY_AGAIN) { cpg_flow_control_state_t fc_state = CPG_FLOW_CONTROL_DISABLED; int rc2 = cpg_flow_control_state_get(cpg_handle, &fc_state); if (rc2 == CS_OK && fc_state == CPG_FLOW_CONTROL_ENABLED) { crm_debug("Attempting to clear cpg dispatch queue"); rc2 = cpg_dispatch(cpg_handle, CS_DISPATCH_ALL); } if (rc2 != CS_OK) { crm_warn("Could not check/clear the cpg connection"); goto bail; } else { retries++; crm_debug("Retrying operation after %ds", retries); sleep(retries); } } /* 5 retires is plenty, we'll resend once the membership reforms anyway */ } while (rc == CS_ERR_TRY_AGAIN && retries < 5); - bail: + bail: if (rc != CS_OK) { crm_err("Sending message via cpg FAILED: (rc=%d) %s", rc, ais_error2text(rc)); } return (rc == CS_OK); } /* =::=::=::= Configuration =::=::=::= */ static int get_config_opt(confdb_handle_t config, hdb_handle_t object_handle, const char *key, char **value, const char *fallback) { size_t len = 0; char *env_key = NULL; const char *env_value = NULL; char buffer[256]; if (*value) { crm_free(*value); *value = NULL; } if (object_handle > 0) { if (CS_OK == confdb_key_get(config, object_handle, key, strlen(key), &buffer, &len)) { *value = crm_strdup(buffer); } } if (*value) { crm_info("Found '%s' for option: %s", *value, key); return 0; } env_key = crm_concat("HA", key, '_'); env_value = getenv(env_key); crm_free(env_key); if (*value) { crm_info("Found '%s' in ENV for option: %s", *value, key); *value = crm_strdup(env_value); return 0; } if (fallback) { crm_info("Defaulting to '%s' for option: %s", fallback, key); *value = crm_strdup(fallback); } else { crm_info("No default for option: %s", key); } return -1; } static confdb_handle_t config_find_init(confdb_handle_t config) { cs_error_t rc = CS_OK; confdb_handle_t local_handle = OBJECT_PARENT_HANDLE; rc = confdb_object_find_start(config, local_handle); if (rc == CS_OK) { return local_handle; } else { crm_err("Couldn't create search context: %d", rc); } return 0; } static hdb_handle_t config_find_next(confdb_handle_t config, const char *name, confdb_handle_t top_handle) { cs_error_t rc = CS_OK; hdb_handle_t local_handle = 0; if (top_handle == 0) { crm_err("Couldn't search for %s: no valid context", name); return 0; } crm_debug_2("Searching for %s in " HDB_X_FORMAT, name, top_handle); rc = confdb_object_find(config, top_handle, name, strlen(name), &local_handle); if (rc != CS_OK) { crm_info("No additional configuration supplied for: %s", name); local_handle = 0; } else { crm_info("Processing additional %s options...", name); } return local_handle; } char * get_local_node_name(void) { char *name = NULL; struct utsname res; if (use_cman) { #ifdef SUPPORT_CMAN cman_node_t us; cman_handle_t cman; cman = cman_init(NULL); if (cman != NULL && cman_is_active(cman)) { us.cn_name[0] = 0; cman_get_node(cman, CMAN_NODEID_US, &us); name = crm_strdup(us.cn_name); crm_info("Using CMAN node name: %s", name); } else { crm_err("Couldn't determin node name from CMAN"); } cman_finish(cman); #endif } else if (uname(&res) < 0) { crm_perror(LOG_ERR, "Could not determin the current host"); exit(100); } else { name = crm_strdup(res.nodename); } return name; } gboolean read_config(void) { confdb_handle_t config; int rc; char *value = NULL; gboolean have_log = FALSE; confdb_handle_t top_handle = 0; hdb_handle_t local_handle = 0; static confdb_callbacks_t callbacks = { }; enum cluster_type_e stack = get_cluster_type(); crm_info("Reading configure for stack: %s", name_for_cluster_type(stack)); rc = confdb_initialize(&config, &callbacks); if (rc != CS_OK) { printf("Could not initialize Cluster Configuration Database API instance error %d\n", rc); return FALSE; } /* =::=::= Should we be here =::=::= */ if (stack == pcmk_cluster_corosync) { setenv("HA_cluster_type", "corosync", 1); } else if (stack == pcmk_cluster_cman) { setenv("HA_cluster_type", "cman", 1); enable_crmd_as_root(TRUE); use_cman = TRUE; } else if (stack == pcmk_cluster_classic_ais) { setenv("HA_cluster_type", "openais", 1); /* Look for a service block to indicate our plugin is loaded */ top_handle = config_find_init(config); local_handle = config_find_next(config, "service", top_handle); while (local_handle) { crm_free(value); get_config_opt(config, local_handle, "name", &value, NULL); if (safe_str_eq("pacemaker", value)) { crm_free(value); get_config_opt(config, local_handle, "ver", &value, "0"); if (safe_str_eq(value, "1")) { crm_free(value); get_config_opt(config, local_handle, "use_logd", &value, "no"); setenv("HA_use_logd", value, 1); crm_free(value); get_config_opt(config, local_handle, "use_mgmtd", &value, "no"); enable_mgmtd(crm_is_true(value)); } else { crm_err("We can only start Pacemaker from init if using version 1" " of the Pacemaker plugin for Corosync. Terminating."); exit(100); } break; } local_handle = config_find_next(config, "service", top_handle); } crm_free(value); } else { crm_err("Unsupported stack type: %s", name_for_cluster_type(stack)); return FALSE; } /* =::=::= Logging =::=::= */ top_handle = config_find_init(config); local_handle = config_find_next(config, "logging", top_handle); get_config_opt(config, local_handle, "debug", &value, "on"); if (crm_is_true(value) && crm_log_level < LOG_DEBUG) { crm_log_level = LOG_DEBUG; } if (crm_log_level >= LOG_DEBUG) { char *level = crm_itoa(crm_log_level - LOG_INFO); setenv("HA_debug", level, 1); crm_free(level); } get_config_opt(config, local_handle, "to_logfile", &value, "off"); if (crm_is_true(value)) { get_config_opt(config, local_handle, "logfile", &value, NULL); if (value == NULL) { crm_err("Logging to a file requested but no log file specified"); } else { struct stat parent; FILE *logfile = NULL; char *parent_dir = dirname(strdup(value)); struct passwd *pcmk_user = getpwnam(CRM_DAEMON_USER); uid_t pcmk_uid = pcmk_user->pw_uid; uid_t pcmk_gid = getegid(); rc = stat(parent_dir, &parent); if (rc != 0) { crm_err("Directory '%s' does not exist for logfile '%s'", parent_dir, value); } else if (parent.st_uid == pcmk_uid && (parent.st_mode & (S_IRUSR | S_IWUSR))) { /* all good - user */ logfile = fopen(value, "a"); } else if (parent.st_gid == pcmk_gid && (parent.st_mode & S_IXGRP)) { /* all good - group */ logfile = fopen(value, "a"); } else { crm_err ("Daemons running as %s do not have permission to access '%s'. Logging to '%s' is disabled", CRM_DAEMON_USER, parent_dir, value); } if (logfile) { int logfd = fileno(logfile); setenv("HA_debugfile", value, 1); /* Ensure the file has the correct permissions */ fchown(logfd, pcmk_uid, pcmk_gid); fchmod(logfd, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP); fprintf(logfile, "Set r/w permissions for uid=%d, gid=%d on %s\n", pcmk_uid, pcmk_gid, value); fflush(logfile); fsync(logfd); fclose(logfile); have_log = TRUE; } else { crm_err("Couldn't create logfile: %s", value); } crm_free(parent_dir); } } get_config_opt(config, local_handle, "to_syslog", &value, "on"); if (have_log && crm_is_true(value) == FALSE) { crm_info("User configured file based logging and explicitly disabled syslog."); crm_free(value); value = NULL; } else { if (crm_is_true(value) == FALSE) { crm_err ("Please enable some sort of logging, either 'to_file: on' or 'to_syslog: on'."); crm_err("If you use file logging, be sure to also define a value for 'logfile'"); } get_config_opt(config, local_handle, "syslog_facility", &value, "daemon"); } setenv("HA_logfacility", value ? value : "none", 1); setenv("HA_LOGFACILITY", value ? value : "none", 1); confdb_finalize(config); crm_free(value); return TRUE; } diff --git a/mcp/pacemaker.h b/mcp/pacemaker.h index 3e5d948eb3..4b6a815392 100644 --- a/mcp/pacemaker.h +++ b/mcp/pacemaker.h @@ -1,62 +1,61 @@ /* * Copyright (C) 2010 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 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include #include #include #include #include #include #include #define SIZEOF(a) (sizeof(a) / sizeof(a[0])) #define crm_flag_none 0x00000000 #define crm_flag_members 0x00000001 #define MAX_RESPAWN 100 #define PW_BUFFER_LEN 500 extern uint32_t local_nodeid; -typedef struct pcmk_peer_s -{ - uint32_t id; - uint32_t processes; - char *uname; +typedef struct pcmk_peer_s { + uint32_t id; + uint32_t processes; + char *uname; } pcmk_peer_t; extern gboolean read_config(void); -extern gboolean cluster_connect_cfg(uint32_t *nodeid); +extern gboolean cluster_connect_cfg(uint32_t * nodeid); extern gboolean cluster_disconnect_cfg(void); extern gboolean cluster_connect_cpg(void); extern gboolean cluster_disconnect_cpg(void); extern gboolean send_cpg_message(struct iovec *iov); extern void update_process_clients(void); extern void update_process_peers(void); extern gboolean update_node_processes(uint32_t node, const char *uname, uint32_t procs); extern char *get_local_node_name(void); extern void enable_mgmtd(gboolean enable); extern void enable_crmd_as_root(gboolean enable); extern void pcmk_shutdown(int nsig); diff --git a/pengine/allocate.h b/pengine/allocate.h index 154de9af7a..220b7816f6 100644 --- a/pengine/allocate.h +++ b/pengine/allocate.h @@ -1,194 +1,192 @@ /* * 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 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef CRM_PENGINE_COMPLEX_ALLOC__H -#define CRM_PENGINE_COMPLEX_ALLOC__H +# define CRM_PENGINE_COMPLEX_ALLOC__H -#include -#include -#include -#include -#include +# include +# include +# include +# include +# include typedef struct notify_entry_s { - resource_t *rsc; - node_t *node; + resource_t *rsc; + node_t *node; } notify_entry_t; -struct resource_alloc_functions_s -{ - GHashTable *(*merge_weights)(resource_t*, const char*, GHashTable*, const char*, int, gboolean, gboolean); - node_t *(*allocate)(resource_t *, node_t *, pe_working_set_t *); - void (*create_actions)(resource_t *, pe_working_set_t *); - gboolean (*create_probe)( - resource_t *, node_t *, action_t *, gboolean, pe_working_set_t *); - void (*internal_constraints)(resource_t *, pe_working_set_t *); +struct resource_alloc_functions_s { + GHashTable *(*merge_weights) (resource_t *, const char *, GHashTable *, const char *, int, + gboolean, gboolean); + node_t *(*allocate) (resource_t *, node_t *, pe_working_set_t *); + void (*create_actions) (resource_t *, pe_working_set_t *); + gboolean(*create_probe) (resource_t *, node_t *, action_t *, gboolean, pe_working_set_t *); + void (*internal_constraints) (resource_t *, pe_working_set_t *); - void (*rsc_colocation_lh)(resource_t *, resource_t *, rsc_colocation_t *); - void (*rsc_colocation_rh)(resource_t *, resource_t *, rsc_colocation_t *); + void (*rsc_colocation_lh) (resource_t *, resource_t *, rsc_colocation_t *); + void (*rsc_colocation_rh) (resource_t *, resource_t *, rsc_colocation_t *); - void (*rsc_location)(resource_t *, rsc_to_node_t *); + void (*rsc_location) (resource_t *, rsc_to_node_t *); - enum pe_action_flags (*action_flags)(action_t *, node_t*); - enum pe_graph_flags (*update_actions)(action_t *, action_t *, node_t*, enum pe_action_flags, enum pe_action_flags, enum pe_ordering); + enum pe_action_flags (*action_flags) (action_t *, node_t *); + enum pe_graph_flags (*update_actions) (action_t *, action_t *, node_t *, enum pe_action_flags, + enum pe_action_flags, enum pe_ordering); - void (*expand)(resource_t *, pe_working_set_t *); - void (*append_meta)(resource_t *rsc, xmlNode *xml); + void (*expand) (resource_t *, pe_working_set_t *); + void (*append_meta) (resource_t * rsc, xmlNode * xml); }; -extern GHashTable *rsc_merge_weights( - resource_t *rsc, const char *rhs, GHashTable *nodes, const char *attr, int factor, enum pe_weights flags); - -extern GHashTable *native_merge_weights( - resource_t *rsc, const char *rhs, GHashTable *nodes, const char *attr, int factor, gboolean allow_rollback, gboolean only_positive); - -extern GHashTable *group_merge_weights( - resource_t *rsc, const char *rhs, GHashTable *nodes, const char *attr, int factor, gboolean allow_rollback, gboolean only_positive); - -extern node_t * native_color(resource_t *rsc, node_t *preferred, pe_working_set_t *data_set); -extern void native_create_actions( - resource_t *rsc, pe_working_set_t *data_set); -extern void native_internal_constraints( - resource_t *rsc, pe_working_set_t *data_set); -extern void native_rsc_colocation_lh( - resource_t *lh_rsc, resource_t *rh_rsc, rsc_colocation_t *constraint); -extern void native_rsc_colocation_rh( - resource_t *lh_rsc, resource_t *rh_rsc, rsc_colocation_t *constraint); -extern void rsc_ticket_constraint( - resource_t *lh_rsc, rsc_ticket_t *rsc_ticket, pe_working_set_t *data_set); -extern enum pe_action_flags native_action_flags(action_t *action, node_t *node); - -extern void native_rsc_location(resource_t *rsc, rsc_to_node_t *constraint); -extern void native_expand(resource_t *rsc, pe_working_set_t *data_set); -extern void native_dump(resource_t *rsc, const char *pre_text, gboolean details); -extern void create_notify_element( - resource_t *rsc, action_t *op, - notify_data_t *n_data, pe_working_set_t *data_set); -extern gboolean native_create_probe( - resource_t *rsc, node_t *node, action_t *complete, gboolean force, - pe_working_set_t *data_set); -extern void native_append_meta(resource_t *rsc, xmlNode *xml); - -extern int group_num_allowed_nodes(resource_t *rsc); -extern node_t *group_color(resource_t *rsc, node_t *preferred, pe_working_set_t *data_set); -extern void group_create_actions( - resource_t *rsc, pe_working_set_t *data_set); -extern void group_internal_constraints( - resource_t *rsc, pe_working_set_t *data_set); -extern void group_rsc_colocation_lh( - resource_t *lh_rsc, resource_t *rh_rsc, rsc_colocation_t *constraint); -extern void group_rsc_colocation_rh( - resource_t *lh_rsc, resource_t *rh_rsc, rsc_colocation_t *constraint); -extern enum pe_action_flags group_action_flags(action_t *action, node_t *node); -extern void group_rsc_location(resource_t *rsc, rsc_to_node_t *constraint); -extern void group_expand(resource_t *rsc, pe_working_set_t *data_set); -extern void group_append_meta(resource_t *rsc, xmlNode *xml); - -extern int clone_num_allowed_nodes(resource_t *rsc); -extern node_t *clone_color(resource_t *rsc, node_t *preferred, pe_working_set_t *data_set); -extern void clone_create_actions(resource_t *rsc, pe_working_set_t *data_set); -extern void clone_internal_constraints( - resource_t *rsc, pe_working_set_t *data_set); -extern void clone_rsc_colocation_lh( - resource_t *lh_rsc, resource_t *rh_rsc, rsc_colocation_t *constraint); -extern void clone_rsc_colocation_rh( - resource_t *lh_rsc, resource_t *rh_rsc, rsc_colocation_t *constraint); -extern void clone_rsc_location(resource_t *rsc, rsc_to_node_t *constraint); -extern enum pe_action_flags clone_action_flags(action_t *action, node_t *node); -extern void clone_expand(resource_t *rsc, pe_working_set_t *data_set); -extern gboolean clone_create_probe( - resource_t *rsc, node_t *node, action_t *complete, gboolean force, - pe_working_set_t *data_set); -extern void clone_append_meta(resource_t *rsc, xmlNode *xml); - -extern gboolean master_unpack(resource_t *rsc, pe_working_set_t *data_set); -extern node_t *master_color(resource_t *rsc, node_t *preferred, pe_working_set_t *data_set); -extern void master_create_actions(resource_t *rsc, pe_working_set_t *data_set); -extern void master_internal_constraints( - resource_t *rsc, pe_working_set_t *data_set); -extern void master_rsc_colocation_rh( - resource_t *lh_rsc, resource_t *rh_rsc, rsc_colocation_t *constraint); -extern void master_append_meta(resource_t *rsc, xmlNode *xml); - - +extern GHashTable *rsc_merge_weights(resource_t * rsc, const char *rhs, GHashTable * nodes, + const char *attr, int factor, enum pe_weights flags); + +extern GHashTable *native_merge_weights(resource_t * rsc, const char *rhs, GHashTable * nodes, + const char *attr, int factor, gboolean allow_rollback, + gboolean only_positive); + +extern GHashTable *group_merge_weights(resource_t * rsc, const char *rhs, GHashTable * nodes, + const char *attr, int factor, gboolean allow_rollback, + gboolean only_positive); + +extern node_t *native_color(resource_t * rsc, node_t * preferred, pe_working_set_t * data_set); +extern void native_create_actions(resource_t * rsc, pe_working_set_t * data_set); +extern void native_internal_constraints(resource_t * rsc, pe_working_set_t * data_set); +extern void native_rsc_colocation_lh(resource_t * lh_rsc, resource_t * rh_rsc, + rsc_colocation_t * constraint); +extern void native_rsc_colocation_rh(resource_t * lh_rsc, resource_t * rh_rsc, + rsc_colocation_t * constraint); +extern void rsc_ticket_constraint(resource_t * lh_rsc, rsc_ticket_t * rsc_ticket, + pe_working_set_t * data_set); +extern enum pe_action_flags native_action_flags(action_t * action, node_t * node); + +extern void native_rsc_location(resource_t * rsc, rsc_to_node_t * constraint); +extern void native_expand(resource_t * rsc, pe_working_set_t * data_set); +extern void native_dump(resource_t * rsc, const char *pre_text, gboolean details); +extern void create_notify_element(resource_t * rsc, action_t * op, + notify_data_t * n_data, pe_working_set_t * data_set); +extern gboolean native_create_probe(resource_t * rsc, node_t * node, action_t * complete, + gboolean force, pe_working_set_t * data_set); +extern void native_append_meta(resource_t * rsc, xmlNode * xml); + +extern int group_num_allowed_nodes(resource_t * rsc); +extern node_t *group_color(resource_t * rsc, node_t * preferred, pe_working_set_t * data_set); +extern void group_create_actions(resource_t * rsc, pe_working_set_t * data_set); +extern void group_internal_constraints(resource_t * rsc, pe_working_set_t * data_set); +extern void group_rsc_colocation_lh(resource_t * lh_rsc, resource_t * rh_rsc, + rsc_colocation_t * constraint); +extern void group_rsc_colocation_rh(resource_t * lh_rsc, resource_t * rh_rsc, + rsc_colocation_t * constraint); +extern enum pe_action_flags group_action_flags(action_t * action, node_t * node); +extern void group_rsc_location(resource_t * rsc, rsc_to_node_t * constraint); +extern void group_expand(resource_t * rsc, pe_working_set_t * data_set); +extern void group_append_meta(resource_t * rsc, xmlNode * xml); + +extern int clone_num_allowed_nodes(resource_t * rsc); +extern node_t *clone_color(resource_t * rsc, node_t * preferred, pe_working_set_t * data_set); +extern void clone_create_actions(resource_t * rsc, pe_working_set_t * data_set); +extern void clone_internal_constraints(resource_t * rsc, pe_working_set_t * data_set); +extern void clone_rsc_colocation_lh(resource_t * lh_rsc, resource_t * rh_rsc, + rsc_colocation_t * constraint); +extern void clone_rsc_colocation_rh(resource_t * lh_rsc, resource_t * rh_rsc, + rsc_colocation_t * constraint); +extern void clone_rsc_location(resource_t * rsc, rsc_to_node_t * constraint); +extern enum pe_action_flags clone_action_flags(action_t * action, node_t * node); +extern void clone_expand(resource_t * rsc, pe_working_set_t * data_set); +extern gboolean clone_create_probe(resource_t * rsc, node_t * node, action_t * complete, + gboolean force, pe_working_set_t * data_set); +extern void clone_append_meta(resource_t * rsc, xmlNode * xml); + +extern gboolean master_unpack(resource_t * rsc, pe_working_set_t * data_set); +extern node_t *master_color(resource_t * rsc, node_t * preferred, pe_working_set_t * data_set); +extern void master_create_actions(resource_t * rsc, pe_working_set_t * data_set); +extern void master_internal_constraints(resource_t * rsc, pe_working_set_t * data_set); +extern void master_rsc_colocation_rh(resource_t * lh_rsc, resource_t * rh_rsc, + rsc_colocation_t * constraint); +extern void master_append_meta(resource_t * rsc, xmlNode * xml); /* extern resource_object_functions_t resource_variants[]; */ extern resource_alloc_functions_t resource_class_alloc_functions[]; -extern gboolean is_active(rsc_to_node_t *cons); +extern gboolean is_active(rsc_to_node_t * cons); -extern gboolean native_constraint_violated( - resource_t *rsc_lh, resource_t *rsc_rh, rsc_colocation_t *constraint); +extern gboolean native_constraint_violated(resource_t * rsc_lh, resource_t * rsc_rh, + rsc_colocation_t * constraint); -extern gboolean unpack_rsc_to_attr(xmlNode *xml_obj, pe_working_set_t *data_set); +extern gboolean unpack_rsc_to_attr(xmlNode * xml_obj, pe_working_set_t * data_set); -extern gboolean unpack_rsc_to_node(xmlNode *xml_obj, pe_working_set_t *data_set); +extern gboolean unpack_rsc_to_node(xmlNode * xml_obj, pe_working_set_t * data_set); -extern gboolean unpack_rsc_order(xmlNode *xml_obj, pe_working_set_t *data_set); +extern gboolean unpack_rsc_order(xmlNode * xml_obj, pe_working_set_t * data_set); -extern gboolean unpack_rsc_colocation(xmlNode *xml_obj, pe_working_set_t *data_set); +extern gboolean unpack_rsc_colocation(xmlNode * xml_obj, pe_working_set_t * data_set); -extern gboolean unpack_rsc_location(xmlNode *xml_obj, pe_working_set_t *data_set); +extern gboolean unpack_rsc_location(xmlNode * xml_obj, pe_working_set_t * data_set); -extern gboolean unpack_rsc_ticket(xmlNode *xml_obj, pe_working_set_t *data_set); +extern gboolean unpack_rsc_ticket(xmlNode * xml_obj, pe_working_set_t * data_set); -extern void LogActions(resource_t *rsc, pe_working_set_t *data_set); +extern void LogActions(resource_t * rsc, pe_working_set_t * data_set); -extern void cleanup_alloc_calculations(pe_working_set_t *data_set); +extern void cleanup_alloc_calculations(pe_working_set_t * data_set); -extern notify_data_t *create_notification_boundaries( - resource_t *rsc, const char *action, action_t *start, action_t *end, pe_working_set_t *data_set); +extern notify_data_t *create_notification_boundaries(resource_t * rsc, const char *action, + action_t * start, action_t * end, + pe_working_set_t * data_set); -extern void collect_notification_data(resource_t *rsc, gboolean state, gboolean activity, notify_data_t *n_data); -extern gboolean expand_notification_data(notify_data_t *n_data); -extern void create_notifications(resource_t *rsc, notify_data_t *n_data, pe_working_set_t *data_set); -extern void free_notification_data(notify_data_t *n_data); -extern void rsc_migrate_reload(resource_t *rsc, pe_working_set_t *data_set); -extern void rsc_stonith_ordering(resource_t *rsc, action_t *stonith_op, pe_working_set_t *data_set); +extern void collect_notification_data(resource_t * rsc, gboolean state, gboolean activity, + notify_data_t * n_data); +extern gboolean expand_notification_data(notify_data_t * n_data); +extern void create_notifications(resource_t * rsc, notify_data_t * n_data, + pe_working_set_t * data_set); +extern void free_notification_data(notify_data_t * n_data); +extern void rsc_migrate_reload(resource_t * rsc, pe_working_set_t * data_set); +extern void rsc_stonith_ordering(resource_t * rsc, action_t * stonith_op, + pe_working_set_t * data_set); -extern enum pe_graph_flags native_update_actions( - action_t *first, action_t *then, node_t *node, enum pe_action_flags flags, enum pe_action_flags filter, enum pe_ordering type); -extern enum pe_graph_flags group_update_actions( - action_t *first, action_t *then, node_t *node, enum pe_action_flags flags, enum pe_action_flags filter, enum pe_ordering type); -extern enum pe_graph_flags clone_update_actions( - action_t *first, action_t *then, node_t *node, enum pe_action_flags flags, enum pe_action_flags filter, enum pe_ordering type); +extern enum pe_graph_flags native_update_actions(action_t * first, action_t * then, node_t * node, + enum pe_action_flags flags, + enum pe_action_flags filter, + enum pe_ordering type); +extern enum pe_graph_flags group_update_actions(action_t * first, action_t * then, node_t * node, + enum pe_action_flags flags, + enum pe_action_flags filter, enum pe_ordering type); +extern enum pe_graph_flags clone_update_actions(action_t * first, action_t * then, node_t * node, + enum pe_action_flags flags, + enum pe_action_flags filter, enum pe_ordering type); -static inline gboolean update_action_flags(action_t *action, enum pe_action_flags flags) +static inline gboolean +update_action_flags(action_t * action, enum pe_action_flags flags) { gboolean changed = FALSE; gboolean clear = is_set(flags, pe_action_clear); enum pe_action_flags last = action->flags; - - if(clear) { - clear_bit_inplace(action->flags, flags); + + if (clear) { + clear_bit_inplace(action->flags, flags); } else { - set_bit_inplace(action->flags, flags); + set_bit_inplace(action->flags, flags); } - if(last != action->flags) { - changed = TRUE; - clear_bit_inplace(flags, pe_action_clear); - crm_trace("%s on %s: %sset flags 0x%.6x (was 0x%.6x, now 0x%.6x)", - action->uuid, action->node?action->node->details->uname:"[none]", - clear?"un-":"", flags, last, action->flags); + if (last != action->flags) { + changed = TRUE; + clear_bit_inplace(flags, pe_action_clear); + crm_trace("%s on %s: %sset flags 0x%.6x (was 0x%.6x, now 0x%.6x)", + action->uuid, action->node ? action->node->details->uname : "[none]", + clear ? "un-" : "", flags, last, action->flags); } return changed; } #endif - - diff --git a/pengine/pengine.h b/pengine/pengine.h index 3b83f40d59..d8c2fa8a17 100644 --- a/pengine/pengine.h +++ b/pengine/pengine.h @@ -1,193 +1,185 @@ /* * 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 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef PENGINE__H -#define PENGINE__H +# define PENGINE__H typedef struct rsc_to_node_s rsc_to_node_t; typedef struct rsc_colocation_s rsc_colocation_t; typedef struct rsc_ticket_s rsc_ticket_t; typedef struct lrm_agent_s lrm_agent_t; typedef struct order_constraint_s order_constraint_t; -#include -#include -#include -#include -#include -#include -#include +# include +# include +# include +# include +# include +# include +# include -#include +# include enum pe_stop_fail { - pesf_block, - pesf_stonith, - pesf_ignore + pesf_block, + pesf_stonith, + pesf_ignore }; enum pe_weights { - pe_weights_none = 0x0, - pe_weights_init = 0x1, - pe_weights_forward = 0x4, - pe_weights_positive = 0x8, - pe_weights_rollback = 0x10, + pe_weights_none = 0x0, + pe_weights_init = 0x1, + pe_weights_forward = 0x4, + pe_weights_positive = 0x8, + pe_weights_rollback = 0x10, }; enum pe_ordering { - pe_order_none = 0x0, /* deleted */ - pe_order_optional = 0x1, /* pure ordering, nothing implied */ - - pe_order_implies_first = 0x10, /* If 'first' is required, ensure 'then' is too */ - pe_order_implies_then = 0x20, /* If 'then' is required, ensure 'first' is too */ - - pe_order_runnable_left = 0x100, /* 'then' requires 'first' to be runnable */ - - pe_order_restart = 0x1000, /* stop-start constraint */ - pe_order_stonith_stop = 0x2000, /* only applies if the action is non-pseudo */ - pe_order_serialize_only = 0x4000, /* serialize */ - - pe_order_implies_first_printed = 0x10000, /* Like ..implies_first but only ensures 'first' is printed, not manditory */ - pe_order_implies_then_printed = 0x20000, /* Like ..implies_then but only ensures 'then' is printed, not manditory */ - - pe_order_trace = 0x4000000 /* test marker */ + pe_order_none = 0x0, /* deleted */ + pe_order_optional = 0x1, /* pure ordering, nothing implied */ + + pe_order_implies_first = 0x10, /* If 'first' is required, ensure 'then' is too */ + pe_order_implies_then = 0x20, /* If 'then' is required, ensure 'first' is too */ + + pe_order_runnable_left = 0x100, /* 'then' requires 'first' to be runnable */ + + pe_order_restart = 0x1000, /* stop-start constraint */ + pe_order_stonith_stop = 0x2000, /* only applies if the action is non-pseudo */ + pe_order_serialize_only = 0x4000, /* serialize */ + + pe_order_implies_first_printed = 0x10000, /* Like ..implies_first but only ensures 'first' is printed, not manditory */ + pe_order_implies_then_printed = 0x20000, /* Like ..implies_then but only ensures 'then' is printed, not manditory */ + + pe_order_trace = 0x4000000 /* test marker */ }; -struct rsc_colocation_s { - const char *id; - const char *node_attribute; - resource_t *rsc_lh; - resource_t *rsc_rh; +struct rsc_colocation_s { + const char *id; + const char *node_attribute; + resource_t *rsc_lh; + resource_t *rsc_rh; + + int role_lh; + int role_rh; - int role_lh; - int role_rh; - - int score; + int score; }; enum loss_ticket_policy_e { - loss_ticket_stop, - loss_ticket_demote, - loss_ticket_fence, - loss_ticket_freeze + loss_ticket_stop, + loss_ticket_demote, + loss_ticket_fence, + loss_ticket_freeze }; -struct rsc_ticket_s { - const char *id; - resource_t *rsc_lh; - ticket_t *ticket; - enum loss_ticket_policy_e loss_policy; +struct rsc_ticket_s { + const char *id; + resource_t *rsc_lh; + ticket_t *ticket; + enum loss_ticket_policy_e loss_policy; - int role_lh; + int role_lh; }; -struct rsc_to_node_s { - const char *id; - resource_t *rsc_lh; +struct rsc_to_node_s { + const char *id; + resource_t *rsc_lh; - enum rsc_role_e role_filter; - GListPtr node_list_rh; /* node_t* */ + enum rsc_role_e role_filter; + GListPtr node_list_rh; /* node_t* */ }; +struct order_constraint_s { + int id; + enum pe_ordering type; -struct order_constraint_s -{ - int id; - enum pe_ordering type; + void *lh_opaque; + resource_t *lh_rsc; + action_t *lh_action; + char *lh_action_task; - void *lh_opaque; - resource_t *lh_rsc; - action_t *lh_action; - char *lh_action_task; - - void *rh_opaque; - resource_t *rh_rsc; - action_t *rh_action; - char *rh_action_task; + void *rh_opaque; + resource_t *rh_rsc; + action_t *rh_action; + char *rh_action_task; - /* (soon to be) variant specific */ + /* (soon to be) variant specific */ /* int lh_rsc_incarnation; */ /* int rh_rsc_incarnation; */ }; enum pe_link_state { pe_link_not_dumped, pe_link_dumped, pe_link_dup, }; typedef struct action_wrapper_s action_wrapper_t; -struct action_wrapper_s -{ - enum pe_ordering type; - enum pe_link_state state; - action_t *action; +struct action_wrapper_s { + enum pe_ordering type; + enum pe_link_state state; + action_t *action; }; -extern gboolean stage0(pe_working_set_t *data_set); -extern gboolean probe_resources(pe_working_set_t *data_set); -extern gboolean stage2(pe_working_set_t *data_set); -extern gboolean stage3(pe_working_set_t *data_set); -extern gboolean stage4(pe_working_set_t *data_set); -extern gboolean stage5(pe_working_set_t *data_set); -extern gboolean stage6(pe_working_set_t *data_set); -extern gboolean stage7(pe_working_set_t *data_set); -extern gboolean stage8(pe_working_set_t *data_set); +extern gboolean stage0(pe_working_set_t * data_set); +extern gboolean probe_resources(pe_working_set_t * data_set); +extern gboolean stage2(pe_working_set_t * data_set); +extern gboolean stage3(pe_working_set_t * data_set); +extern gboolean stage4(pe_working_set_t * data_set); +extern gboolean stage5(pe_working_set_t * data_set); +extern gboolean stage6(pe_working_set_t * data_set); +extern gboolean stage7(pe_working_set_t * data_set); +extern gboolean stage8(pe_working_set_t * data_set); extern gboolean summary(GListPtr resources); -extern gboolean pe_msg_dispatch(IPC_Channel *sender, void *user_data); +extern gboolean pe_msg_dispatch(IPC_Channel * sender, void *user_data); -extern gboolean process_pe_message( - xmlNode *msg, xmlNode *xml_data, IPC_Channel *sender); +extern gboolean process_pe_message(xmlNode * msg, xmlNode * xml_data, IPC_Channel * sender); -extern gboolean unpack_constraints( - xmlNode *xml_constraints, pe_working_set_t *data_set); +extern gboolean unpack_constraints(xmlNode * xml_constraints, pe_working_set_t * data_set); extern gboolean update_action_states(GListPtr actions); -extern gboolean shutdown_constraints( - node_t *node, action_t *shutdown_op, pe_working_set_t *data_set); +extern gboolean shutdown_constraints(node_t * node, action_t * shutdown_op, + pe_working_set_t * data_set); -extern gboolean stonith_constraints( - node_t *node, action_t *stonith_op, pe_working_set_t *data_set); +extern gboolean stonith_constraints(node_t * node, action_t * stonith_op, + pe_working_set_t * data_set); -extern int custom_action_order( - resource_t *lh_rsc, char *lh_task, action_t *lh_action, - resource_t *rh_rsc, char *rh_task, action_t *rh_action, - enum pe_ordering type, pe_working_set_t *data_set); +extern int custom_action_order(resource_t * lh_rsc, char *lh_task, action_t * lh_action, + resource_t * rh_rsc, char *rh_task, action_t * rh_action, + enum pe_ordering type, pe_working_set_t * data_set); -extern int new_rsc_order(resource_t *lh_rsc, const char *lh_task, - resource_t *rh_rsc, const char *rh_task, - enum pe_ordering type, pe_working_set_t *data_set); +extern int new_rsc_order(resource_t * lh_rsc, const char *lh_task, + resource_t * rh_rsc, const char *rh_task, + enum pe_ordering type, pe_working_set_t * data_set); -#define order_start_start(rsc1,rsc2, type) \ +# define order_start_start(rsc1,rsc2, type) \ new_rsc_order(rsc1, CRMD_ACTION_START, rsc2, CRMD_ACTION_START, type, data_set) -#define order_stop_stop(rsc1, rsc2, type) \ +# define order_stop_stop(rsc1, rsc2, type) \ new_rsc_order(rsc1, CRMD_ACTION_STOP, rsc2, CRMD_ACTION_STOP, type, data_set) -extern void graph_element_from_action( - action_t *action, pe_working_set_t *data_set); +extern void graph_element_from_action(action_t * action, pe_working_set_t * data_set); extern gboolean show_scores; extern int scores_log_level; extern gboolean show_utilization; extern int utilization_log_level; -extern const char* transition_idle_timeout; +extern const char *transition_idle_timeout; #endif - diff --git a/pengine/utils.h b/pengine/utils.h index 019bf69f49..f9fd4074e8 100644 --- a/pengine/utils.h +++ b/pengine/utils.h @@ -1,66 +1,66 @@ /* * 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 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef PENGINE_AUTILS__H -#define PENGINE_AUTILS__H +# define PENGINE_AUTILS__H /* Constraint helper functions */ -extern rsc_colocation_t *invert_constraint(rsc_colocation_t *constraint); +extern rsc_colocation_t *invert_constraint(rsc_colocation_t * constraint); -extern rsc_to_node_t *copy_constraint(rsc_to_node_t *constraint); +extern rsc_to_node_t *copy_constraint(rsc_to_node_t * constraint); -extern rsc_to_node_t *rsc2node_new( - const char *id, resource_t *rsc, int weight, node_t *node, - pe_working_set_t *data_set); +extern rsc_to_node_t *rsc2node_new(const char *id, resource_t * rsc, int weight, node_t * node, + pe_working_set_t * data_set); extern void pe_free_rsc_to_node(GListPtr constraints); extern void pe_free_ordering(GListPtr constraints); -extern gboolean rsc_colocation_new( - const char *id, const char *node_attr, int score, - resource_t *rsc_lh, resource_t *rsc_rh, - const char *state_lh, const char *state_rh, - pe_working_set_t *data_set); +extern gboolean rsc_colocation_new(const char *id, const char *node_attr, int score, + resource_t * rsc_lh, resource_t * rsc_rh, + const char *state_lh, const char *state_rh, + pe_working_set_t * data_set); -extern gboolean rsc_ticket_new(const char *id, resource_t *rsc_lh, ticket_t *ticket, - const char *state_lh, const char *loss_policy, pe_working_set_t *data_set); +extern gboolean rsc_ticket_new(const char *id, resource_t * rsc_lh, ticket_t * ticket, + const char *state_lh, const char *loss_policy, + pe_working_set_t * data_set); -extern rsc_to_node_t *generate_location_rule( - resource_t *rsc, xmlNode *location_rule, pe_working_set_t *data_set); +extern rsc_to_node_t *generate_location_rule(resource_t * rsc, xmlNode * location_rule, + pe_working_set_t * data_set); extern gint sort_node_weight(gconstpointer a, gconstpointer b, gpointer data_set); -extern gboolean can_run_resources(const node_t *node); -extern gboolean native_assign_node(resource_t *rsc, GListPtr candidates, node_t *chosen, gboolean force); -void native_deallocate(resource_t *rsc); +extern gboolean can_run_resources(const node_t * node); +extern gboolean native_assign_node(resource_t * rsc, GListPtr candidates, node_t * chosen, + gboolean force); +void native_deallocate(resource_t * rsc); -extern gboolean order_actions(action_t *lh_action, action_t *rh_action, enum pe_ordering order); +extern gboolean order_actions(action_t * lh_action, action_t * rh_action, enum pe_ordering order); extern void log_action(unsigned int log_level, const char *pre_text, - action_t *action, gboolean details); + action_t * action, gboolean details); -extern action_t *get_pseudo_op(const char *name, pe_working_set_t *data_set); -extern gboolean can_run_any(GHashTable *nodes); -extern resource_t *find_compatible_child( - resource_t *local_child, resource_t *rsc, enum rsc_role_e filter, gboolean current); +extern action_t *get_pseudo_op(const char *name, pe_working_set_t * data_set); +extern gboolean can_run_any(GHashTable * nodes); +extern resource_t *find_compatible_child(resource_t * local_child, resource_t * rsc, + enum rsc_role_e filter, gboolean current); -#define STONITH_UP "stonith_up" -#define STONITH_DONE "stonith_complete" -#define ALL_STOPPED "all_stopped" -#define LOAD_STOPPED "load_stopped" +# define STONITH_UP "stonith_up" +# define STONITH_DONE "stonith_complete" +# define ALL_STOPPED "all_stopped" +# define LOAD_STOPPED "load_stopped" #endif