44#include <sys/socket.h>
46#include <netinet/in.h>
59#include <qb/qbipc_common.h>
88#define DEFAULT_SHUTDOWN_TIMEOUT 5000
98static int shutdown_yes;
99static int shutdown_no;
100static int shutdown_expected;
110static void cfg_confchg_fn (
112 const unsigned int *member_list,
size_t member_list_entries,
121static int cfg_lib_init_fn (
void *conn);
123static int cfg_lib_exit_fn (
void *conn);
125static void message_handler_req_exec_cfg_ringreenable (
129static void message_handler_req_exec_cfg_killnode (
133static void message_handler_req_exec_cfg_shutdown (
137static void message_handler_req_exec_cfg_reload_config (
141static void message_handler_req_exec_cfg_reconfig_crypto (
145static void exec_cfg_killnode_endian_convert (
void *msg);
147static void message_handler_req_lib_cfg_ringstatusget (
151static void message_handler_req_lib_cfg_nodestatusget (
155static void message_handler_req_lib_cfg_ringreenable (
159static void message_handler_req_lib_cfg_killnode (
163static void message_handler_req_lib_cfg_tryshutdown (
167static void message_handler_req_lib_cfg_replytoshutdown (
171static void message_handler_req_lib_cfg_trackstart (
175static void message_handler_req_lib_cfg_trackstop (
179static void message_handler_req_lib_cfg_get_node_addrs (
183static void message_handler_req_lib_cfg_local_get (
187static void message_handler_req_lib_cfg_reload_config (
191static void message_handler_req_lib_cfg_reopen_log_files (
205 .lib_handler_fn = message_handler_req_lib_cfg_ringreenable,
209 .lib_handler_fn = message_handler_req_lib_cfg_killnode,
213 .lib_handler_fn = message_handler_req_lib_cfg_tryshutdown,
217 .lib_handler_fn = message_handler_req_lib_cfg_replytoshutdown,
221 .lib_handler_fn = message_handler_req_lib_cfg_get_node_addrs,
225 .lib_handler_fn = message_handler_req_lib_cfg_local_get,
229 .lib_handler_fn = message_handler_req_lib_cfg_reload_config,
233 .lib_handler_fn = message_handler_req_lib_cfg_reopen_log_files,
237 .lib_handler_fn = message_handler_req_lib_cfg_nodestatusget,
241 .lib_handler_fn = message_handler_req_lib_cfg_trackstart,
245 .lib_handler_fn = message_handler_req_lib_cfg_trackstop,
257 .exec_handler_fn = message_handler_req_exec_cfg_killnode,
258 .exec_endian_convert_fn = exec_cfg_killnode_endian_convert
261 .exec_handler_fn = message_handler_req_exec_cfg_shutdown,
264 .exec_handler_fn = message_handler_req_exec_cfg_reload_config,
267 .exec_handler_fn = message_handler_req_exec_cfg_reconfig_crypto,
275 .
name =
"corosync configuration service",
278 .private_data_size =
sizeof(
struct cfg_info),
281 .lib_init_fn = cfg_lib_init_fn,
282 .lib_exit_fn = cfg_lib_exit_fn,
283 .lib_engine = cfg_lib_engine,
285 .exec_init_fn = cfg_exec_init_fn,
286 .exec_engine = cfg_exec_engine,
288 .confchg_fn = cfg_confchg_fn
323static char *cfg_exec_init_fn (
332static void cfg_confchg_fn (
334 const unsigned int *member_list,
size_t member_list_entries,
344static int send_shutdown(
void)
384 TRACE1(
"sending testshutdown to %p",
ci->tracker_conn);
393static void check_shutdown_status(
void)
408 if (shutdown_yes + shutdown_no >= shutdown_expected) {
413 if (shutdown_yes >= shutdown_expected ||
415 TRACE1(
"shutdown confirmed");
436 TRACE1(
"shutdown cancelled");
450 shutdown_yes, shutdown_no, shutdown_flags);
459static void shutdown_timer_fn(
void *
arg)
466 shutdown_no = shutdown_expected;
467 check_shutdown_status();
473static void remove_ci_from_shutdown(
struct cfg_info *
ci)
481 if (
ci == shutdown_con) {
494 if (
ci->shutdown_reply == SHUTDOWN_REPLY_YES)
496 if (
ci->shutdown_reply == SHUTDOWN_REPLY_NO)
503 ci->shutdown_reply = SHUTDOWN_REPLY_YES;
506 check_shutdown_status();
512int cfg_lib_exit_fn (
void *conn)
517 remove_ci_from_shutdown(
ci);
522static int cfg_lib_init_fn (
void *
conn)
536static void message_handler_req_exec_cfg_ringreenable (
545static void exec_cfg_killnode_endian_convert (
void *msg)
556static void message_handler_req_exec_cfg_killnode (
578static void message_handler_req_exec_cfg_shutdown (
592static int nullcheck_strcmp(
const char*
left,
const char *
right)
625#ifndef HAVE_KNET_CRYPTO_RECONF
626 delete_and_notify_if_changed(
temp_map,
"totem.secauth");
627 delete_and_notify_if_changed(
temp_map,
"totem.crypto_hash");
628 delete_and_notify_if_changed(
temp_map,
"totem.crypto_cipher");
629 delete_and_notify_if_changed(
temp_map,
"totem.keyfile");
630 delete_and_notify_if_changed(
temp_map,
"totem.key");
632 delete_and_notify_if_changed(
temp_map,
"totem.version");
633 delete_and_notify_if_changed(
temp_map,
"totem.threads");
634 delete_and_notify_if_changed(
temp_map,
"totem.ip_version");
635 delete_and_notify_if_changed(
temp_map,
"totem.ip_dscp");
636 delete_and_notify_if_changed(
temp_map,
"totem.netmtu");
637 delete_and_notify_if_changed(
temp_map,
"totem.interface.bindnetaddr");
638 delete_and_notify_if_changed(
temp_map,
"totem.interface.mcastaddr");
639 delete_and_notify_if_changed(
temp_map,
"totem.interface.broadcast");
640 delete_and_notify_if_changed(
temp_map,
"totem.interface.mcastport");
641 delete_and_notify_if_changed(
temp_map,
"totem.interface.ttl");
642 delete_and_notify_if_changed(
temp_map,
"totem.transport");
643 delete_and_notify_if_changed(
temp_map,
"totem.cluster_name");
644 delete_and_notify_if_changed(
temp_map,
"quorum.provider");
645 delete_and_notify_if_changed(
temp_map,
"system.move_to_root_cgroup");
646 delete_and_notify_if_changed(
temp_map,
"system.allow_knet_handle_fallback");
647 delete_and_notify_if_changed(
temp_map,
"system.sched_rr");
648 delete_and_notify_if_changed(
temp_map,
"system.priority");
649 delete_and_notify_if_changed(
temp_map,
"system.qb_ipc_type");
650 delete_and_notify_if_changed(
temp_map,
"system.state_dir");
713static void message_handler_req_exec_cfg_reload_config (
757 remove_deleted_entries(
temp_map,
"logging.");
758 remove_deleted_entries(
temp_map,
"totem.");
759 remove_deleted_entries(
temp_map,
"nodelist.");
760 remove_deleted_entries(
temp_map,
"quorum.");
761 remove_deleted_entries(
temp_map,
"uidgid.config.");
762 remove_deleted_entries(
temp_map,
"nozzle.");
816#ifndef HAVE_KNET_CRYPTO_RECONF
893static void message_handler_req_exec_cfg_reconfig_crypto (
929static void message_handler_req_lib_cfg_ringstatusget (
999static void message_handler_req_lib_cfg_nodestatusget (
1022 goto ipc_response_send;
1077static void message_handler_req_lib_cfg_trackstart (
1091 ci->tracker_conn = conn;
1097 ci->shutdown_reply = SHUTDOWN_REPLY_UNKNOWN;
1098 shutdown_expected++;
1113static void message_handler_req_lib_cfg_trackstop (
1121 remove_ci_from_shutdown(
ci);
1132static void message_handler_req_lib_cfg_ringreenable (
1149static void message_handler_req_lib_cfg_killnode (
1175 if (
strcmp(key_name,
"status") != 0) {
1225static void message_handler_req_lib_cfg_tryshutdown (
1281 shutdown_expected = 0;
1290 shutdown_expected++;
1297 if (shutdown_expected == 0) {
1327 shutdown_timer_fn, &shutdown_timer);
1343static void message_handler_req_lib_cfg_replytoshutdown (
1353 if (!shutdown_con) {
1360 ci->shutdown_reply = SHUTDOWN_REPLY_YES;
1364 ci->shutdown_reply = SHUTDOWN_REPLY_NO;
1366 check_shutdown_status();
1379static void message_handler_req_lib_cfg_get_node_addrs (
void *conn,
1427static void message_handler_req_lib_cfg_local_get (
void *conn,
const void *msg)
1440static void message_handler_req_lib_cfg_reload_config (
void *conn,
const void *msg)
1462static void message_handler_req_lib_cfg_reopen_log_files (
void *conn,
const void *msg)
#define SERVICE_ID_MAKE(a, b)
totem_configuration_type
The totem_configuration_type enum.
qb_loop_timer_handle corosync_timer_handle_t
corosync_timer_handle_t
#define corosync_fatal_error(err)
unsigned char addr[TOTEMIP_ADDRLEN]
@ CS_LIB_FLOW_CONTROL_REQUIRED
@ CS_LIB_FLOW_CONTROL_NOT_REQUIRED
@ COROSYNC_FATAL_ERROR_EXIT
int coroparse_configparse(icmap_map_t config_map, const char **error_string)
cs_error_t
The cs_error_t enum.
@ CS_ERR_FAILED_OPERATION
struct corosync_service_engine cfg_service_engine
@ MESSAGE_REQ_EXEC_CFG_RELOAD_CONFIG
@ MESSAGE_REQ_EXEC_CFG_SHUTDOWN
@ MESSAGE_REQ_EXEC_CFG_RINGREENABLE
@ MESSAGE_REQ_EXEC_CFG_KILLNODE
@ MESSAGE_REQ_EXEC_CFG_CRYPTO_RECONFIG
#define DEFAULT_SHUTDOWN_TIMEOUT
struct corosync_service_engine * cfg_get_service_engine_ver0(void)
icmap_iter_t icmap_iter_init_r(const icmap_map_t map, const char *prefix)
icmap_iter_init_r
cs_error_t icmap_get_string_r(const icmap_map_t map, const char *key_name, char **str)
cs_error_t icmap_get_uint32(const char *key_name, uint32_t *u32)
cs_error_t icmap_set_uint8(const char *key_name, uint8_t value)
cs_error_t icmap_delete(const char *key_name)
Delete key from map.
cs_error_t icmap_set_int32(const char *key_name, int32_t value)
cs_error_t icmap_delete_r(const icmap_map_t map, const char *key_name)
icmap_delete_r
int icmap_key_value_eq(const icmap_map_t map1, const char *key_name1, const icmap_map_t map2, const char *key_name2)
Compare value of key with name key_name1 in map1 with key with name key_name2 in map2.
icmap_iter_t icmap_iter_init(const char *prefix)
Initialize iterator with given prefix.
cs_error_t icmap_copy_map(icmap_map_t dst_map, const icmap_map_t src_map)
Copy content of src_map icmap to dst_map icmap.
cs_error_t icmap_init_r(icmap_map_t *result)
Initialize additional (local, reentrant) icmap_map.
const char * icmap_iter_next(icmap_iter_t iter, size_t *value_len, icmap_value_types_t *type)
Return next item in iterator iter.
icmap_map_t icmap_get_global_map(void)
Return global icmap.
qb_map_iter_t * icmap_iter_t
Itterator type.
void icmap_iter_finalize(icmap_iter_t iter)
Finalize iterator.
void icmap_fini_r(const icmap_map_t map)
Finalize local, reentrant icmap.
#define ICMAP_KEYNAME_MAXLEN
Maximum length of key in icmap.
@ CFG_SHUTDOWN_FLAG_REGARDLESS
@ CFG_SHUTDOWN_FLAG_IMMEDIATE
#define CFG_INTERFACE_STATUS_MAX_LEN
#define CFG_INTERFACE_NAME_MAX_LEN
@ MESSAGE_RES_CFG_STATETRACKSTOP
@ MESSAGE_RES_CFG_LOCAL_GET
@ MESSAGE_RES_CFG_RELOAD_CONFIG
@ MESSAGE_RES_CFG_RINGSTATUSGET
@ MESSAGE_RES_CFG_TRYSHUTDOWN
@ MESSAGE_RES_CFG_NODESTATUSGET
@ MESSAGE_RES_CFG_GET_NODE_ADDRS
@ MESSAGE_RES_CFG_REOPEN_LOG_FILES
@ MESSAGE_RES_CFG_TESTSHUTDOWN
@ MESSAGE_RES_CFG_STATETRACKSTART
@ MESSAGE_RES_CFG_KILLNODE
@ MESSAGE_RES_CFG_REPLYTOSHUTDOWN
@ MESSAGE_RES_CFG_RINGREENABLE
#define CFG_MAX_INTERFACES
#define LOGSYS_LEVEL_ERROR
#define log_printf(level, format, args...)
#define LOGSYS_LEVEL_NOTICE
#define TRACE1(format, args...)
#define LOGSYS_DECLARE_SUBSYS(subsys)
The LOGSYS_DECLARE_SUBSYS macro.
cs_error_t logsys_reopen_log_files(void)
#define LOGSYS_LEVEL_DEBUG
enum cfg_info::@8 shutdown_reply
The corosync_api_v1 struct.
int(* timer_add_duration)(unsigned long long nanoseconds_in_future, void *data, void(*timer_nf)(void *data), corosync_timer_handle_t *handle)
int(* totem_mcast)(const struct iovec *iovec, unsigned int iov_len, unsigned int guarantee)
void *(* ipc_private_data_get)(void *conn)
void(* timer_delete)(corosync_timer_handle_t timer_handle)
unsigned int(* totem_nodeid_get)(void)
const char *(* totem_ip_print)(const struct totem_ip_address *addr)
void(* ipc_refcnt_dec)(void *conn)
void(* ipc_source_set)(mar_message_source_t *source, void *conn)
void(* shutdown_request)(void)
int(* totem_ifaces_get)(unsigned int nodeid, unsigned int *interface_ids, struct totem_ip_address *interfaces, unsigned int interfaces_size, char ***status, unsigned int *iface_count)
void(* ipc_refcnt_inc)(void *conn)
int(* ipc_dispatch_send)(void *conn, const void *msg, size_t mlen)
int(* ipc_response_send)(void *conn, const void *msg, size_t mlen)
The corosync_exec_handler struct.
void(* exec_handler_fn)(const void *msg, unsigned int nodeid)
The corosync_lib_handler struct.
void(* lib_handler_fn)(void *conn, const void *msg)
The corosync_service_engine struct.
uint8_t value[CS_MAX_NAME_LENGTH]
The mar_message_source_t struct.
mar_uint32_t phase __attribute__((aligned(8)))
mar_uint32_t nodeid __attribute__((aligned(8)))
mar_name_t reason __attribute__((aligned(8)))
mar_message_source_t source __attribute__((aligned(8)))
mar_message_source_t source __attribute__((aligned(8)))
The req_lib_cfg_get_node_addrs struct.
The req_lib_cfg_killnode struct.
The req_lib_cfg_nodestatusget struct.
The req_lib_cfg_replytoshutdown struct.
The req_lib_cfg_tryshutdown struct.
The res_lib_cfg_get_node_addrs struct.
The res_lib_cfg_killnode struct.
The res_lib_cfg_local_get struct.
The res_lib_cfg_nodestatusget struct.
The res_lib_cfg_reload_config struct.
The res_lib_cfg_reopen_log_files struct.
The res_lib_cfg_replytoshutdown struct.
The res_lib_cfg_ringreenable struct.
The res_lib_cfg_ringstatusget struct.
The res_lib_cfg_testshutdown struct.
struct qb_ipc_response_header header
struct qb_ipc_response_header header
The res_lib_cfg_tryshutdown struct.
The totem_ip_address struct.
@ CRYPTO_RECONFIG_PHASE_CLEANUP
@ CRYPTO_RECONFIG_PHASE_ACTIVATE
void totem_volatile_config_read(struct totem_config *totem_config, icmap_map_t temp_map, const char *deleted_key)
int totemconfig_commit_new_params(struct totem_config *totem_config, icmap_map_t map)
int totem_volatile_config_validate(struct totem_config *totem_config, icmap_map_t temp_map, const char **error_string)
int totem_reread_crypto_config(struct totem_config *totem_config, icmap_map_t map, const char **error_string)
void totem_calc_knet_ping_timers(struct totem_config *totem_config, icmap_map_t temp_map)
int totemconfig_configure_new_params(struct totem_config *totem_config, icmap_map_t map, const char **error_string)
void totempg_get_config(struct totem_config *config)
int totempg_nodestatus_get(unsigned int nodeid, struct totem_node_status *node_status)
void totempg_put_config(struct totem_config *config)
int totempg_crypto_reconfigure_phase(cfg_message_crypto_reconfig_phase_t phase)
struct memb_ring_id ring_id
struct totem_message_header header