cfg.c 33 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168
  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.vsftype");
  506. delete_and_notify_if_changed(temp_map, "totem.transport");
  507. delete_and_notify_if_changed(temp_map, "totem.cluster_name");
  508. delete_and_notify_if_changed(temp_map, "quorum.provider");
  509. delete_and_notify_if_changed(temp_map, "system.move_to_root_cgroup");
  510. delete_and_notify_if_changed(temp_map, "system.sched_rr");
  511. delete_and_notify_if_changed(temp_map, "system.priority");
  512. delete_and_notify_if_changed(temp_map, "system.qb_ipc_type");
  513. delete_and_notify_if_changed(temp_map, "system.state_dir");
  514. }
  515. /*
  516. * Remove entries that exist in the global map, but not in the temp_map, this will
  517. * cause delete notifications to be sent to any listeners.
  518. *
  519. * NOTE: This routine depends entirely on the keys returned by the iterators
  520. * being in alpha-sorted order.
  521. */
  522. static void remove_deleted_entries(icmap_map_t temp_map, const char *prefix)
  523. {
  524. icmap_iter_t old_iter;
  525. icmap_iter_t new_iter;
  526. const char *old_key, *new_key;
  527. int ret;
  528. old_iter = icmap_iter_init(prefix);
  529. new_iter = icmap_iter_init_r(temp_map, prefix);
  530. old_key = icmap_iter_next(old_iter, NULL, NULL);
  531. new_key = icmap_iter_next(new_iter, NULL, NULL);
  532. while (old_key || new_key) {
  533. ret = nullcheck_strcmp(old_key, new_key);
  534. if ((ret < 0 && old_key) || !new_key) {
  535. /*
  536. * new_key is greater, a line (or more) has been deleted
  537. * Continue until old is >= new
  538. */
  539. do {
  540. /* Remove it from icmap & send notifications */
  541. icmap_delete(old_key);
  542. old_key = icmap_iter_next(old_iter, NULL, NULL);
  543. ret = nullcheck_strcmp(old_key, new_key);
  544. } while (ret < 0 && old_key);
  545. }
  546. else if ((ret > 0 && new_key) || !old_key) {
  547. /*
  548. * old_key is greater, a line (or more) has been added
  549. * Continue until new is >= old
  550. *
  551. * we don't need to do anything special with this like tell
  552. * icmap. That will happen when we copy the values over
  553. */
  554. do {
  555. new_key = icmap_iter_next(new_iter, NULL, NULL);
  556. ret = nullcheck_strcmp(old_key, new_key);
  557. } while (ret > 0 && new_key);
  558. }
  559. if (ret == 0) {
  560. new_key = icmap_iter_next(new_iter, NULL, NULL);
  561. old_key = icmap_iter_next(old_iter, NULL, NULL);
  562. }
  563. }
  564. icmap_iter_finalize(new_iter);
  565. icmap_iter_finalize(old_iter);
  566. }
  567. /*
  568. * Reload configuration file
  569. */
  570. static void message_handler_req_exec_cfg_reload_config (
  571. const void *message,
  572. unsigned int nodeid)
  573. {
  574. const struct req_exec_cfg_reload_config *req_exec_cfg_reload_config = message;
  575. struct res_lib_cfg_reload_config res_lib_cfg_reload_config;
  576. struct totem_config new_config;
  577. icmap_map_t temp_map;
  578. const char *error_string;
  579. int res = CS_OK;
  580. ENTER();
  581. log_printf(LOGSYS_LEVEL_NOTICE, "Config reload requested by node " CS_PRI_NODE_ID, nodeid);
  582. icmap_set_uint8("config.totemconfig_reload_in_progress", 1);
  583. /*
  584. * Set up a new hashtable as a staging area.
  585. */
  586. if ((res = icmap_init_r(&temp_map)) != CS_OK) {
  587. log_printf(LOGSYS_LEVEL_ERROR, "Unable to create temporary icmap. config file reload cancelled\n");
  588. goto reload_fini_nomap;
  589. }
  590. /*
  591. * Load new config into the temporary map
  592. */
  593. res = coroparse_configparse(temp_map, &error_string);
  594. if (res == -1) {
  595. log_printf (LOGSYS_LEVEL_ERROR, "Unable to reload config file: %s", error_string);
  596. res = CS_ERR_INVALID_PARAM;
  597. goto reload_fini_nofree;
  598. }
  599. /* Signal start of the reload process */
  600. icmap_set_uint8("config.reload_in_progress", 1);
  601. /* Detect deleted entries and remove them from the main icmap hashtable */
  602. remove_deleted_entries(temp_map, "logging.");
  603. remove_deleted_entries(temp_map, "totem.");
  604. remove_deleted_entries(temp_map, "nodelist.");
  605. remove_deleted_entries(temp_map, "quorum.");
  606. remove_deleted_entries(temp_map, "uidgid.config.");
  607. remove_deleted_entries(temp_map, "nozzle.");
  608. /* Remove entries that cannot be changed */
  609. remove_ro_entries(temp_map);
  610. /* Take a copy of the current setup so we can check what has changed */
  611. memset(&new_config, 0, sizeof(new_config));
  612. new_config.orig_interfaces = malloc (sizeof (struct totem_interface) * INTERFACE_MAX);
  613. assert(new_config.orig_interfaces != NULL);
  614. totempg_get_config(&new_config);
  615. new_config.interfaces = malloc (sizeof (struct totem_interface) * INTERFACE_MAX);
  616. assert(new_config.interfaces != NULL);
  617. memset(new_config.interfaces, 0, sizeof (struct totem_interface) * INTERFACE_MAX);
  618. /* For UDP[U] the configuration on link0 is static (apart from the nodelist) and only read at
  619. startup. So preserve it here */
  620. if ( (new_config.transport_number == TOTEM_TRANSPORT_UDP) ||
  621. (new_config.transport_number == TOTEM_TRANSPORT_UDPU)) {
  622. memcpy(&new_config.interfaces[0], &new_config.orig_interfaces[0],
  623. sizeof(struct totem_interface));
  624. }
  625. /* Calculate new node and interface definitions */
  626. if (totemconfig_configure_new_params(&new_config, temp_map, &error_string) == -1) {
  627. log_printf (LOGSYS_LEVEL_ERROR, "Cannot configure new interface definitions: %s\n", error_string);
  628. res = CS_ERR_INVALID_PARAM;
  629. goto reload_fini;
  630. }
  631. /* Read from temp_map into new_config */
  632. totem_volatile_config_read(&new_config, temp_map, NULL);
  633. /* Validate dynamic parameters */
  634. if (totem_volatile_config_validate(&new_config, temp_map, &error_string) == -1) {
  635. log_printf (LOGSYS_LEVEL_ERROR, "Configuration is not valid: %s\n", error_string);
  636. res = CS_ERR_INVALID_PARAM;
  637. goto reload_fini;
  638. }
  639. /*
  640. * Copy new keys into live config.
  641. */
  642. if ( (res = icmap_copy_map(icmap_get_global_map(), temp_map)) != CS_OK) {
  643. log_printf (LOGSYS_LEVEL_ERROR, "Error making new config live. cmap database may be inconsistent\n");
  644. /* Return res from icmap */
  645. goto reload_fini;
  646. }
  647. /* Copy into live system */
  648. totempg_put_config(&new_config);
  649. totemconfig_commit_new_params(&new_config, temp_map);
  650. free(new_config.interfaces);
  651. reload_fini:
  652. /* All done - let clients know */
  653. icmap_set_int32("config.reload_status", res);
  654. icmap_set_uint8("config.totemconfig_reload_in_progress", 0);
  655. icmap_set_uint8("config.reload_in_progress", 0);
  656. /* Finished with the temporary storage */
  657. free(new_config.orig_interfaces);
  658. reload_fini_nofree:
  659. icmap_fini_r(temp_map);
  660. reload_fini_nomap:
  661. /* All done, return result to the caller if it was on this system */
  662. if (nodeid == api->totem_nodeid_get()) {
  663. res_lib_cfg_reload_config.header.size = sizeof(res_lib_cfg_reload_config);
  664. res_lib_cfg_reload_config.header.id = MESSAGE_RES_CFG_RELOAD_CONFIG;
  665. res_lib_cfg_reload_config.header.error = res;
  666. api->ipc_response_send(req_exec_cfg_reload_config->source.conn,
  667. &res_lib_cfg_reload_config,
  668. sizeof(res_lib_cfg_reload_config));
  669. api->ipc_refcnt_dec(req_exec_cfg_reload_config->source.conn);;
  670. }
  671. LEAVE();
  672. }
  673. /*
  674. * Library Interface Implementation
  675. */
  676. static void message_handler_req_lib_cfg_ringstatusget (
  677. void *conn,
  678. const void *msg)
  679. {
  680. struct res_lib_cfg_ringstatusget res_lib_cfg_ringstatusget;
  681. struct totem_ip_address interfaces[INTERFACE_MAX];
  682. unsigned int iface_count;
  683. char **status;
  684. const char *totem_ip_string;
  685. char ifname[CFG_INTERFACE_NAME_MAX_LEN];
  686. unsigned int iface_ids[INTERFACE_MAX];
  687. unsigned int i;
  688. cs_error_t res = CS_OK;
  689. ENTER();
  690. res_lib_cfg_ringstatusget.header.id = MESSAGE_RES_CFG_RINGSTATUSGET;
  691. res_lib_cfg_ringstatusget.header.size = sizeof (struct res_lib_cfg_ringstatusget);
  692. api->totem_ifaces_get (
  693. api->totem_nodeid_get(),
  694. iface_ids,
  695. interfaces,
  696. INTERFACE_MAX,
  697. &status,
  698. &iface_count);
  699. assert(iface_count <= CFG_MAX_INTERFACES);
  700. res_lib_cfg_ringstatusget.interface_count = iface_count;
  701. for (i = 0; i < iface_count; i++) {
  702. totem_ip_string
  703. = (const char *)api->totem_ip_print (&interfaces[i]);
  704. if (!totem_ip_string) {
  705. totem_ip_string="";
  706. }
  707. /* Allow for i/f number at the start */
  708. if (strlen(totem_ip_string) >= CFG_INTERFACE_NAME_MAX_LEN-3) {
  709. log_printf(LOGSYS_LEVEL_ERROR, "String representation of interface %u is too long", i);
  710. res = CS_ERR_NAME_TOO_LONG;
  711. goto send_response;
  712. }
  713. snprintf(ifname, sizeof(ifname), "%d %s", iface_ids[i], totem_ip_string);
  714. if (strlen(status[i]) >= CFG_INTERFACE_STATUS_MAX_LEN) {
  715. log_printf(LOGSYS_LEVEL_ERROR, "Status string for interface %u is too long", i);
  716. res = CS_ERR_NAME_TOO_LONG;
  717. goto send_response;
  718. }
  719. strcpy ((char *)&res_lib_cfg_ringstatusget.interface_status[i],
  720. status[i]);
  721. strcpy ((char *)&res_lib_cfg_ringstatusget.interface_name[i],
  722. ifname);
  723. }
  724. send_response:
  725. res_lib_cfg_ringstatusget.header.error = res;
  726. api->ipc_response_send (
  727. conn,
  728. &res_lib_cfg_ringstatusget,
  729. sizeof (struct res_lib_cfg_ringstatusget));
  730. LEAVE();
  731. }
  732. static void message_handler_req_lib_cfg_ringreenable (
  733. void *conn,
  734. const void *msg)
  735. {
  736. struct res_lib_cfg_ringreenable res_lib_cfg_ringreenable;
  737. ENTER();
  738. res_lib_cfg_ringreenable.header.id = MESSAGE_RES_CFG_RINGREENABLE;
  739. res_lib_cfg_ringreenable.header.size = sizeof (struct res_lib_cfg_ringreenable);
  740. res_lib_cfg_ringreenable.header.error = CS_ERR_NOT_SUPPORTED;
  741. api->ipc_response_send (
  742. conn, &res_lib_cfg_ringreenable,
  743. sizeof (struct res_lib_cfg_ringreenable));
  744. LEAVE();
  745. }
  746. static void message_handler_req_lib_cfg_killnode (
  747. void *conn,
  748. const void *msg)
  749. {
  750. const struct req_lib_cfg_killnode *req_lib_cfg_killnode = msg;
  751. struct res_lib_cfg_killnode res_lib_cfg_killnode;
  752. struct req_exec_cfg_killnode req_exec_cfg_killnode;
  753. struct iovec iovec;
  754. ENTER();
  755. req_exec_cfg_killnode.header.size =
  756. sizeof (struct req_exec_cfg_killnode);
  757. req_exec_cfg_killnode.header.id = SERVICE_ID_MAKE (CFG_SERVICE,
  758. MESSAGE_REQ_EXEC_CFG_KILLNODE);
  759. req_exec_cfg_killnode.nodeid = req_lib_cfg_killnode->nodeid;
  760. marshall_to_mar_name_t(&req_exec_cfg_killnode.reason, &req_lib_cfg_killnode->reason);
  761. iovec.iov_base = (char *)&req_exec_cfg_killnode;
  762. iovec.iov_len = sizeof (struct req_exec_cfg_killnode);
  763. (void)api->totem_mcast (&iovec, 1, TOTEM_SAFE);
  764. res_lib_cfg_killnode.header.size = sizeof(struct res_lib_cfg_killnode);
  765. res_lib_cfg_killnode.header.id = MESSAGE_RES_CFG_KILLNODE;
  766. res_lib_cfg_killnode.header.error = CS_OK;
  767. api->ipc_response_send(conn, &res_lib_cfg_killnode,
  768. sizeof(res_lib_cfg_killnode));
  769. LEAVE();
  770. }
  771. static void message_handler_req_lib_cfg_tryshutdown (
  772. void *conn,
  773. const void *msg)
  774. {
  775. struct cfg_info *ci = (struct cfg_info *)api->ipc_private_data_get (conn);
  776. const struct req_lib_cfg_tryshutdown *req_lib_cfg_tryshutdown = msg;
  777. struct qb_list_head *iter;
  778. ENTER();
  779. if (req_lib_cfg_tryshutdown->flags == CFG_SHUTDOWN_FLAG_IMMEDIATE) {
  780. struct res_lib_cfg_tryshutdown res_lib_cfg_tryshutdown;
  781. /*
  782. * Tell other nodes
  783. */
  784. send_shutdown();
  785. res_lib_cfg_tryshutdown.header.size = sizeof(struct res_lib_cfg_tryshutdown);
  786. res_lib_cfg_tryshutdown.header.id = MESSAGE_RES_CFG_TRYSHUTDOWN;
  787. res_lib_cfg_tryshutdown.header.error = CS_OK;
  788. api->ipc_response_send(conn, &res_lib_cfg_tryshutdown,
  789. sizeof(res_lib_cfg_tryshutdown));
  790. LEAVE();
  791. return;
  792. }
  793. /*
  794. * Shutdown in progress, return an error
  795. */
  796. if (shutdown_con) {
  797. struct res_lib_cfg_tryshutdown res_lib_cfg_tryshutdown;
  798. res_lib_cfg_tryshutdown.header.size = sizeof(struct res_lib_cfg_tryshutdown);
  799. res_lib_cfg_tryshutdown.header.id = MESSAGE_RES_CFG_TRYSHUTDOWN;
  800. res_lib_cfg_tryshutdown.header.error = CS_ERR_EXIST;
  801. api->ipc_response_send(conn, &res_lib_cfg_tryshutdown,
  802. sizeof(res_lib_cfg_tryshutdown));
  803. LEAVE();
  804. return;
  805. }
  806. ci->conn = conn;
  807. shutdown_con = (struct cfg_info *)api->ipc_private_data_get (conn);
  808. shutdown_flags = req_lib_cfg_tryshutdown->flags;
  809. shutdown_yes = 0;
  810. shutdown_no = 0;
  811. /*
  812. * Count the number of listeners
  813. */
  814. shutdown_expected = 0;
  815. qb_list_for_each(iter, &trackers_list) {
  816. struct cfg_info *testci = qb_list_entry(iter, struct cfg_info, list);
  817. /*
  818. * It is assumed that we will allow shutdown
  819. */
  820. if (testci != ci) {
  821. testci->shutdown_reply = SHUTDOWN_REPLY_UNKNOWN;
  822. shutdown_expected++;
  823. }
  824. }
  825. /*
  826. * If no-one is listening for events then we can just go down now
  827. */
  828. if (shutdown_expected == 0) {
  829. struct res_lib_cfg_tryshutdown res_lib_cfg_tryshutdown;
  830. res_lib_cfg_tryshutdown.header.size = sizeof(struct res_lib_cfg_tryshutdown);
  831. res_lib_cfg_tryshutdown.header.id = MESSAGE_RES_CFG_TRYSHUTDOWN;
  832. res_lib_cfg_tryshutdown.header.error = CS_OK;
  833. /*
  834. * Tell originator that shutdown was confirmed
  835. */
  836. api->ipc_response_send(conn, &res_lib_cfg_tryshutdown,
  837. sizeof(res_lib_cfg_tryshutdown));
  838. send_shutdown();
  839. LEAVE();
  840. return;
  841. }
  842. else {
  843. unsigned int shutdown_timeout = DEFAULT_SHUTDOWN_TIMEOUT;
  844. /*
  845. * Look for a shutdown timeout in configuration map
  846. */
  847. icmap_get_uint32("cfg.shutdown_timeout", &shutdown_timeout);
  848. /*
  849. * Start the timer. If we don't get a full set of replies before this goes
  850. * off we'll cancel the shutdown
  851. */
  852. api->timer_add_duration((unsigned long long)shutdown_timeout*1000000000, NULL,
  853. shutdown_timer_fn, &shutdown_timer);
  854. /*
  855. * Tell the users we would like to shut down
  856. */
  857. send_test_shutdown(NULL, conn, CS_OK);
  858. }
  859. /*
  860. * We don't sent a reply to the caller here.
  861. * We send it when we know if we can shut down or not
  862. */
  863. LEAVE();
  864. }
  865. static void message_handler_req_lib_cfg_replytoshutdown (
  866. void *conn,
  867. const void *msg)
  868. {
  869. struct cfg_info *ci = (struct cfg_info *)api->ipc_private_data_get (conn);
  870. const struct req_lib_cfg_replytoshutdown *req_lib_cfg_replytoshutdown = msg;
  871. struct res_lib_cfg_replytoshutdown res_lib_cfg_replytoshutdown;
  872. int status = CS_OK;
  873. ENTER();
  874. if (!shutdown_con) {
  875. status = CS_ERR_ACCESS;
  876. goto exit_fn;
  877. }
  878. if (req_lib_cfg_replytoshutdown->response) {
  879. shutdown_yes++;
  880. ci->shutdown_reply = SHUTDOWN_REPLY_YES;
  881. }
  882. else {
  883. shutdown_no++;
  884. ci->shutdown_reply = SHUTDOWN_REPLY_NO;
  885. }
  886. check_shutdown_status();
  887. exit_fn:
  888. res_lib_cfg_replytoshutdown.header.error = status;
  889. res_lib_cfg_replytoshutdown.header.id = MESSAGE_RES_CFG_REPLYTOSHUTDOWN;
  890. res_lib_cfg_replytoshutdown.header.size = sizeof(res_lib_cfg_replytoshutdown);
  891. api->ipc_response_send(conn, &res_lib_cfg_replytoshutdown,
  892. sizeof(res_lib_cfg_replytoshutdown));
  893. LEAVE();
  894. }
  895. static void message_handler_req_lib_cfg_get_node_addrs (void *conn,
  896. const void *msg)
  897. {
  898. struct totem_ip_address node_ifs[INTERFACE_MAX];
  899. unsigned int iface_ids[INTERFACE_MAX];
  900. char buf[PIPE_BUF];
  901. char **status;
  902. unsigned int num_interfaces = 0;
  903. struct sockaddr_storage *ss;
  904. int ret = CS_OK;
  905. int i;
  906. int live_addrs = 0;
  907. const struct req_lib_cfg_get_node_addrs *req_lib_cfg_get_node_addrs = msg;
  908. struct res_lib_cfg_get_node_addrs *res_lib_cfg_get_node_addrs = (struct res_lib_cfg_get_node_addrs *)buf;
  909. unsigned int nodeid = req_lib_cfg_get_node_addrs->nodeid;
  910. char *addr_buf;
  911. if (nodeid == 0)
  912. nodeid = api->totem_nodeid_get();
  913. if (api->totem_ifaces_get(nodeid, iface_ids, node_ifs, INTERFACE_MAX, &status, &num_interfaces)) {
  914. ret = CS_ERR_EXIST;
  915. num_interfaces = 0;
  916. }
  917. res_lib_cfg_get_node_addrs->header.size = sizeof(struct res_lib_cfg_get_node_addrs) + (num_interfaces * TOTEMIP_ADDRLEN);
  918. res_lib_cfg_get_node_addrs->header.id = MESSAGE_RES_CFG_GET_NODE_ADDRS;
  919. res_lib_cfg_get_node_addrs->header.error = ret;
  920. if (num_interfaces) {
  921. res_lib_cfg_get_node_addrs->family = node_ifs[0].family;
  922. for (i = 0, addr_buf = (char *)res_lib_cfg_get_node_addrs->addrs;
  923. i < num_interfaces; i++) {
  924. ss = (struct sockaddr_storage *)&node_ifs[i].addr;
  925. if (ss->ss_family) {
  926. memcpy(addr_buf, node_ifs[i].addr, TOTEMIP_ADDRLEN);
  927. live_addrs++;
  928. addr_buf += TOTEMIP_ADDRLEN;
  929. }
  930. }
  931. res_lib_cfg_get_node_addrs->num_addrs = live_addrs;
  932. } else {
  933. res_lib_cfg_get_node_addrs->header.error = CS_ERR_NOT_EXIST;
  934. }
  935. api->ipc_response_send(conn, res_lib_cfg_get_node_addrs, res_lib_cfg_get_node_addrs->header.size);
  936. }
  937. static void message_handler_req_lib_cfg_local_get (void *conn, const void *msg)
  938. {
  939. struct res_lib_cfg_local_get res_lib_cfg_local_get;
  940. res_lib_cfg_local_get.header.size = sizeof(res_lib_cfg_local_get);
  941. res_lib_cfg_local_get.header.id = MESSAGE_RES_CFG_LOCAL_GET;
  942. res_lib_cfg_local_get.header.error = CS_OK;
  943. res_lib_cfg_local_get.local_nodeid = api->totem_nodeid_get ();
  944. api->ipc_response_send(conn, &res_lib_cfg_local_get,
  945. sizeof(res_lib_cfg_local_get));
  946. }
  947. static void message_handler_req_lib_cfg_reload_config (void *conn, const void *msg)
  948. {
  949. struct req_exec_cfg_reload_config req_exec_cfg_reload_config;
  950. struct iovec iovec;
  951. ENTER();
  952. req_exec_cfg_reload_config.header.size =
  953. sizeof (struct req_exec_cfg_reload_config);
  954. req_exec_cfg_reload_config.header.id = SERVICE_ID_MAKE (CFG_SERVICE,
  955. MESSAGE_REQ_EXEC_CFG_RELOAD_CONFIG);
  956. api->ipc_source_set (&req_exec_cfg_reload_config.source, conn);
  957. api->ipc_refcnt_inc(conn);
  958. iovec.iov_base = (char *)&req_exec_cfg_reload_config;
  959. iovec.iov_len = sizeof (struct req_exec_cfg_reload_config);
  960. assert (api->totem_mcast (&iovec, 1, TOTEM_SAFE) == 0);
  961. LEAVE();
  962. }
  963. static void message_handler_req_lib_cfg_reopen_log_files (void *conn, const void *msg)
  964. {
  965. struct res_lib_cfg_reopen_log_files res_lib_cfg_reopen_log_files;
  966. cs_error_t res;
  967. ENTER();
  968. log_printf(LOGSYS_LEVEL_DEBUG, "Reopening logging files\n");
  969. res = logsys_reopen_log_files();
  970. res_lib_cfg_reopen_log_files.header.size = sizeof(res_lib_cfg_reopen_log_files);
  971. res_lib_cfg_reopen_log_files.header.id = MESSAGE_RES_CFG_REOPEN_LOG_FILES;
  972. res_lib_cfg_reopen_log_files.header.error = res;
  973. api->ipc_response_send(conn,
  974. &res_lib_cfg_reopen_log_files,
  975. sizeof(res_lib_cfg_reopen_log_files));
  976. LEAVE();
  977. }