corosync
exec/cfg.c
Go to the documentation of this file.
1/*
2 * Copyright (c) 2005-2006 MontaVista Software, Inc.
3 * Copyright (c) 2006-2018 Red Hat, Inc.
4 *
5 * All rights reserved.
6 *
7 * Author: Steven Dake (sdake@redhat.com)
8 *
9 * This software licensed under BSD license, the text of which follows:
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions are met:
13 *
14 * - Redistributions of source code must retain the above copyright notice,
15 * this list of conditions and the following disclaimer.
16 * - Redistributions in binary form must reproduce the above copyright notice,
17 * this list of conditions and the following disclaimer in the documentation
18 * and/or other materials provided with the distribution.
19 * - Neither the name of the MontaVista Software, Inc. nor the names of its
20 * contributors may be used to endorse or promote products derived from this
21 * software without specific prior written permission.
22 *
23 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
24 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
27 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
30 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
31 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
33 * THE POSSIBILITY OF SUCH DAMAGE.
34 */
35
36#include <config.h>
37
38#ifdef HAVE_ALLOCA_H
39#include <alloca.h>
40#endif
41
42#include <sys/types.h>
43#include <sys/uio.h>
44#include <sys/socket.h>
45#include <sys/un.h>
46#include <netinet/in.h>
47#include <arpa/inet.h>
48#include <unistd.h>
49#include <fcntl.h>
50#include <stdlib.h>
51#include <stdio.h>
52#include <stddef.h>
53#include <limits.h>
54#include <errno.h>
55#include <string.h>
56#include <assert.h>
57
58#include <corosync/corotypes.h>
59#include <qb/qbipc_common.h>
60#include <corosync/cfg.h>
61#include <qb/qblist.h>
62#include <qb/qbutil.h>
63#include <corosync/mar_gen.h>
66#include <corosync/ipc_cfg.h>
67#include <corosync/logsys.h>
68#include <corosync/coroapi.h>
69#include <corosync/icmap.h>
70#include <corosync/corodefs.h>
71
72#include "totemconfig.h"
73#include "totemknet.h"
74#include "service.h"
75#include "main.h"
76
78
86
87/* in milliseconds */
88#define DEFAULT_SHUTDOWN_TIMEOUT 5000
89
90static struct qb_list_head trackers_list;
91
92/*
93 * Variables controlling a requested shutdown
94 */
95static corosync_timer_handle_t shutdown_timer;
96static struct cfg_info *shutdown_con;
97static uint32_t shutdown_flags;
98static int shutdown_yes;
99static int shutdown_no;
100static int shutdown_expected;
101
109
110static void cfg_confchg_fn (
112 const unsigned int *member_list, size_t member_list_entries,
113 const unsigned int *left_list, size_t left_list_entries,
114 const unsigned int *joined_list, size_t joined_list_entries,
115 const struct memb_ring_id *ring_id);
116
117static char *cfg_exec_init_fn (struct corosync_api_v1 *corosync_api_v1);
118
119static struct corosync_api_v1 *api;
120
121static int cfg_lib_init_fn (void *conn);
122
123static int cfg_lib_exit_fn (void *conn);
124
125static void message_handler_req_exec_cfg_ringreenable (
126 const void *message,
127 unsigned int nodeid);
128
129static void message_handler_req_exec_cfg_killnode (
130 const void *message,
131 unsigned int nodeid);
132
133static void message_handler_req_exec_cfg_shutdown (
134 const void *message,
135 unsigned int nodeid);
136
137static void message_handler_req_exec_cfg_reload_config (
138 const void *message,
139 unsigned int nodeid);
140
141static void message_handler_req_exec_cfg_reconfig_crypto (
142 const void *message,
143 unsigned int nodeid);
144
145static void exec_cfg_killnode_endian_convert (void *msg);
146
147static void message_handler_req_lib_cfg_ringstatusget (
148 void *conn,
149 const void *msg);
150
151static void message_handler_req_lib_cfg_nodestatusget (
152 void *conn,
153 const void *msg);
154
155static void message_handler_req_lib_cfg_ringreenable (
156 void *conn,
157 const void *msg);
158
159static void message_handler_req_lib_cfg_killnode (
160 void *conn,
161 const void *msg);
162
163static void message_handler_req_lib_cfg_tryshutdown (
164 void *conn,
165 const void *msg);
166
167static void message_handler_req_lib_cfg_replytoshutdown (
168 void *conn,
169 const void *msg);
170
171static void message_handler_req_lib_cfg_trackstart (
172 void *conn,
173 const void *msg);
174
175static void message_handler_req_lib_cfg_trackstop (
176 void *conn,
177 const void *msg);
178
179static void message_handler_req_lib_cfg_get_node_addrs (
180 void *conn,
181 const void *msg);
182
183static void message_handler_req_lib_cfg_local_get (
184 void *conn,
185 const void *msg);
186
187static void message_handler_req_lib_cfg_reload_config (
188 void *conn,
189 const void *msg);
190
191static void message_handler_req_lib_cfg_reopen_log_files (
192 void *conn,
193 const void *msg);
194
195/*
196 * Service Handler Definition
197 */
198static struct corosync_lib_handler cfg_lib_engine[] =
199{
200 { /* 0 */
201 .lib_handler_fn = message_handler_req_lib_cfg_ringstatusget,
202 .flow_control = CS_LIB_FLOW_CONTROL_REQUIRED
203 },
204 { /* 1 */
205 .lib_handler_fn = message_handler_req_lib_cfg_ringreenable,
206 .flow_control = CS_LIB_FLOW_CONTROL_REQUIRED
207 },
208 { /* 2 */
209 .lib_handler_fn = message_handler_req_lib_cfg_killnode,
210 .flow_control = CS_LIB_FLOW_CONTROL_REQUIRED
211 },
212 { /* 3 */
213 .lib_handler_fn = message_handler_req_lib_cfg_tryshutdown,
214 .flow_control = CS_LIB_FLOW_CONTROL_REQUIRED
215 },
216 { /* 4 */
217 .lib_handler_fn = message_handler_req_lib_cfg_replytoshutdown,
218 .flow_control = CS_LIB_FLOW_CONTROL_REQUIRED
219 },
220 { /* 5 */
221 .lib_handler_fn = message_handler_req_lib_cfg_get_node_addrs,
223 },
224 { /* 6 */
225 .lib_handler_fn = message_handler_req_lib_cfg_local_get,
227 },
228 { /* 7 */
229 .lib_handler_fn = message_handler_req_lib_cfg_reload_config,
230 .flow_control = CS_LIB_FLOW_CONTROL_REQUIRED
231 },
232 { /* 8 */
233 .lib_handler_fn = message_handler_req_lib_cfg_reopen_log_files,
235 },
236 { /* 9 */
237 .lib_handler_fn = message_handler_req_lib_cfg_nodestatusget,
239 },
240 { /* 10 */
241 .lib_handler_fn = message_handler_req_lib_cfg_trackstart,
242 .flow_control = CS_LIB_FLOW_CONTROL_REQUIRED
243 },
244 { /* 11 */
245 .lib_handler_fn = message_handler_req_lib_cfg_trackstop,
246 .flow_control = CS_LIB_FLOW_CONTROL_REQUIRED
247 },
248
249};
250
251static struct corosync_exec_handler cfg_exec_engine[] =
252{
253 { /* 0 */
254 .exec_handler_fn = message_handler_req_exec_cfg_ringreenable,
255 },
256 { /* 1 */
257 .exec_handler_fn = message_handler_req_exec_cfg_killnode,
258 .exec_endian_convert_fn = exec_cfg_killnode_endian_convert
259 },
260 { /* 2 */
261 .exec_handler_fn = message_handler_req_exec_cfg_shutdown,
262 },
263 { /* 3 */
264 .exec_handler_fn = message_handler_req_exec_cfg_reload_config,
265 },
266 { /* 4 */
267 .exec_handler_fn = message_handler_req_exec_cfg_reconfig_crypto,
268 }
269};
270
271/*
272 * Exports the interface for the service
273 */
275 .name = "corosync configuration service",
276 .id = CFG_SERVICE,
277 .priority = 1,
278 .private_data_size = sizeof(struct cfg_info),
279 .flow_control = CS_LIB_FLOW_CONTROL_NOT_REQUIRED,
280 .allow_inquorate = CS_LIB_ALLOW_INQUORATE,
281 .lib_init_fn = cfg_lib_init_fn,
282 .lib_exit_fn = cfg_lib_exit_fn,
283 .lib_engine = cfg_lib_engine,
284 .lib_engine_count = sizeof (cfg_lib_engine) / sizeof (struct corosync_lib_handler),
285 .exec_init_fn = cfg_exec_init_fn,
286 .exec_engine = cfg_exec_engine,
287 .exec_engine_count = sizeof (cfg_exec_engine) / sizeof (struct corosync_exec_handler),
288 .confchg_fn = cfg_confchg_fn
289};
290
295
300
305
310
316
320
321/* IMPL */
322
323static char *cfg_exec_init_fn (
325{
326 api = corosync_api_v1;
327
328 qb_list_init(&trackers_list);
329 return (NULL);
330}
331
332static void cfg_confchg_fn (
334 const unsigned int *member_list, size_t member_list_entries,
335 const unsigned int *left_list, size_t left_list_entries,
336 const unsigned int *joined_list, size_t joined_list_entries,
337 const struct memb_ring_id *ring_id)
338{
339}
340
341/*
342 * Tell other nodes we are shutting down
343 */
344static int send_shutdown(void)
345{
347 struct iovec iovec;
348
349 ENTER();
350 req_exec_cfg_shutdown.header.size =
351 sizeof (struct req_exec_cfg_shutdown);
354
355 iovec.iov_base = (char *)&req_exec_cfg_shutdown;
356 iovec.iov_len = sizeof (struct req_exec_cfg_shutdown);
357
358 assert (api->totem_mcast (&iovec, 1, TOTEM_SAFE) == 0);
359
360 LEAVE();
361 return 0;
362}
363
364static void send_test_shutdown(void *only_conn, void *exclude_conn, int status)
365{
367 struct qb_list_head *iter;
368
369 ENTER();
370 res_lib_cfg_testshutdown.header.size = sizeof(struct res_lib_cfg_testshutdown);
372 res_lib_cfg_testshutdown.header.error = status;
373 res_lib_cfg_testshutdown.flags = shutdown_flags;
374
375 if (only_conn) {
376 TRACE1("sending testshutdown to only %p", only_conn);
379 } else {
380 qb_list_for_each(iter, &trackers_list) {
381 struct cfg_info *ci = qb_list_entry(iter, struct cfg_info, list);
382
383 if (ci->conn != exclude_conn) {
384 TRACE1("sending testshutdown to %p", ci->tracker_conn);
385 api->ipc_dispatch_send(ci->tracker_conn, &res_lib_cfg_testshutdown,
387 }
388 }
389 }
390 LEAVE();
391}
392
393static void check_shutdown_status(void)
394{
395 ENTER();
396
397 /*
398 * Shutdown client might have gone away
399 */
400 if (!shutdown_con) {
401 LEAVE();
402 return;
403 }
404
405 /*
406 * All replies safely gathered in ?
407 */
408 if (shutdown_yes + shutdown_no >= shutdown_expected) {
410
411 api->timer_delete(shutdown_timer);
412
413 if (shutdown_yes >= shutdown_expected ||
414 shutdown_flags == CFG_SHUTDOWN_FLAG_REGARDLESS) {
415 TRACE1("shutdown confirmed");
416
417 res_lib_cfg_tryshutdown.header.size = sizeof(struct res_lib_cfg_tryshutdown);
419 res_lib_cfg_tryshutdown.header.error = CS_OK;
420
421 /*
422 * Tell originator that shutdown was confirmed
423 */
426 shutdown_con = NULL;
427
428 /*
429 * Tell other nodes we are going down
430 */
431 send_shutdown();
432
433 }
434 else {
435
436 TRACE1("shutdown cancelled");
437 res_lib_cfg_tryshutdown.header.size = sizeof(struct res_lib_cfg_tryshutdown);
440
441 /*
442 * Tell originator that shutdown was cancelled
443 */
446 shutdown_con = NULL;
447 }
448
449 log_printf(LOGSYS_LEVEL_DEBUG, "shutdown decision is: (yes count: %d, no count: %d) flags=%x",
450 shutdown_yes, shutdown_no, shutdown_flags);
451 }
452 LEAVE();
453}
454
455
456/*
457 * Not all nodes responded to the shutdown (in time)
458 */
459static void shutdown_timer_fn(void *arg)
460{
461 ENTER();
462
463 /*
464 * Mark undecideds as "NO"
465 */
466 shutdown_no = shutdown_expected;
467 check_shutdown_status();
468
469 send_test_shutdown(NULL, NULL, CS_ERR_TIMEOUT);
470 LEAVE();
471}
472
473static void remove_ci_from_shutdown(struct cfg_info *ci)
474{
475 ENTER();
476
477 /*
478 * If the controlling shutdown process has quit, then cancel the
479 * shutdown session
480 */
481 if (ci == shutdown_con) {
482 shutdown_con = NULL;
483 api->timer_delete(shutdown_timer);
484 }
485
486 if (!qb_list_empty(&ci->list)) {
487 qb_list_del(&ci->list);
488 qb_list_init(&ci->list);
489
490 /*
491 * Remove our option
492 */
493 if (shutdown_con) {
494 if (ci->shutdown_reply == SHUTDOWN_REPLY_YES)
495 shutdown_yes--;
496 if (ci->shutdown_reply == SHUTDOWN_REPLY_NO)
497 shutdown_no--;
498 }
499
500 /*
501 * If we are leaving, then that's an implicit YES to shutdown
502 */
503 ci->shutdown_reply = SHUTDOWN_REPLY_YES;
504 shutdown_yes++;
505
506 check_shutdown_status();
507 }
508 LEAVE();
509}
510
511
512int cfg_lib_exit_fn (void *conn)
513{
514 struct cfg_info *ci = (struct cfg_info *)api->ipc_private_data_get (conn);
515
516 ENTER();
517 remove_ci_from_shutdown(ci);
518 LEAVE();
519 return (0);
520}
521
522static int cfg_lib_init_fn (void *conn)
523{
524 struct cfg_info *ci = (struct cfg_info *)api->ipc_private_data_get (conn);
525
526 ENTER();
527 qb_list_init(&ci->list);
528 LEAVE();
529
530 return (0);
531}
532
533/*
534 * Executive message handlers
535 */
536static void message_handler_req_exec_cfg_ringreenable (
537 const void *message,
538 unsigned int nodeid)
539{
540 ENTER();
541
542 LEAVE();
543}
544
545static void exec_cfg_killnode_endian_convert (void *msg)
546{
548 (struct req_exec_cfg_killnode *)msg;
549 ENTER();
550
551 swab_mar_name_t(&req_exec_cfg_killnode->reason);
552 LEAVE();
553}
554
555
556static void message_handler_req_exec_cfg_killnode (
557 const void *message,
558 unsigned int nodeid)
559{
561 cs_name_t reason;
562
563 ENTER();
564 log_printf(LOGSYS_LEVEL_DEBUG, "request to kill node " CS_PRI_NODE_ID " (us=" CS_PRI_NODE_ID ")",
566 if (req_exec_cfg_killnode->nodeid == api->totem_nodeid_get()) {
567 marshall_from_mar_name_t(&reason, &req_exec_cfg_killnode->reason);
568 log_printf(LOGSYS_LEVEL_NOTICE, "Killed by node " CS_PRI_NODE_ID " : %s",
569 nodeid, reason.value);
571 }
572 LEAVE();
573}
574
575/*
576 * Self shutdown
577 */
578static void message_handler_req_exec_cfg_shutdown (
579 const void *message,
580 unsigned int nodeid)
581{
582 ENTER();
583
584 log_printf(LOGSYS_LEVEL_NOTICE, "Node " CS_PRI_NODE_ID " was shut down by sysadmin", nodeid);
585 if (nodeid == api->totem_nodeid_get()) {
586 api->shutdown_request();
587 }
588 LEAVE();
589}
590
591/* strcmp replacement that can handle NULLs */
592static int nullcheck_strcmp(const char* left, const char *right)
593{
594 if (!left && right)
595 return -1;
596 if (left && !right)
597 return 1;
598
599 if (!left && !right)
600 return 0;
601
602 return strcmp(left, right);
603}
604
605/*
606 * If a key has changed value in the new file, then warn the user and remove it from the temp_map
607 */
608static void delete_and_notify_if_changed(icmap_map_t temp_map, const char *key_name)
609{
610 if (!(icmap_key_value_eq(temp_map, key_name, icmap_get_global_map(), key_name))) {
611 if (icmap_delete_r(temp_map, key_name) == CS_OK) {
612 log_printf(LOGSYS_LEVEL_NOTICE, "Modified entry '%s' in corosync.conf cannot be changed at run-time", key_name);
613 }
614 }
615}
616/*
617 * Remove any keys from the new config file that in the new corosync.conf but that
618 * cannot be changed at run time. A log message will be issued for each
619 * entry that the user wants to change but they cannot.
620 *
621 * Add more here as needed.
622 */
623static void remove_ro_entries(icmap_map_t temp_map)
624{
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");
631#endif
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");
651}
652
653/*
654 * Remove entries that exist in the global map, but not in the temp_map, this will
655 * cause delete notifications to be sent to any listeners.
656 *
657 * NOTE: This routine depends entirely on the keys returned by the iterators
658 * being in alpha-sorted order.
659 */
660static void remove_deleted_entries(icmap_map_t temp_map, const char *prefix)
661{
664 const char *old_key, *new_key;
665 int ret;
666
667 old_iter = icmap_iter_init(prefix);
669
672
673 while (old_key || new_key) {
674 ret = nullcheck_strcmp(old_key, new_key);
675 if ((ret < 0 && old_key) || !new_key) {
676 /*
677 * new_key is greater, a line (or more) has been deleted
678 * Continue until old is >= new
679 */
680 do {
681 /* Remove it from icmap & send notifications */
683
685 ret = nullcheck_strcmp(old_key, new_key);
686 } while (ret < 0 && old_key);
687 }
688 else if ((ret > 0 && new_key) || !old_key) {
689 /*
690 * old_key is greater, a line (or more) has been added
691 * Continue until new is >= old
692 *
693 * we don't need to do anything special with this like tell
694 * icmap. That will happen when we copy the values over
695 */
696 do {
698 ret = nullcheck_strcmp(old_key, new_key);
699 } while (ret > 0 && new_key);
700 }
701 if (ret == 0) {
704 }
705 }
708}
709
710/*
711 * Reload configuration file
712 */
713static void message_handler_req_exec_cfg_reload_config (
714 const void *message,
715 unsigned int nodeid)
716{
721 const char *error_string;
722 int res = CS_OK;
723
724 ENTER();
725
726 log_printf(LOGSYS_LEVEL_NOTICE, "Config reload requested by node " CS_PRI_NODE_ID, nodeid);
727
728 // Clear this out in case it all goes well
729 icmap_delete("config.reload_error_message");
730
731 icmap_set_uint8("config.totemconfig_reload_in_progress", 1);
732
733 /* Make sure there is no rubbish in this that might be checked, even on error */
734 memset(&new_config, 0, sizeof(new_config));
735 /*
736 * Set up a new hashtable as a staging area.
737 */
738 if ((res = icmap_init_r(&temp_map)) != CS_OK) {
739 log_printf(LOGSYS_LEVEL_ERROR, "Unable to create temporary icmap. config file reload cancelled\n");
741 }
742
743 /*
744 * Load new config into the temporary map
745 */
747 if (res == -1) {
748 log_printf (LOGSYS_LEVEL_ERROR, "Unable to reload config file: %s", error_string);
751 }
752
753 /* Signal start of the reload process */
754 icmap_set_uint8("config.reload_in_progress", 1);
755
756 /* Detect deleted entries and remove them from the main icmap hashtable */
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.");
763
764 /* Remove entries that cannot be changed */
765 remove_ro_entries(temp_map);
766
767 /* Take a copy of the current setup so we can check what has changed */
768 memset(&new_config, 0, sizeof(new_config));
769 new_config.orig_interfaces = malloc (sizeof (struct totem_interface) * INTERFACE_MAX);
770 assert(new_config.orig_interfaces != NULL);
771
773 new_config.crypto_changed = 0;
774
775 new_config.interfaces = malloc (sizeof (struct totem_interface) * INTERFACE_MAX);
776 assert(new_config.interfaces != NULL);
777 memset(new_config.interfaces, 0, sizeof (struct totem_interface) * INTERFACE_MAX);
778
779 /* For UDP[U] the configuration on link0 is static (apart from the nodelist) and only read at
780 startup. So preserve it here */
781 if ( (new_config.transport_number == TOTEM_TRANSPORT_UDP) ||
782 (new_config.transport_number == TOTEM_TRANSPORT_UDPU)) {
783 memcpy(&new_config.interfaces[0], &new_config.orig_interfaces[0],
784 sizeof(struct totem_interface));
785 }
786
787 /* Calculate new node and interface definitions */
789 log_printf (LOGSYS_LEVEL_ERROR, "Cannot configure new interface definitions: %s\n", error_string);
791 goto reload_fini;
792 }
793
794 /* Read from temp_map into new_config */
796
797 /* Get updated crypto parameters. Will set a flag in new_config if things have changed */
799 log_printf (LOGSYS_LEVEL_ERROR, "Crypto configuration is not valid: %s\n", error_string);
801 goto reload_fini;
802 }
803
804 /* knet ping timers when unset depends on token timeout so this needs to be done last of all */
806
807 /* Validate dynamic parameters */
809 log_printf (LOGSYS_LEVEL_ERROR, "Configuration is not valid: %s\n", error_string);
811 goto reload_fini;
812 }
813
814 /* Save this here so we can get at it for the later phases of crypto change */
815 if (new_config.crypto_changed) {
816#ifndef HAVE_KNET_CRYPTO_RECONF
817 new_config.crypto_changed = 0;
818 log_printf (LOGSYS_LEVEL_ERROR, "Crypto reconfiguration is not supported by the linked version of knet\n");
820 goto reload_fini;
821#endif
822 }
823
824 /*
825 * Copy new keys into live config.
826 */
828 log_printf (LOGSYS_LEVEL_ERROR, "Error making new config live. cmap database may be inconsistent\n");
829 /* Return res from icmap */
830 goto reload_fini;
831 }
832
833 /* Copy into live system */
836
838 /* All done - let clients know */
839 icmap_set_int32("config.reload_status", res);
840 icmap_set_uint8("config.totemconfig_reload_in_progress", 0);
841 icmap_set_uint8("config.reload_in_progress", 0);
842
843 /* Finished with the temporary storage */
844 free(new_config.interfaces);
845 free(new_config.orig_interfaces);
846
849
851
852 /* If crypto was changed, now it's loaded on all nodes we can enable it.
853 * Each node sends its own PHASE message so we're not relying on the leader
854 * node to survive the transition
855 */
856 if (new_config.crypto_changed) {
858 struct iovec iovec;
859
860 req_exec_cfg_crypto_reconfig.header.size =
861 sizeof (struct req_exec_cfg_crypto_reconfig);
865
866 iovec.iov_base = (char *)&req_exec_cfg_crypto_reconfig;
867 iovec.iov_len = sizeof (struct req_exec_cfg_crypto_reconfig);
868
869 assert (api->totem_mcast (&iovec, 1, TOTEM_SAFE) == 0);
870 }
871
872 /* All done, return result to the caller if it was on this system */
873 if (nodeid == api->totem_nodeid_get()) {
876 res_lib_cfg_reload_config.header.error = res;
880 api->ipc_refcnt_dec(req_exec_cfg_reload_config->source.conn);;
881 }
882
883 LEAVE();
884}
885
886/* Handle the phases of crypto reload
887 * The first time we are called is after the new crypto config has been loaded
888 * but not activated.
889 *
890 * 1 - activate the new crypto configuration
891 * 2 - clear out the old configuration
892 */
893static void message_handler_req_exec_cfg_reconfig_crypto (
894 const void *message,
895 unsigned int nodeid)
896{
898
899 /* Got our own reconfig message */
900 if (nodeid == api->totem_nodeid_get()) {
901 log_printf (LOGSYS_LEVEL_DEBUG, "Crypto reconfiguration phase %d", req_exec_cfg_crypto_reconfig->phase);
902
903 /* Do the deed */
905
906 /* Move to the next phase if not finished */
909 struct iovec iovec;
910
912 sizeof (struct req_exec_cfg_crypto_reconfig);
916
917 iovec.iov_base = (char *)&req_exec_cfg_crypto_reconfig2;
918 iovec.iov_len = sizeof (struct req_exec_cfg_crypto_reconfig);
919
920 assert (api->totem_mcast (&iovec, 1, TOTEM_SAFE) == 0);
921 }
922 }
923}
924
925
926/*
927 * Library Interface Implementation
928 */
929static void message_handler_req_lib_cfg_ringstatusget (
930 void *conn,
931 const void *msg)
932{
934 struct totem_ip_address interfaces[INTERFACE_MAX];
935 unsigned int iface_count;
936 char **status;
937 const char *totem_ip_string;
939 unsigned int iface_ids[INTERFACE_MAX];
940 unsigned int i;
942
943 ENTER();
944
946 res_lib_cfg_ringstatusget.header.size = sizeof (struct res_lib_cfg_ringstatusget);
947
948 api->totem_ifaces_get (
949 api->totem_nodeid_get(),
950 iface_ids,
951 interfaces,
953 &status,
954 &iface_count);
955
957
958 res_lib_cfg_ringstatusget.interface_count = iface_count;
959
960 for (i = 0; i < iface_count; i++) {
962 = (const char *)api->totem_ip_print (&interfaces[i]);
963
964 if (!totem_ip_string) {
966 }
967
968 /* Allow for i/f number at the start */
970 log_printf(LOGSYS_LEVEL_ERROR, "String representation of interface %u is too long", i);
972 goto send_response;
973 }
974 snprintf(ifname, sizeof(ifname), "%d %s", iface_ids[i], totem_ip_string);
975
977 log_printf(LOGSYS_LEVEL_ERROR, "Status string for interface %u is too long", i);
979 goto send_response;
980 }
981
982 strcpy ((char *)&res_lib_cfg_ringstatusget.interface_status[i],
983 status[i]);
984 strcpy ((char *)&res_lib_cfg_ringstatusget.interface_name[i],
985 ifname);
986 }
987
989 res_lib_cfg_ringstatusget.header.error = res;
990 api->ipc_response_send (
991 conn,
993 sizeof (struct res_lib_cfg_ringstatusget));
994
995 LEAVE();
996}
997
998
999static void message_handler_req_lib_cfg_nodestatusget (
1000 void *conn,
1001 const void *msg)
1002{
1009 int i;
1010
1011 ENTER();
1012
1013 memset(&node_status, 0, sizeof(node_status));
1017
1021
1022 goto ipc_response_send;
1023 }
1024
1025 /* Currently only one structure version supported */
1026 switch (req_lib_cfg_nodestatusget->version) {
1027 case CFG_NODE_STATUS_V1:
1030
1031 res_lib_cfg_nodestatusget_v1.header.error = CS_OK;
1034
1036 res_lib_cfg_nodestatusget_v1.node_status.nodeid = req_lib_cfg_nodestatusget->nodeid;
1037 res_lib_cfg_nodestatusget_v1.node_status.reachable = node_status.reachable;
1038 res_lib_cfg_nodestatusget_v1.node_status.remote = node_status.remote;
1039 res_lib_cfg_nodestatusget_v1.node_status.external = node_status.external;
1040 res_lib_cfg_nodestatusget_v1.node_status.onwire_min = node_status.onwire_min;
1041 res_lib_cfg_nodestatusget_v1.node_status.onwire_max = node_status.onwire_max;
1042 res_lib_cfg_nodestatusget_v1.node_status.onwire_ver = node_status.onwire_ver;
1043
1044 for (i=0; i < KNET_MAX_LINK; i++) {
1045 res_lib_cfg_nodestatusget_v1.node_status.link_status[i].enabled = node_status.link_status[i].enabled;
1046 res_lib_cfg_nodestatusget_v1.node_status.link_status[i].connected = node_status.link_status[i].connected;
1047 res_lib_cfg_nodestatusget_v1.node_status.link_status[i].dynconnected = node_status.link_status[i].dynconnected;
1048 res_lib_cfg_nodestatusget_v1.node_status.link_status[i].mtu = node_status.link_status[i].mtu;
1049 memcpy(res_lib_cfg_nodestatusget_v1.node_status.link_status[i].src_ipaddr,
1050 node_status.link_status[i].src_ipaddr, CFG_MAX_HOST_LEN);
1051 memcpy(res_lib_cfg_nodestatusget_v1.node_status.link_status[i].dst_ipaddr,
1052 node_status.link_status[i].dst_ipaddr, CFG_MAX_HOST_LEN);
1053 }
1054 break;
1055 default:
1056 /*
1057 * Unsupported version requested
1058 */
1061
1065 break;
1066 }
1067
1068ipc_response_send:
1069 api->ipc_response_send (
1070 conn,
1073
1074 LEAVE();
1075}
1076
1077static void message_handler_req_lib_cfg_trackstart (
1078 void *conn,
1079 const void *msg)
1080{
1081 struct cfg_info *ci = (struct cfg_info *)api->ipc_private_data_get (conn);
1083
1084 ENTER();
1085
1086 /*
1087 * We only do shutdown tracking at the moment
1088 */
1089 if (qb_list_empty(&ci->list)) {
1090 qb_list_add(&ci->list, &trackers_list);
1091 ci->tracker_conn = conn;
1092
1093 if (shutdown_con) {
1094 /*
1095 * Shutdown already in progress, ask the newcomer's opinion
1096 */
1097 ci->shutdown_reply = SHUTDOWN_REPLY_UNKNOWN;
1098 shutdown_expected++;
1099 send_test_shutdown(conn, NULL, CS_OK);
1100 }
1101 }
1102
1106
1108 sizeof(res_lib_cfg_trackstart));
1109
1110 LEAVE();
1111}
1112
1113static void message_handler_req_lib_cfg_trackstop (
1114 void *conn,
1115 const void *msg)
1116{
1117 struct cfg_info *ci = (struct cfg_info *)api->ipc_private_data_get (conn);
1119
1120 ENTER();
1121 remove_ci_from_shutdown(ci);
1122
1126
1128 sizeof(res_lib_cfg_trackstop));
1129 LEAVE();
1130}
1131
1132static void message_handler_req_lib_cfg_ringreenable (
1133 void *conn,
1134 const void *msg)
1135{
1137 ENTER();
1138
1140 res_lib_cfg_ringreenable.header.size = sizeof (struct res_lib_cfg_ringreenable);
1142 api->ipc_response_send (
1144 sizeof (struct res_lib_cfg_ringreenable));
1145
1146 LEAVE();
1147}
1148
1149static void message_handler_req_lib_cfg_killnode (
1150 void *conn,
1151 const void *msg)
1152{
1153 const struct req_lib_cfg_killnode *req_lib_cfg_killnode = msg;
1156 struct iovec iovec;
1157 char key_name[ICMAP_KEYNAME_MAXLEN];
1158 char tmp_key[ICMAP_KEYNAME_MAXLEN + 1];
1161 const char *iter_key;
1163 char *status_str = NULL;
1164 int match_nodeid_flag = 0;
1166
1167 ENTER();
1168
1170 iter = icmap_iter_init_r(map, "runtime.members.");
1171 while ((iter_key = icmap_iter_next(iter, NULL, NULL)) != NULL) {
1172 if (sscanf(iter_key, "runtime.members.%u.%s", &nodeid, key_name) != 2) {
1173 continue;
1174 }
1175 if (strcmp(key_name, "status") != 0) {
1176 continue;
1177 }
1178 if (nodeid != req_lib_cfg_killnode->nodeid) {
1179 continue;
1180 }
1182 snprintf(tmp_key, ICMAP_KEYNAME_MAXLEN, "runtime.members.%u.status", nodeid);
1185 goto send_response;
1186 }
1187 if (strcmp(status_str, "joined") != 0) {
1189 goto send_response;
1190 }
1191 break;
1192 }
1193
1194 if (!match_nodeid_flag) {
1196 goto send_response;
1197 }
1198
1199 req_exec_cfg_killnode.header.size =
1200 sizeof (struct req_exec_cfg_killnode);
1204 marshall_to_mar_name_t(&req_exec_cfg_killnode.reason, &req_lib_cfg_killnode->reason);
1205
1206 iovec.iov_base = (char *)&req_exec_cfg_killnode;
1207 iovec.iov_len = sizeof (struct req_exec_cfg_killnode);
1208
1209 (void)api->totem_mcast (&iovec, 1, TOTEM_SAFE);
1210
1212 res_lib_cfg_killnode.header.size = sizeof(struct res_lib_cfg_killnode);
1214 res_lib_cfg_killnode.header.error = error;
1215
1217 sizeof(res_lib_cfg_killnode));
1218
1221 LEAVE();
1222}
1223
1224
1225static void message_handler_req_lib_cfg_tryshutdown (
1226 void *conn,
1227 const void *msg)
1228{
1229 struct cfg_info *ci = (struct cfg_info *)api->ipc_private_data_get (conn);
1231 struct qb_list_head *iter;
1232
1233 ENTER();
1234
1237
1238 /*
1239 * Tell other nodes
1240 */
1241 send_shutdown();
1242
1243 res_lib_cfg_tryshutdown.header.size = sizeof(struct res_lib_cfg_tryshutdown);
1245 res_lib_cfg_tryshutdown.header.error = CS_OK;
1247 sizeof(res_lib_cfg_tryshutdown));
1248
1249 LEAVE();
1250 return;
1251 }
1252
1253 /*
1254 * Shutdown in progress, return an error
1255 */
1256 if (shutdown_con) {
1258
1259 res_lib_cfg_tryshutdown.header.size = sizeof(struct res_lib_cfg_tryshutdown);
1262
1264 sizeof(res_lib_cfg_tryshutdown));
1265
1266
1267 LEAVE();
1268
1269 return;
1270 }
1271
1272 ci->conn = conn;
1273 shutdown_con = (struct cfg_info *)api->ipc_private_data_get (conn);
1274 shutdown_flags = req_lib_cfg_tryshutdown->flags;
1275 shutdown_yes = 0;
1276 shutdown_no = 0;
1277
1278 /*
1279 * Count the number of listeners
1280 */
1281 shutdown_expected = 0;
1282
1283 qb_list_for_each(iter, &trackers_list) {
1284 struct cfg_info *testci = qb_list_entry(iter, struct cfg_info, list);
1285 /*
1286 * It is assumed that we will allow shutdown
1287 */
1288 if (testci != ci) {
1289 testci->shutdown_reply = SHUTDOWN_REPLY_UNKNOWN;
1290 shutdown_expected++;
1291 }
1292 }
1293
1294 /*
1295 * If no-one is listening for events then we can just go down now
1296 */
1297 if (shutdown_expected == 0) {
1299
1300 res_lib_cfg_tryshutdown.header.size = sizeof(struct res_lib_cfg_tryshutdown);
1302 res_lib_cfg_tryshutdown.header.error = CS_OK;
1303
1304 /*
1305 * Tell originator that shutdown was confirmed
1306 */
1308 sizeof(res_lib_cfg_tryshutdown));
1309
1310 send_shutdown();
1311 LEAVE();
1312 return;
1313 }
1314 else {
1316
1317 /*
1318 * Look for a shutdown timeout in configuration map
1319 */
1320 icmap_get_uint32("cfg.shutdown_timeout", &shutdown_timeout);
1321
1322 /*
1323 * Start the timer. If we don't get a full set of replies before this goes
1324 * off we'll cancel the shutdown
1325 */
1327 shutdown_timer_fn, &shutdown_timer);
1328
1329 /*
1330 * Tell the users we would like to shut down
1331 */
1332 send_test_shutdown(NULL, conn, CS_OK);
1333 }
1334
1335 /*
1336 * We don't sent a reply to the caller here.
1337 * We send it when we know if we can shut down or not
1338 */
1339
1340 LEAVE();
1341}
1342
1343static void message_handler_req_lib_cfg_replytoshutdown (
1344 void *conn,
1345 const void *msg)
1346{
1347 struct cfg_info *ci = (struct cfg_info *)api->ipc_private_data_get (conn);
1350 int status = CS_OK;
1351
1352 ENTER();
1353 if (!shutdown_con) {
1355 goto exit_fn;
1356 }
1357
1359 shutdown_yes++;
1360 ci->shutdown_reply = SHUTDOWN_REPLY_YES;
1361 }
1362 else {
1363 shutdown_no++;
1364 ci->shutdown_reply = SHUTDOWN_REPLY_NO;
1365 }
1366 check_shutdown_status();
1367
1368exit_fn:
1369 res_lib_cfg_replytoshutdown.header.error = status;
1372
1375
1376 LEAVE();
1377}
1378
1379static void message_handler_req_lib_cfg_get_node_addrs (void *conn,
1380 const void *msg)
1381{
1383 unsigned int iface_ids[INTERFACE_MAX];
1384 char **status;
1385 unsigned int num_interfaces = 0;
1386 int ret = CS_OK;
1387 int i;
1388 int live_addrs = 0;
1393 char *addr_buf;
1394
1395 if (nodeid == 0)
1396 nodeid = api->totem_nodeid_get();
1397
1399 ret = CS_ERR_EXIST;
1400 num_interfaces = 0;
1401 }
1402
1406
1409 res_lib_cfg_get_node_addrs->header.error = ret;
1410 if (num_interfaces) {
1412 for (i = 0, addr_buf = (char *)res_lib_cfg_get_node_addrs->addrs;
1413 i < num_interfaces; i++) {
1414 if (node_ifs[i].family) {
1416 live_addrs++;
1418 }
1419 }
1421 } else {
1423 }
1425}
1426
1427static void message_handler_req_lib_cfg_local_get (void *conn, const void *msg)
1428{
1430
1431 res_lib_cfg_local_get.header.size = sizeof(res_lib_cfg_local_get);
1433 res_lib_cfg_local_get.header.error = CS_OK;
1434 res_lib_cfg_local_get.local_nodeid = api->totem_nodeid_get ();
1435
1437 sizeof(res_lib_cfg_local_get));
1438}
1439
1440static void message_handler_req_lib_cfg_reload_config (void *conn, const void *msg)
1441{
1443 struct iovec iovec;
1444
1445 ENTER();
1446
1447 req_exec_cfg_reload_config.header.size =
1448 sizeof (struct req_exec_cfg_reload_config);
1451 api->ipc_source_set (&req_exec_cfg_reload_config.source, conn);
1452 api->ipc_refcnt_inc(conn);
1453
1454 iovec.iov_base = (char *)&req_exec_cfg_reload_config;
1455 iovec.iov_len = sizeof (struct req_exec_cfg_reload_config);
1456
1457 assert (api->totem_mcast (&iovec, 1, TOTEM_SAFE) == 0);
1458
1459 LEAVE();
1460}
1461
1462static void message_handler_req_lib_cfg_reopen_log_files (void *conn, const void *msg)
1463{
1466
1467 ENTER();
1468
1469 log_printf(LOGSYS_LEVEL_DEBUG, "Reopening logging files\n");
1470
1472
1475 res_lib_cfg_reopen_log_files.header.error = res;
1476 api->ipc_response_send(conn,
1479
1480 LEAVE();
1481}
@ CFG_NODE_STATUS_V1
Definition cfg.h:166
#define CFG_MAX_HOST_LEN
Definition cfg.h:169
#define SERVICE_ID_MAKE(a, b)
Definition coroapi.h:458
totem_configuration_type
The totem_configuration_type enum.
Definition coroapi.h:132
#define INTERFACE_MAX
Definition coroapi.h:88
unsigned short family
Definition coroapi.h:1
@ CS_LIB_ALLOW_INQUORATE
Definition coroapi.h:164
qb_loop_timer_handle corosync_timer_handle_t
corosync_timer_handle_t
Definition coroapi.h:74
unsigned int nodeid
Definition coroapi.h:0
#define corosync_fatal_error(err)
Definition coroapi.h:424
unsigned char addr[TOTEMIP_ADDRLEN]
Definition coroapi.h:2
@ CS_LIB_FLOW_CONTROL_REQUIRED
Definition coroapi.h:152
@ CS_LIB_FLOW_CONTROL_NOT_REQUIRED
Definition coroapi.h:153
@ COROSYNC_FATAL_ERROR_EXIT
Definition coroapi.h:184
#define TOTEM_SAFE
Definition coroapi.h:103
#define TOTEMIP_ADDRLEN
Definition coroapi.h:86
@ CFG_SERVICE
Definition corodefs.h:45
int coroparse_configparse(icmap_map_t config_map, const char **error_string)
Definition coroparse.c:260
#define CS_PRI_NODE_ID
Definition corotypes.h:59
cs_error_t
The cs_error_t enum.
Definition corotypes.h:98
@ CS_ERR_NAME_TOO_LONG
Definition corotypes.h:111
@ CS_ERR_ACCESS
Definition corotypes.h:109
@ CS_ERR_BUSY
Definition corotypes.h:108
@ CS_ERR_TIMEOUT
Definition corotypes.h:103
@ CS_OK
Definition corotypes.h:99
@ CS_ERR_INVALID_PARAM
Definition corotypes.h:105
@ CS_ERR_LIBRARY
Definition corotypes.h:100
@ CS_ERR_FAILED_OPERATION
Definition corotypes.h:119
@ CS_ERR_NOT_EXIST
Definition corotypes.h:110
@ CS_ERR_EXIST
Definition corotypes.h:112
@ CS_ERR_NOT_SUPPORTED
Definition corotypes.h:117
struct corosync_service_engine cfg_service_engine
Definition exec/cfg.c:274
cfg_message_req_types
Definition exec/cfg.c:79
@ MESSAGE_REQ_EXEC_CFG_RELOAD_CONFIG
Definition exec/cfg.c:83
@ MESSAGE_REQ_EXEC_CFG_SHUTDOWN
Definition exec/cfg.c:82
@ MESSAGE_REQ_EXEC_CFG_RINGREENABLE
Definition exec/cfg.c:80
@ MESSAGE_REQ_EXEC_CFG_KILLNODE
Definition exec/cfg.c:81
@ MESSAGE_REQ_EXEC_CFG_CRYPTO_RECONFIG
Definition exec/cfg.c:84
#define DEFAULT_SHUTDOWN_TIMEOUT
Definition exec/cfg.c:88
struct corosync_service_engine * cfg_get_service_engine_ver0(void)
Definition exec/cfg.c:291
icmap_iter_t icmap_iter_init_r(const icmap_map_t map, const char *prefix)
icmap_iter_init_r
Definition icmap.c:1088
cs_error_t icmap_get_string_r(const icmap_map_t map, const char *key_name, char **str)
Definition icmap.c:739
cs_error_t icmap_get_uint32(const char *key_name, uint32_t *u32)
Definition icmap.c:896
cs_error_t icmap_set_uint8(const char *key_name, uint8_t value)
Definition icmap.c:577
cs_error_t icmap_delete(const char *key_name)
Delete key from map.
Definition icmap.c:657
cs_error_t icmap_set_int32(const char *key_name, int32_t value)
Definition icmap.c:595
cs_error_t icmap_delete_r(const icmap_map_t map, const char *key_name)
icmap_delete_r
Definition icmap.c:637
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.
Definition icmap.c:389
icmap_iter_t icmap_iter_init(const char *prefix)
Initialize iterator with given prefix.
Definition icmap.c:1093
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.
Definition icmap.c:1302
cs_error_t icmap_init_r(icmap_map_t *result)
Initialize additional (local, reentrant) icmap_map.
Definition icmap.c:188
const char * icmap_iter_next(icmap_iter_t iter, size_t *value_len, icmap_value_types_t *type)
Return next item in iterator iter.
Definition icmap.c:1099
icmap_map_t icmap_get_global_map(void)
Return global icmap.
Definition icmap.c:268
qb_map_iter_t * icmap_iter_t
Itterator type.
Definition icmap.h:123
void icmap_iter_finalize(icmap_iter_t iter)
Finalize iterator.
Definition icmap.c:1120
void icmap_fini_r(const icmap_map_t map)
Finalize local, reentrant icmap.
Definition icmap.c:242
#define ICMAP_KEYNAME_MAXLEN
Maximum length of key in icmap.
Definition icmap.h:48
@ CFG_SHUTDOWN_FLAG_REGARDLESS
Definition ipc_cfg.h:302
@ CFG_SHUTDOWN_FLAG_IMMEDIATE
Definition ipc_cfg.h:303
#define CFG_INTERFACE_STATUS_MAX_LEN
Definition ipc_cfg.h:43
#define CFG_INTERFACE_NAME_MAX_LEN
Definition ipc_cfg.h:42
@ MESSAGE_RES_CFG_STATETRACKSTOP
Definition ipc_cfg.h:75
@ MESSAGE_RES_CFG_LOCAL_GET
Definition ipc_cfg.h:84
@ MESSAGE_RES_CFG_RELOAD_CONFIG
Definition ipc_cfg.h:86
@ MESSAGE_RES_CFG_RINGSTATUSGET
Definition ipc_cfg.h:72
@ MESSAGE_RES_CFG_TRYSHUTDOWN
Definition ipc_cfg.h:81
@ MESSAGE_RES_CFG_NODESTATUSGET
Definition ipc_cfg.h:88
@ MESSAGE_RES_CFG_GET_NODE_ADDRS
Definition ipc_cfg.h:83
@ MESSAGE_RES_CFG_REOPEN_LOG_FILES
Definition ipc_cfg.h:87
@ MESSAGE_RES_CFG_TESTSHUTDOWN
Definition ipc_cfg.h:82
@ MESSAGE_RES_CFG_STATETRACKSTART
Definition ipc_cfg.h:74
@ MESSAGE_RES_CFG_KILLNODE
Definition ipc_cfg.h:80
@ MESSAGE_RES_CFG_REPLYTOSHUTDOWN
Definition ipc_cfg.h:85
@ MESSAGE_RES_CFG_RINGREENABLE
Definition ipc_cfg.h:73
#define CFG_MAX_INTERFACES
Definition ipc_cfg.h:48
#define LOGSYS_LEVEL_ERROR
Definition logsys.h:72
#define LEAVE
Definition logsys.h:334
#define log_printf(level, format, args...)
Definition logsys.h:332
#define LOGSYS_LEVEL_NOTICE
Definition logsys.h:74
#define TRACE1(format, args...)
Definition logsys.h:335
#define LOGSYS_DECLARE_SUBSYS(subsys)
The LOGSYS_DECLARE_SUBSYS macro.
Definition logsys.h:306
cs_error_t logsys_reopen_log_files(void)
Definition logsys.c:875
#define LOGSYS_LEVEL_DEBUG
Definition logsys.h:76
#define ENTER
Definition logsys.h:333
uint32_t mar_uint32_t
Definition mar_gen.h:53
void * conn
Definition exec/cfg.c:105
enum cfg_info::@8 shutdown_reply
void * tracker_conn
Definition exec/cfg.c:106
@ SHUTDOWN_REPLY_YES
Definition exec/cfg.c:107
@ SHUTDOWN_REPLY_NO
Definition exec/cfg.c:107
@ SHUTDOWN_REPLY_UNKNOWN
Definition exec/cfg.c:107
struct qb_list_head list
Definition exec/cfg.c:104
The corosync_api_v1 struct.
Definition coroapi.h:225
int(* timer_add_duration)(unsigned long long nanoseconds_in_future, void *data, void(*timer_nf)(void *data), corosync_timer_handle_t *handle)
Definition coroapi.h:229
int(* totem_mcast)(const struct iovec *iovec, unsigned int iov_len, unsigned int guarantee)
Definition coroapi.h:279
void *(* ipc_private_data_get)(void *conn)
Definition coroapi.h:256
void(* timer_delete)(corosync_timer_handle_t timer_handle)
Definition coroapi.h:241
unsigned int(* totem_nodeid_get)(void)
Definition coroapi.h:275
const char *(* totem_ip_print)(const struct totem_ip_address *addr)
Definition coroapi.h:292
void(* ipc_refcnt_dec)(void *conn)
Definition coroapi.h:270
void(* ipc_source_set)(mar_message_source_t *source, void *conn)
Definition coroapi.h:252
void(* shutdown_request)(void)
Definition coroapi.h:429
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)
Definition coroapi.h:282
void(* ipc_refcnt_inc)(void *conn)
Definition coroapi.h:268
int(* ipc_dispatch_send)(void *conn, const void *msg, size_t mlen)
Definition coroapi.h:263
int(* ipc_response_send)(void *conn, const void *msg, size_t mlen)
Definition coroapi.h:258
The corosync_exec_handler struct.
Definition coroapi.h:475
void(* exec_handler_fn)(const void *msg, unsigned int nodeid)
Definition coroapi.h:476
The corosync_lib_handler struct.
Definition coroapi.h:467
void(* lib_handler_fn)(void *conn, const void *msg)
Definition coroapi.h:468
The corosync_service_engine struct.
Definition coroapi.h:490
const char * name
Definition coroapi.h:491
The cs_name_t struct.
Definition corotypes.h:66
uint8_t value[CS_MAX_NAME_LENGTH]
Definition corotypes.h:68
The mar_message_source_t struct.
Definition coroapi.h:50
mar_name_t struct
Definition mar_gen.h:166
The memb_ring_id struct.
Definition coroapi.h:122
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.
Definition ipc_cfg.h:201
The req_lib_cfg_killnode struct.
Definition ipc_cfg.h:147
The req_lib_cfg_nodestatusget struct.
Definition ipc_cfg.h:111
The req_lib_cfg_replytoshutdown struct.
Definition ipc_cfg.h:178
The req_lib_cfg_tryshutdown struct.
Definition ipc_cfg.h:163
unsigned int flags
Definition ipc_cfg.h:165
The res_lib_cfg_get_node_addrs struct.
Definition ipc_cfg.h:209
The res_lib_cfg_killnode struct.
Definition ipc_cfg.h:156
The res_lib_cfg_local_get struct.
Definition ipc_cfg.h:227
The res_lib_cfg_nodestatusget struct.
Definition ipc_cfg.h:125
The res_lib_cfg_reload_config struct.
Definition ipc_cfg.h:242
The res_lib_cfg_reopen_log_files struct.
Definition ipc_cfg.h:256
The res_lib_cfg_replytoshutdown struct.
Definition ipc_cfg.h:186
The res_lib_cfg_ringreenable struct.
Definition ipc_cfg.h:140
The res_lib_cfg_ringstatusget struct.
Definition ipc_cfg.h:101
The res_lib_cfg_testshutdown struct.
Definition ipc_cfg.h:193
struct qb_ipc_response_header header
Definition ipc_cfg.h:266
struct qb_ipc_response_header header
Definition ipc_cfg.h:274
The res_lib_cfg_tryshutdown struct.
Definition ipc_cfg.h:171
The totem_ip_address struct.
Definition coroapi.h:111
typedef __attribute__
@ CRYPTO_RECONFIG_PHASE_CLEANUP
Definition totem.h:156
@ CRYPTO_RECONFIG_PHASE_ACTIVATE
Definition totem.h:155
@ TOTEM_TRANSPORT_UDPU
Definition totem.h:144
@ TOTEM_TRANSPORT_UDP
Definition totem.h:143
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)
Definition totempg.c:1605
int totempg_nodestatus_get(unsigned int nodeid, struct totem_node_status *node_status)
Definition totempg.c:1453
void totempg_put_config(struct totem_config *config)
Definition totempg.c:1615
int totempg_crypto_reconfigure_phase(cfg_message_crypto_reconfig_phase_t phase)
Definition totempg.c:1574
struct memb_ring_id ring_id
Definition totemsrp.c:4
struct totem_message_header header
Definition totemsrp.c:0