cfg.c 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167
  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. #include <config.h>
  36. #include <sys/types.h>
  37. #include <sys/uio.h>
  38. #include <sys/socket.h>
  39. #include <sys/un.h>
  40. #include <netinet/in.h>
  41. #include <arpa/inet.h>
  42. #include <unistd.h>
  43. #include <fcntl.h>
  44. #include <stdlib.h>
  45. #include <stdio.h>
  46. #include <stddef.h>
  47. #include <limits.h>
  48. #include <errno.h>
  49. #include <string.h>
  50. #include <assert.h>
  51. #include <corosync/corotypes.h>
  52. #include <qb/qbipc_common.h>
  53. #include <corosync/cfg.h>
  54. #include <qb/qblist.h>
  55. #include <corosync/mar_gen.h>
  56. #include <corosync/totem/totemip.h>
  57. #include <corosync/totem/totem.h>
  58. #include <corosync/ipc_cfg.h>
  59. #include <corosync/logsys.h>
  60. #include <corosync/coroapi.h>
  61. #include <corosync/icmap.h>
  62. #include <corosync/corodefs.h>
  63. #include "totemconfig.h"
  64. #include "service.h"
  65. #include "main.h"
  66. LOGSYS_DECLARE_SUBSYS ("CFG");
  67. enum cfg_message_req_types {
  68. MESSAGE_REQ_EXEC_CFG_RINGREENABLE = 0,
  69. MESSAGE_REQ_EXEC_CFG_KILLNODE = 1,
  70. MESSAGE_REQ_EXEC_CFG_SHUTDOWN = 2,
  71. MESSAGE_REQ_EXEC_CFG_RELOAD_CONFIG = 3
  72. };
  73. #define DEFAULT_SHUTDOWN_TIMEOUT 5
  74. static struct qb_list_head trackers_list;
  75. /*
  76. * Variables controlling a requested shutdown
  77. */
  78. static corosync_timer_handle_t shutdown_timer;
  79. static struct cfg_info *shutdown_con;
  80. static uint32_t shutdown_flags;
  81. static int shutdown_yes;
  82. static int shutdown_no;
  83. static int shutdown_expected;
  84. struct cfg_info
  85. {
  86. struct qb_list_head list;
  87. void *conn;
  88. void *tracker_conn;
  89. enum {SHUTDOWN_REPLY_UNKNOWN, SHUTDOWN_REPLY_YES, SHUTDOWN_REPLY_NO} shutdown_reply;
  90. };
  91. static void cfg_confchg_fn (
  92. enum totem_configuration_type configuration_type,
  93. const unsigned int *member_list, size_t member_list_entries,
  94. const unsigned int *left_list, size_t left_list_entries,
  95. const unsigned int *joined_list, size_t joined_list_entries,
  96. const struct memb_ring_id *ring_id);
  97. static char *cfg_exec_init_fn (struct corosync_api_v1 *corosync_api_v1);
  98. static struct corosync_api_v1 *api;
  99. static int cfg_lib_init_fn (void *conn);
  100. static int cfg_lib_exit_fn (void *conn);
  101. static void message_handler_req_exec_cfg_ringreenable (
  102. const void *message,
  103. unsigned int nodeid);
  104. static void message_handler_req_exec_cfg_killnode (
  105. const void *message,
  106. unsigned int nodeid);
  107. static void message_handler_req_exec_cfg_shutdown (
  108. const void *message,
  109. unsigned int nodeid);
  110. static void message_handler_req_exec_cfg_reload_config (
  111. const void *message,
  112. unsigned int nodeid);
  113. static void exec_cfg_killnode_endian_convert (void *msg);
  114. static void message_handler_req_lib_cfg_ringstatusget (
  115. void *conn,
  116. const void *msg);
  117. static void message_handler_req_lib_cfg_ringreenable (
  118. void *conn,
  119. const void *msg);
  120. static void message_handler_req_lib_cfg_killnode (
  121. void *conn,
  122. const void *msg);
  123. static void message_handler_req_lib_cfg_tryshutdown (
  124. void *conn,
  125. const void *msg);
  126. static void message_handler_req_lib_cfg_replytoshutdown (
  127. void *conn,
  128. const void *msg);
  129. static void message_handler_req_lib_cfg_get_node_addrs (
  130. void *conn,
  131. const void *msg);
  132. static void message_handler_req_lib_cfg_local_get (
  133. void *conn,
  134. const void *msg);
  135. static void message_handler_req_lib_cfg_reload_config (
  136. void *conn,
  137. const void *msg);
  138. static void message_handler_req_lib_cfg_reopen_log_files (
  139. void *conn,
  140. const void *msg);
  141. /*
  142. * Service Handler Definition
  143. */
  144. static struct corosync_lib_handler cfg_lib_engine[] =
  145. {
  146. { /* 0 */
  147. .lib_handler_fn = message_handler_req_lib_cfg_ringstatusget,
  148. .flow_control = CS_LIB_FLOW_CONTROL_REQUIRED
  149. },
  150. { /* 1 */
  151. .lib_handler_fn = message_handler_req_lib_cfg_ringreenable,
  152. .flow_control = CS_LIB_FLOW_CONTROL_REQUIRED
  153. },
  154. { /* 2 */
  155. .lib_handler_fn = message_handler_req_lib_cfg_killnode,
  156. .flow_control = CS_LIB_FLOW_CONTROL_REQUIRED
  157. },
  158. { /* 3 */
  159. .lib_handler_fn = message_handler_req_lib_cfg_tryshutdown,
  160. .flow_control = CS_LIB_FLOW_CONTROL_REQUIRED
  161. },
  162. { /* 4 */
  163. .lib_handler_fn = message_handler_req_lib_cfg_replytoshutdown,
  164. .flow_control = CS_LIB_FLOW_CONTROL_REQUIRED
  165. },
  166. { /* 5 */
  167. .lib_handler_fn = message_handler_req_lib_cfg_get_node_addrs,
  168. .flow_control = CS_LIB_FLOW_CONTROL_NOT_REQUIRED
  169. },
  170. { /* 6 */
  171. .lib_handler_fn = message_handler_req_lib_cfg_local_get,
  172. .flow_control = CS_LIB_FLOW_CONTROL_NOT_REQUIRED
  173. },
  174. { /* 7 */
  175. .lib_handler_fn = message_handler_req_lib_cfg_reload_config,
  176. .flow_control = CS_LIB_FLOW_CONTROL_REQUIRED
  177. },
  178. { /* 8 */
  179. .lib_handler_fn = message_handler_req_lib_cfg_reopen_log_files,
  180. .flow_control = CS_LIB_FLOW_CONTROL_NOT_REQUIRED
  181. }
  182. };
  183. static struct corosync_exec_handler cfg_exec_engine[] =
  184. {
  185. { /* 0 */
  186. .exec_handler_fn = message_handler_req_exec_cfg_ringreenable,
  187. },
  188. { /* 1 */
  189. .exec_handler_fn = message_handler_req_exec_cfg_killnode,
  190. .exec_endian_convert_fn = exec_cfg_killnode_endian_convert
  191. },
  192. { /* 2 */
  193. .exec_handler_fn = message_handler_req_exec_cfg_shutdown,
  194. },
  195. { /* 3 */
  196. .exec_handler_fn = message_handler_req_exec_cfg_reload_config,
  197. }
  198. };
  199. /*
  200. * Exports the interface for the service
  201. */
  202. struct corosync_service_engine cfg_service_engine = {
  203. .name = "corosync configuration service",
  204. .id = CFG_SERVICE,
  205. .priority = 1,
  206. .private_data_size = sizeof(struct cfg_info),
  207. .flow_control = CS_LIB_FLOW_CONTROL_NOT_REQUIRED,
  208. .allow_inquorate = CS_LIB_ALLOW_INQUORATE,
  209. .lib_init_fn = cfg_lib_init_fn,
  210. .lib_exit_fn = cfg_lib_exit_fn,
  211. .lib_engine = cfg_lib_engine,
  212. .lib_engine_count = sizeof (cfg_lib_engine) / sizeof (struct corosync_lib_handler),
  213. .exec_init_fn = cfg_exec_init_fn,
  214. .exec_engine = cfg_exec_engine,
  215. .exec_engine_count = sizeof (cfg_exec_engine) / sizeof (struct corosync_exec_handler),
  216. .confchg_fn = cfg_confchg_fn
  217. };
  218. struct corosync_service_engine *cfg_get_service_engine_ver0 (void)
  219. {
  220. return (&cfg_service_engine);
  221. }
  222. struct req_exec_cfg_ringreenable {
  223. struct qb_ipc_request_header header __attribute__((aligned(8)));
  224. mar_message_source_t source __attribute__((aligned(8)));
  225. };
  226. struct req_exec_cfg_reload_config {
  227. struct qb_ipc_request_header header __attribute__((aligned(8)));
  228. mar_message_source_t source __attribute__((aligned(8)));
  229. };
  230. struct req_exec_cfg_killnode {
  231. struct qb_ipc_request_header header __attribute__((aligned(8)));
  232. mar_uint32_t nodeid __attribute__((aligned(8)));
  233. mar_name_t reason __attribute__((aligned(8)));
  234. };
  235. struct req_exec_cfg_shutdown {
  236. struct qb_ipc_request_header header __attribute__((aligned(8)));
  237. };
  238. /* IMPL */
  239. static char *cfg_exec_init_fn (
  240. struct corosync_api_v1 *corosync_api_v1)
  241. {
  242. api = corosync_api_v1;
  243. qb_list_init(&trackers_list);
  244. return (NULL);
  245. }
  246. static void cfg_confchg_fn (
  247. enum totem_configuration_type configuration_type,
  248. const unsigned int *member_list, size_t member_list_entries,
  249. const unsigned int *left_list, size_t left_list_entries,
  250. const unsigned int *joined_list, size_t joined_list_entries,
  251. const struct memb_ring_id *ring_id)
  252. {
  253. }
  254. /*
  255. * Tell other nodes we are shutting down
  256. */
  257. static int send_shutdown(void)
  258. {
  259. struct req_exec_cfg_shutdown req_exec_cfg_shutdown;
  260. struct iovec iovec;
  261. ENTER();
  262. req_exec_cfg_shutdown.header.size =
  263. sizeof (struct req_exec_cfg_shutdown);
  264. req_exec_cfg_shutdown.header.id = SERVICE_ID_MAKE (CFG_SERVICE,
  265. MESSAGE_REQ_EXEC_CFG_SHUTDOWN);
  266. iovec.iov_base = (char *)&req_exec_cfg_shutdown;
  267. iovec.iov_len = sizeof (struct req_exec_cfg_shutdown);
  268. assert (api->totem_mcast (&iovec, 1, TOTEM_SAFE) == 0);
  269. LEAVE();
  270. return 0;
  271. }
  272. static void send_test_shutdown(void *only_conn, void *exclude_conn, int status)
  273. {
  274. struct res_lib_cfg_testshutdown res_lib_cfg_testshutdown;
  275. struct qb_list_head *iter;
  276. ENTER();
  277. res_lib_cfg_testshutdown.header.size = sizeof(struct res_lib_cfg_testshutdown);
  278. res_lib_cfg_testshutdown.header.id = MESSAGE_RES_CFG_TESTSHUTDOWN;
  279. res_lib_cfg_testshutdown.header.error = status;
  280. res_lib_cfg_testshutdown.flags = shutdown_flags;
  281. if (only_conn) {
  282. TRACE1("sending testshutdown to only %p", only_conn);
  283. api->ipc_dispatch_send(only_conn, &res_lib_cfg_testshutdown,
  284. sizeof(res_lib_cfg_testshutdown));
  285. } else {
  286. qb_list_for_each(iter, &trackers_list) {
  287. struct cfg_info *ci = qb_list_entry(iter, struct cfg_info, list);
  288. if (ci->conn != exclude_conn) {
  289. TRACE1("sending testshutdown to %p", ci->tracker_conn);
  290. api->ipc_dispatch_send(ci->tracker_conn, &res_lib_cfg_testshutdown,
  291. sizeof(res_lib_cfg_testshutdown));
  292. }
  293. }
  294. }
  295. LEAVE();
  296. }
  297. static void check_shutdown_status(void)
  298. {
  299. ENTER();
  300. /*
  301. * Shutdown client might have gone away
  302. */
  303. if (!shutdown_con) {
  304. LEAVE();
  305. return;
  306. }
  307. /*
  308. * All replies safely gathered in ?
  309. */
  310. if (shutdown_yes + shutdown_no >= shutdown_expected) {
  311. struct res_lib_cfg_tryshutdown res_lib_cfg_tryshutdown;
  312. api->timer_delete(shutdown_timer);
  313. if (shutdown_yes >= shutdown_expected ||
  314. shutdown_flags == CFG_SHUTDOWN_FLAG_REGARDLESS) {
  315. TRACE1("shutdown confirmed");
  316. res_lib_cfg_tryshutdown.header.size = sizeof(struct res_lib_cfg_tryshutdown);
  317. res_lib_cfg_tryshutdown.header.id = MESSAGE_RES_CFG_TRYSHUTDOWN;
  318. res_lib_cfg_tryshutdown.header.error = CS_OK;
  319. /*
  320. * Tell originator that shutdown was confirmed
  321. */
  322. api->ipc_response_send(shutdown_con->conn, &res_lib_cfg_tryshutdown,
  323. sizeof(res_lib_cfg_tryshutdown));
  324. shutdown_con = NULL;
  325. /*
  326. * Tell other nodes we are going down
  327. */
  328. send_shutdown();
  329. }
  330. else {
  331. TRACE1("shutdown cancelled");
  332. res_lib_cfg_tryshutdown.header.size = sizeof(struct res_lib_cfg_tryshutdown);
  333. res_lib_cfg_tryshutdown.header.id = MESSAGE_RES_CFG_TRYSHUTDOWN;
  334. res_lib_cfg_tryshutdown.header.error = CS_ERR_BUSY;
  335. /*
  336. * Tell originator that shutdown was cancelled
  337. */
  338. api->ipc_response_send(shutdown_con->conn, &res_lib_cfg_tryshutdown,
  339. sizeof(res_lib_cfg_tryshutdown));
  340. shutdown_con = NULL;
  341. }
  342. log_printf(LOGSYS_LEVEL_DEBUG, "shutdown decision is: (yes count: %d, no count: %d) flags=%x",
  343. shutdown_yes, shutdown_no, shutdown_flags);
  344. }
  345. LEAVE();
  346. }
  347. /*
  348. * Not all nodes responded to the shutdown (in time)
  349. */
  350. static void shutdown_timer_fn(void *arg)
  351. {
  352. ENTER();
  353. /*
  354. * Mark undecideds as "NO"
  355. */
  356. shutdown_no = shutdown_expected;
  357. check_shutdown_status();
  358. send_test_shutdown(NULL, NULL, CS_ERR_TIMEOUT);
  359. LEAVE();
  360. }
  361. static void remove_ci_from_shutdown(struct cfg_info *ci)
  362. {
  363. ENTER();
  364. /*
  365. * If the controlling shutdown process has quit, then cancel the
  366. * shutdown session
  367. */
  368. if (ci == shutdown_con) {
  369. shutdown_con = NULL;
  370. api->timer_delete(shutdown_timer);
  371. }
  372. if (!qb_list_empty(&ci->list)) {
  373. qb_list_del(&ci->list);
  374. qb_list_init(&ci->list);
  375. /*
  376. * Remove our option
  377. */
  378. if (shutdown_con) {
  379. if (ci->shutdown_reply == SHUTDOWN_REPLY_YES)
  380. shutdown_yes--;
  381. if (ci->shutdown_reply == SHUTDOWN_REPLY_NO)
  382. shutdown_no--;
  383. }
  384. /*
  385. * If we are leaving, then that's an implicit YES to shutdown
  386. */
  387. ci->shutdown_reply = SHUTDOWN_REPLY_YES;
  388. shutdown_yes++;
  389. check_shutdown_status();
  390. }
  391. LEAVE();
  392. }
  393. int cfg_lib_exit_fn (void *conn)
  394. {
  395. struct cfg_info *ci = (struct cfg_info *)api->ipc_private_data_get (conn);
  396. ENTER();
  397. remove_ci_from_shutdown(ci);
  398. LEAVE();
  399. return (0);
  400. }
  401. static int cfg_lib_init_fn (void *conn)
  402. {
  403. struct cfg_info *ci = (struct cfg_info *)api->ipc_private_data_get (conn);
  404. ENTER();
  405. qb_list_init(&ci->list);
  406. LEAVE();
  407. return (0);
  408. }
  409. /*
  410. * Executive message handlers
  411. */
  412. static void message_handler_req_exec_cfg_ringreenable (
  413. const void *message,
  414. unsigned int nodeid)
  415. {
  416. ENTER();
  417. LEAVE();
  418. }
  419. static void exec_cfg_killnode_endian_convert (void *msg)
  420. {
  421. struct req_exec_cfg_killnode *req_exec_cfg_killnode =
  422. (struct req_exec_cfg_killnode *)msg;
  423. ENTER();
  424. swab_mar_name_t(&req_exec_cfg_killnode->reason);
  425. LEAVE();
  426. }
  427. static void message_handler_req_exec_cfg_killnode (
  428. const void *message,
  429. unsigned int nodeid)
  430. {
  431. const struct req_exec_cfg_killnode *req_exec_cfg_killnode = message;
  432. cs_name_t reason;
  433. ENTER();
  434. log_printf(LOGSYS_LEVEL_DEBUG, "request to kill node " CS_PRI_NODE_ID " (us=" CS_PRI_NODE_ID ")",
  435. req_exec_cfg_killnode->nodeid, api->totem_nodeid_get());
  436. if (req_exec_cfg_killnode->nodeid == api->totem_nodeid_get()) {
  437. marshall_from_mar_name_t(&reason, &req_exec_cfg_killnode->reason);
  438. log_printf(LOGSYS_LEVEL_NOTICE, "Killed by node " CS_PRI_NODE_ID " : %s",
  439. nodeid, reason.value);
  440. corosync_fatal_error(COROSYNC_FATAL_ERROR_EXIT);
  441. }
  442. LEAVE();
  443. }
  444. /*
  445. * Self shutdown
  446. */
  447. static void message_handler_req_exec_cfg_shutdown (
  448. const void *message,
  449. unsigned int nodeid)
  450. {
  451. ENTER();
  452. log_printf(LOGSYS_LEVEL_NOTICE, "Node " CS_PRI_NODE_ID " was shut down by sysadmin", nodeid);
  453. if (nodeid == api->totem_nodeid_get()) {
  454. api->shutdown_request();
  455. }
  456. LEAVE();
  457. }
  458. /* strcmp replacement that can handle NULLs */
  459. static int nullcheck_strcmp(const char* left, const char *right)
  460. {
  461. if (!left && right)
  462. return -1;
  463. if (left && !right)
  464. return 1;
  465. if (!left && !right)
  466. return 0;
  467. return strcmp(left, right);
  468. }
  469. /*
  470. * If a key has changed value in the new file, then warn the user and remove it from the temp_map
  471. */
  472. static void delete_and_notify_if_changed(icmap_map_t temp_map, const char *key_name)
  473. {
  474. if (!(icmap_key_value_eq(temp_map, key_name, icmap_get_global_map(), key_name))) {
  475. if (icmap_delete_r(temp_map, key_name) == CS_OK) {
  476. log_printf(LOGSYS_LEVEL_NOTICE, "Modified entry '%s' in corosync.conf cannot be changed at run-time", key_name);
  477. }
  478. }
  479. }
  480. /*
  481. * Remove any keys from the new config file that in the new corosync.conf but that
  482. * cannot be changed at run time. A log message will be issued for each
  483. * entry that the user wants to change but they cannot.
  484. *
  485. * Add more here as needed.
  486. */
  487. static void remove_ro_entries(icmap_map_t temp_map)
  488. {
  489. delete_and_notify_if_changed(temp_map, "totem.secauth");
  490. delete_and_notify_if_changed(temp_map, "totem.crypto_hash");
  491. delete_and_notify_if_changed(temp_map, "totem.crypto_cipher");
  492. delete_and_notify_if_changed(temp_map, "totem.keyfile");
  493. delete_and_notify_if_changed(temp_map, "totem.key");
  494. delete_and_notify_if_changed(temp_map, "totem.version");
  495. delete_and_notify_if_changed(temp_map, "totem.threads");
  496. delete_and_notify_if_changed(temp_map, "totem.ip_version");
  497. delete_and_notify_if_changed(temp_map, "totem.rrp_mode");
  498. delete_and_notify_if_changed(temp_map, "totem.netmtu");
  499. delete_and_notify_if_changed(temp_map, "totem.interface.ringnumber");
  500. delete_and_notify_if_changed(temp_map, "totem.interface.bindnetaddr");
  501. delete_and_notify_if_changed(temp_map, "totem.interface.mcastaddr");
  502. delete_and_notify_if_changed(temp_map, "totem.interface.broadcast");
  503. delete_and_notify_if_changed(temp_map, "totem.interface.mcastport");
  504. delete_and_notify_if_changed(temp_map, "totem.interface.ttl");
  505. delete_and_notify_if_changed(temp_map, "totem.transport");
  506. delete_and_notify_if_changed(temp_map, "totem.cluster_name");
  507. delete_and_notify_if_changed(temp_map, "quorum.provider");
  508. delete_and_notify_if_changed(temp_map, "system.move_to_root_cgroup");
  509. delete_and_notify_if_changed(temp_map, "system.sched_rr");
  510. delete_and_notify_if_changed(temp_map, "system.priority");
  511. delete_and_notify_if_changed(temp_map, "system.qb_ipc_type");
  512. delete_and_notify_if_changed(temp_map, "system.state_dir");
  513. }
  514. /*
  515. * Remove entries that exist in the global map, but not in the temp_map, this will
  516. * cause delete notifications to be sent to any listeners.
  517. *
  518. * NOTE: This routine depends entirely on the keys returned by the iterators
  519. * being in alpha-sorted order.
  520. */
  521. static void remove_deleted_entries(icmap_map_t temp_map, const char *prefix)
  522. {
  523. icmap_iter_t old_iter;
  524. icmap_iter_t new_iter;
  525. const char *old_key, *new_key;
  526. int ret;
  527. old_iter = icmap_iter_init(prefix);
  528. new_iter = icmap_iter_init_r(temp_map, prefix);
  529. old_key = icmap_iter_next(old_iter, NULL, NULL);
  530. new_key = icmap_iter_next(new_iter, NULL, NULL);
  531. while (old_key || new_key) {
  532. ret = nullcheck_strcmp(old_key, new_key);
  533. if ((ret < 0 && old_key) || !new_key) {
  534. /*
  535. * new_key is greater, a line (or more) has been deleted
  536. * Continue until old is >= new
  537. */
  538. do {
  539. /* Remove it from icmap & send notifications */
  540. icmap_delete(old_key);
  541. old_key = icmap_iter_next(old_iter, NULL, NULL);
  542. ret = nullcheck_strcmp(old_key, new_key);
  543. } while (ret < 0 && old_key);
  544. }
  545. else if ((ret > 0 && new_key) || !old_key) {
  546. /*
  547. * old_key is greater, a line (or more) has been added
  548. * Continue until new is >= old
  549. *
  550. * we don't need to do anything special with this like tell
  551. * icmap. That will happen when we copy the values over
  552. */
  553. do {
  554. new_key = icmap_iter_next(new_iter, NULL, NULL);
  555. ret = nullcheck_strcmp(old_key, new_key);
  556. } while (ret > 0 && new_key);
  557. }
  558. if (ret == 0) {
  559. new_key = icmap_iter_next(new_iter, NULL, NULL);
  560. old_key = icmap_iter_next(old_iter, NULL, NULL);
  561. }
  562. }
  563. icmap_iter_finalize(new_iter);
  564. icmap_iter_finalize(old_iter);
  565. }
  566. /*
  567. * Reload configuration file
  568. */
  569. static void message_handler_req_exec_cfg_reload_config (
  570. const void *message,
  571. unsigned int nodeid)
  572. {
  573. const struct req_exec_cfg_reload_config *req_exec_cfg_reload_config = message;
  574. struct res_lib_cfg_reload_config res_lib_cfg_reload_config;
  575. struct totem_config new_config;
  576. icmap_map_t temp_map;
  577. const char *error_string;
  578. int res = CS_OK;
  579. ENTER();
  580. log_printf(LOGSYS_LEVEL_NOTICE, "Config reload requested by node " CS_PRI_NODE_ID, nodeid);
  581. icmap_set_uint8("config.totemconfig_reload_in_progress", 1);
  582. /*
  583. * Set up a new hashtable as a staging area.
  584. */
  585. if ((res = icmap_init_r(&temp_map)) != CS_OK) {
  586. log_printf(LOGSYS_LEVEL_ERROR, "Unable to create temporary icmap. config file reload cancelled\n");
  587. goto reload_fini_nomap;
  588. }
  589. /*
  590. * Load new config into the temporary map
  591. */
  592. res = coroparse_configparse(temp_map, &error_string);
  593. if (res == -1) {
  594. log_printf (LOGSYS_LEVEL_ERROR, "Unable to reload config file: %s", error_string);
  595. res = CS_ERR_INVALID_PARAM;
  596. goto reload_fini_nofree;
  597. }
  598. /* Signal start of the reload process */
  599. icmap_set_uint8("config.reload_in_progress", 1);
  600. /* Detect deleted entries and remove them from the main icmap hashtable */
  601. remove_deleted_entries(temp_map, "logging.");
  602. remove_deleted_entries(temp_map, "totem.");
  603. remove_deleted_entries(temp_map, "nodelist.");
  604. remove_deleted_entries(temp_map, "quorum.");
  605. remove_deleted_entries(temp_map, "uidgid.config.");
  606. remove_deleted_entries(temp_map, "nozzle.");
  607. /* Remove entries that cannot be changed */
  608. remove_ro_entries(temp_map);
  609. /* Take a copy of the current setup so we can check what has changed */
  610. memset(&new_config, 0, sizeof(new_config));
  611. new_config.orig_interfaces = malloc (sizeof (struct totem_interface) * INTERFACE_MAX);
  612. assert(new_config.orig_interfaces != NULL);
  613. totempg_get_config(&new_config);
  614. new_config.interfaces = malloc (sizeof (struct totem_interface) * INTERFACE_MAX);
  615. assert(new_config.interfaces != NULL);
  616. memset(new_config.interfaces, 0, sizeof (struct totem_interface) * INTERFACE_MAX);
  617. /* For UDP[U] the configuration on link0 is static (apart from the nodelist) and only read at
  618. startup. So preserve it here */
  619. if ( (new_config.transport_number == TOTEM_TRANSPORT_UDP) ||
  620. (new_config.transport_number == TOTEM_TRANSPORT_UDPU)) {
  621. memcpy(&new_config.interfaces[0], &new_config.orig_interfaces[0],
  622. sizeof(struct totem_interface));
  623. }
  624. /* Calculate new node and interface definitions */
  625. if (totemconfig_configure_new_params(&new_config, temp_map, &error_string) == -1) {
  626. log_printf (LOGSYS_LEVEL_ERROR, "Cannot configure new interface definitions: %s\n", error_string);
  627. res = CS_ERR_INVALID_PARAM;
  628. goto reload_fini;
  629. }
  630. /* Read from temp_map into new_config */
  631. totem_volatile_config_read(&new_config, temp_map, NULL);
  632. /* Validate dynamic parameters */
  633. if (totem_volatile_config_validate(&new_config, temp_map, &error_string) == -1) {
  634. log_printf (LOGSYS_LEVEL_ERROR, "Configuration is not valid: %s\n", error_string);
  635. res = CS_ERR_INVALID_PARAM;
  636. goto reload_fini;
  637. }
  638. /*
  639. * Copy new keys into live config.
  640. */
  641. if ( (res = icmap_copy_map(icmap_get_global_map(), temp_map)) != CS_OK) {
  642. log_printf (LOGSYS_LEVEL_ERROR, "Error making new config live. cmap database may be inconsistent\n");
  643. /* Return res from icmap */
  644. goto reload_fini;
  645. }
  646. /* Copy into live system */
  647. totempg_put_config(&new_config);
  648. totemconfig_commit_new_params(&new_config, temp_map);
  649. free(new_config.interfaces);
  650. reload_fini:
  651. /* All done - let clients know */
  652. icmap_set_int32("config.reload_status", res);
  653. icmap_set_uint8("config.totemconfig_reload_in_progress", 0);
  654. icmap_set_uint8("config.reload_in_progress", 0);
  655. /* Finished with the temporary storage */
  656. free(new_config.orig_interfaces);
  657. reload_fini_nofree:
  658. icmap_fini_r(temp_map);
  659. reload_fini_nomap:
  660. /* All done, return result to the caller if it was on this system */
  661. if (nodeid == api->totem_nodeid_get()) {
  662. res_lib_cfg_reload_config.header.size = sizeof(res_lib_cfg_reload_config);
  663. res_lib_cfg_reload_config.header.id = MESSAGE_RES_CFG_RELOAD_CONFIG;
  664. res_lib_cfg_reload_config.header.error = res;
  665. api->ipc_response_send(req_exec_cfg_reload_config->source.conn,
  666. &res_lib_cfg_reload_config,
  667. sizeof(res_lib_cfg_reload_config));
  668. api->ipc_refcnt_dec(req_exec_cfg_reload_config->source.conn);;
  669. }
  670. LEAVE();
  671. }
  672. /*
  673. * Library Interface Implementation
  674. */
  675. static void message_handler_req_lib_cfg_ringstatusget (
  676. void *conn,
  677. const void *msg)
  678. {
  679. struct res_lib_cfg_ringstatusget res_lib_cfg_ringstatusget;
  680. struct totem_ip_address interfaces[INTERFACE_MAX];
  681. unsigned int iface_count;
  682. char **status;
  683. const char *totem_ip_string;
  684. char ifname[CFG_INTERFACE_NAME_MAX_LEN];
  685. unsigned int iface_ids[INTERFACE_MAX];
  686. unsigned int i;
  687. cs_error_t res = CS_OK;
  688. ENTER();
  689. res_lib_cfg_ringstatusget.header.id = MESSAGE_RES_CFG_RINGSTATUSGET;
  690. res_lib_cfg_ringstatusget.header.size = sizeof (struct res_lib_cfg_ringstatusget);
  691. api->totem_ifaces_get (
  692. api->totem_nodeid_get(),
  693. iface_ids,
  694. interfaces,
  695. INTERFACE_MAX,
  696. &status,
  697. &iface_count);
  698. assert(iface_count <= CFG_MAX_INTERFACES);
  699. res_lib_cfg_ringstatusget.interface_count = iface_count;
  700. for (i = 0; i < iface_count; i++) {
  701. totem_ip_string
  702. = (const char *)api->totem_ip_print (&interfaces[i]);
  703. if (!totem_ip_string) {
  704. totem_ip_string="";
  705. }
  706. /* Allow for i/f number at the start */
  707. if (strlen(totem_ip_string) >= CFG_INTERFACE_NAME_MAX_LEN-3) {
  708. log_printf(LOGSYS_LEVEL_ERROR, "String representation of interface %u is too long", i);
  709. res = CS_ERR_NAME_TOO_LONG;
  710. goto send_response;
  711. }
  712. snprintf(ifname, sizeof(ifname), "%d %s", iface_ids[i], totem_ip_string);
  713. if (strlen(status[i]) >= CFG_INTERFACE_STATUS_MAX_LEN) {
  714. log_printf(LOGSYS_LEVEL_ERROR, "Status string for interface %u is too long", i);
  715. res = CS_ERR_NAME_TOO_LONG;
  716. goto send_response;
  717. }
  718. strcpy ((char *)&res_lib_cfg_ringstatusget.interface_status[i],
  719. status[i]);
  720. strcpy ((char *)&res_lib_cfg_ringstatusget.interface_name[i],
  721. ifname);
  722. }
  723. send_response:
  724. res_lib_cfg_ringstatusget.header.error = res;
  725. api->ipc_response_send (
  726. conn,
  727. &res_lib_cfg_ringstatusget,
  728. sizeof (struct res_lib_cfg_ringstatusget));
  729. LEAVE();
  730. }
  731. static void message_handler_req_lib_cfg_ringreenable (
  732. void *conn,
  733. const void *msg)
  734. {
  735. struct res_lib_cfg_ringreenable res_lib_cfg_ringreenable;
  736. ENTER();
  737. res_lib_cfg_ringreenable.header.id = MESSAGE_RES_CFG_RINGREENABLE;
  738. res_lib_cfg_ringreenable.header.size = sizeof (struct res_lib_cfg_ringreenable);
  739. res_lib_cfg_ringreenable.header.error = CS_ERR_NOT_SUPPORTED;
  740. api->ipc_response_send (
  741. conn, &res_lib_cfg_ringreenable,
  742. sizeof (struct res_lib_cfg_ringreenable));
  743. LEAVE();
  744. }
  745. static void message_handler_req_lib_cfg_killnode (
  746. void *conn,
  747. const void *msg)
  748. {
  749. const struct req_lib_cfg_killnode *req_lib_cfg_killnode = msg;
  750. struct res_lib_cfg_killnode res_lib_cfg_killnode;
  751. struct req_exec_cfg_killnode req_exec_cfg_killnode;
  752. struct iovec iovec;
  753. ENTER();
  754. req_exec_cfg_killnode.header.size =
  755. sizeof (struct req_exec_cfg_killnode);
  756. req_exec_cfg_killnode.header.id = SERVICE_ID_MAKE (CFG_SERVICE,
  757. MESSAGE_REQ_EXEC_CFG_KILLNODE);
  758. req_exec_cfg_killnode.nodeid = req_lib_cfg_killnode->nodeid;
  759. marshall_to_mar_name_t(&req_exec_cfg_killnode.reason, &req_lib_cfg_killnode->reason);
  760. iovec.iov_base = (char *)&req_exec_cfg_killnode;
  761. iovec.iov_len = sizeof (struct req_exec_cfg_killnode);
  762. (void)api->totem_mcast (&iovec, 1, TOTEM_SAFE);
  763. res_lib_cfg_killnode.header.size = sizeof(struct res_lib_cfg_killnode);
  764. res_lib_cfg_killnode.header.id = MESSAGE_RES_CFG_KILLNODE;
  765. res_lib_cfg_killnode.header.error = CS_OK;
  766. api->ipc_response_send(conn, &res_lib_cfg_killnode,
  767. sizeof(res_lib_cfg_killnode));
  768. LEAVE();
  769. }
  770. static void message_handler_req_lib_cfg_tryshutdown (
  771. void *conn,
  772. const void *msg)
  773. {
  774. struct cfg_info *ci = (struct cfg_info *)api->ipc_private_data_get (conn);
  775. const struct req_lib_cfg_tryshutdown *req_lib_cfg_tryshutdown = msg;
  776. struct qb_list_head *iter;
  777. ENTER();
  778. if (req_lib_cfg_tryshutdown->flags == CFG_SHUTDOWN_FLAG_IMMEDIATE) {
  779. struct res_lib_cfg_tryshutdown res_lib_cfg_tryshutdown;
  780. /*
  781. * Tell other nodes
  782. */
  783. send_shutdown();
  784. res_lib_cfg_tryshutdown.header.size = sizeof(struct res_lib_cfg_tryshutdown);
  785. res_lib_cfg_tryshutdown.header.id = MESSAGE_RES_CFG_TRYSHUTDOWN;
  786. res_lib_cfg_tryshutdown.header.error = CS_OK;
  787. api->ipc_response_send(conn, &res_lib_cfg_tryshutdown,
  788. sizeof(res_lib_cfg_tryshutdown));
  789. LEAVE();
  790. return;
  791. }
  792. /*
  793. * Shutdown in progress, return an error
  794. */
  795. if (shutdown_con) {
  796. struct res_lib_cfg_tryshutdown res_lib_cfg_tryshutdown;
  797. res_lib_cfg_tryshutdown.header.size = sizeof(struct res_lib_cfg_tryshutdown);
  798. res_lib_cfg_tryshutdown.header.id = MESSAGE_RES_CFG_TRYSHUTDOWN;
  799. res_lib_cfg_tryshutdown.header.error = CS_ERR_EXIST;
  800. api->ipc_response_send(conn, &res_lib_cfg_tryshutdown,
  801. sizeof(res_lib_cfg_tryshutdown));
  802. LEAVE();
  803. return;
  804. }
  805. ci->conn = conn;
  806. shutdown_con = (struct cfg_info *)api->ipc_private_data_get (conn);
  807. shutdown_flags = req_lib_cfg_tryshutdown->flags;
  808. shutdown_yes = 0;
  809. shutdown_no = 0;
  810. /*
  811. * Count the number of listeners
  812. */
  813. shutdown_expected = 0;
  814. qb_list_for_each(iter, &trackers_list) {
  815. struct cfg_info *testci = qb_list_entry(iter, struct cfg_info, list);
  816. /*
  817. * It is assumed that we will allow shutdown
  818. */
  819. if (testci != ci) {
  820. testci->shutdown_reply = SHUTDOWN_REPLY_UNKNOWN;
  821. shutdown_expected++;
  822. }
  823. }
  824. /*
  825. * If no-one is listening for events then we can just go down now
  826. */
  827. if (shutdown_expected == 0) {
  828. struct res_lib_cfg_tryshutdown res_lib_cfg_tryshutdown;
  829. res_lib_cfg_tryshutdown.header.size = sizeof(struct res_lib_cfg_tryshutdown);
  830. res_lib_cfg_tryshutdown.header.id = MESSAGE_RES_CFG_TRYSHUTDOWN;
  831. res_lib_cfg_tryshutdown.header.error = CS_OK;
  832. /*
  833. * Tell originator that shutdown was confirmed
  834. */
  835. api->ipc_response_send(conn, &res_lib_cfg_tryshutdown,
  836. sizeof(res_lib_cfg_tryshutdown));
  837. send_shutdown();
  838. LEAVE();
  839. return;
  840. }
  841. else {
  842. unsigned int shutdown_timeout = DEFAULT_SHUTDOWN_TIMEOUT;
  843. /*
  844. * Look for a shutdown timeout in configuration map
  845. */
  846. icmap_get_uint32("cfg.shutdown_timeout", &shutdown_timeout);
  847. /*
  848. * Start the timer. If we don't get a full set of replies before this goes
  849. * off we'll cancel the shutdown
  850. */
  851. api->timer_add_duration((unsigned long long)shutdown_timeout*1000000000, NULL,
  852. shutdown_timer_fn, &shutdown_timer);
  853. /*
  854. * Tell the users we would like to shut down
  855. */
  856. send_test_shutdown(NULL, conn, CS_OK);
  857. }
  858. /*
  859. * We don't sent a reply to the caller here.
  860. * We send it when we know if we can shut down or not
  861. */
  862. LEAVE();
  863. }
  864. static void message_handler_req_lib_cfg_replytoshutdown (
  865. void *conn,
  866. const void *msg)
  867. {
  868. struct cfg_info *ci = (struct cfg_info *)api->ipc_private_data_get (conn);
  869. const struct req_lib_cfg_replytoshutdown *req_lib_cfg_replytoshutdown = msg;
  870. struct res_lib_cfg_replytoshutdown res_lib_cfg_replytoshutdown;
  871. int status = CS_OK;
  872. ENTER();
  873. if (!shutdown_con) {
  874. status = CS_ERR_ACCESS;
  875. goto exit_fn;
  876. }
  877. if (req_lib_cfg_replytoshutdown->response) {
  878. shutdown_yes++;
  879. ci->shutdown_reply = SHUTDOWN_REPLY_YES;
  880. }
  881. else {
  882. shutdown_no++;
  883. ci->shutdown_reply = SHUTDOWN_REPLY_NO;
  884. }
  885. check_shutdown_status();
  886. exit_fn:
  887. res_lib_cfg_replytoshutdown.header.error = status;
  888. res_lib_cfg_replytoshutdown.header.id = MESSAGE_RES_CFG_REPLYTOSHUTDOWN;
  889. res_lib_cfg_replytoshutdown.header.size = sizeof(res_lib_cfg_replytoshutdown);
  890. api->ipc_response_send(conn, &res_lib_cfg_replytoshutdown,
  891. sizeof(res_lib_cfg_replytoshutdown));
  892. LEAVE();
  893. }
  894. static void message_handler_req_lib_cfg_get_node_addrs (void *conn,
  895. const void *msg)
  896. {
  897. struct totem_ip_address node_ifs[INTERFACE_MAX];
  898. unsigned int iface_ids[INTERFACE_MAX];
  899. char buf[PIPE_BUF];
  900. char **status;
  901. unsigned int num_interfaces = 0;
  902. struct sockaddr_storage *ss;
  903. int ret = CS_OK;
  904. int i;
  905. int live_addrs = 0;
  906. const struct req_lib_cfg_get_node_addrs *req_lib_cfg_get_node_addrs = msg;
  907. struct res_lib_cfg_get_node_addrs *res_lib_cfg_get_node_addrs = (struct res_lib_cfg_get_node_addrs *)buf;
  908. unsigned int nodeid = req_lib_cfg_get_node_addrs->nodeid;
  909. char *addr_buf;
  910. if (nodeid == 0)
  911. nodeid = api->totem_nodeid_get();
  912. if (api->totem_ifaces_get(nodeid, iface_ids, node_ifs, INTERFACE_MAX, &status, &num_interfaces)) {
  913. ret = CS_ERR_EXIST;
  914. num_interfaces = 0;
  915. }
  916. res_lib_cfg_get_node_addrs->header.size = sizeof(struct res_lib_cfg_get_node_addrs) + (num_interfaces * TOTEMIP_ADDRLEN);
  917. res_lib_cfg_get_node_addrs->header.id = MESSAGE_RES_CFG_GET_NODE_ADDRS;
  918. res_lib_cfg_get_node_addrs->header.error = ret;
  919. if (num_interfaces) {
  920. res_lib_cfg_get_node_addrs->family = node_ifs[0].family;
  921. for (i = 0, addr_buf = (char *)res_lib_cfg_get_node_addrs->addrs;
  922. i < num_interfaces; i++) {
  923. ss = (struct sockaddr_storage *)&node_ifs[i].addr;
  924. if (ss->ss_family) {
  925. memcpy(addr_buf, node_ifs[i].addr, TOTEMIP_ADDRLEN);
  926. live_addrs++;
  927. addr_buf += TOTEMIP_ADDRLEN;
  928. }
  929. }
  930. res_lib_cfg_get_node_addrs->num_addrs = live_addrs;
  931. } else {
  932. res_lib_cfg_get_node_addrs->header.error = CS_ERR_NOT_EXIST;
  933. }
  934. api->ipc_response_send(conn, res_lib_cfg_get_node_addrs, res_lib_cfg_get_node_addrs->header.size);
  935. }
  936. static void message_handler_req_lib_cfg_local_get (void *conn, const void *msg)
  937. {
  938. struct res_lib_cfg_local_get res_lib_cfg_local_get;
  939. res_lib_cfg_local_get.header.size = sizeof(res_lib_cfg_local_get);
  940. res_lib_cfg_local_get.header.id = MESSAGE_RES_CFG_LOCAL_GET;
  941. res_lib_cfg_local_get.header.error = CS_OK;
  942. res_lib_cfg_local_get.local_nodeid = api->totem_nodeid_get ();
  943. api->ipc_response_send(conn, &res_lib_cfg_local_get,
  944. sizeof(res_lib_cfg_local_get));
  945. }
  946. static void message_handler_req_lib_cfg_reload_config (void *conn, const void *msg)
  947. {
  948. struct req_exec_cfg_reload_config req_exec_cfg_reload_config;
  949. struct iovec iovec;
  950. ENTER();
  951. req_exec_cfg_reload_config.header.size =
  952. sizeof (struct req_exec_cfg_reload_config);
  953. req_exec_cfg_reload_config.header.id = SERVICE_ID_MAKE (CFG_SERVICE,
  954. MESSAGE_REQ_EXEC_CFG_RELOAD_CONFIG);
  955. api->ipc_source_set (&req_exec_cfg_reload_config.source, conn);
  956. api->ipc_refcnt_inc(conn);
  957. iovec.iov_base = (char *)&req_exec_cfg_reload_config;
  958. iovec.iov_len = sizeof (struct req_exec_cfg_reload_config);
  959. assert (api->totem_mcast (&iovec, 1, TOTEM_SAFE) == 0);
  960. LEAVE();
  961. }
  962. static void message_handler_req_lib_cfg_reopen_log_files (void *conn, const void *msg)
  963. {
  964. struct res_lib_cfg_reopen_log_files res_lib_cfg_reopen_log_files;
  965. cs_error_t res;
  966. ENTER();
  967. log_printf(LOGSYS_LEVEL_DEBUG, "Reopening logging files\n");
  968. res = logsys_reopen_log_files();
  969. res_lib_cfg_reopen_log_files.header.size = sizeof(res_lib_cfg_reopen_log_files);
  970. res_lib_cfg_reopen_log_files.header.id = MESSAGE_RES_CFG_REOPEN_LOG_FILES;
  971. res_lib_cfg_reopen_log_files.header.error = res;
  972. api->ipc_response_send(conn,
  973. &res_lib_cfg_reopen_log_files,
  974. sizeof(res_lib_cfg_reopen_log_files));
  975. LEAVE();
  976. }