From 9da89f32c296e3d1b10b033bbe85dacdf512c29d Mon Sep 17 00:00:00 2001 From: Christine Caulfield Date: Thu, 3 Aug 2017 09:58:27 +0100 Subject: [PATCH] CFG: Remove ring-reenable code RRP doesn't exist any more so all the ring re-enable code is redundant. I've removed it from the library and all the code that does anything, but I've left the hole in the IPC just in case old libraries are hanging around. Signed-off-by: Christine Caulfield Reviewed-by: Jan Friesse --- exec/apidef.c | 1 - exec/cfg.c | 35 ++++++-------------------- exec/totempg.c | 9 ------- exec/totemsrp.c | 6 ----- exec/totemsrp.h | 3 --- include/corosync/cfg.h | 9 ------- include/corosync/coroapi.h | 2 -- include/corosync/totem/totempg.h | 2 -- lib/cfg.c | 32 ------------------------ lib/libcfg.verso | 2 +- man/corosync-cfgtool.8 | 13 +++++----- tools/corosync-cfgtool.c | 42 +++++++------------------------- 12 files changed, 24 insertions(+), 132 deletions(-) diff --git a/exec/apidef.c b/exec/apidef.c index d48cbcb3..88059739 100644 --- a/exec/apidef.c +++ b/exec/apidef.c @@ -109,7 +109,6 @@ static struct corosync_api_v1 apidef_corosync_api_v1 = { .ipc_refcnt_dec = cs_ipc_refcnt_dec, .totem_nodeid_get = totempg_my_nodeid_get, .totem_family_get = totempg_my_family_get, - .totem_ring_reenable = totempg_ring_reenable, .totem_mcast = main_mcast, .totem_ifaces_get = totempg_ifaces_get, .totem_ifaces_print = totempg_ifaces_print, diff --git a/exec/cfg.c b/exec/cfg.c index c9d98489..16e04dca 100644 --- a/exec/cfg.c +++ b/exec/cfg.c @@ -482,23 +482,8 @@ static void message_handler_req_exec_cfg_ringreenable ( const void *message, unsigned int nodeid) { - const struct req_exec_cfg_ringreenable *req_exec_cfg_ringreenable - = message; - struct res_lib_cfg_ringreenable res_lib_cfg_ringreenable; - ENTER(); - api->totem_ring_reenable (); - if (api->ipc_source_is_local(&req_exec_cfg_ringreenable->source)) { - res_lib_cfg_ringreenable.header.id = MESSAGE_RES_CFG_RINGREENABLE; - res_lib_cfg_ringreenable.header.size = sizeof (struct res_lib_cfg_ringreenable); - res_lib_cfg_ringreenable.header.error = CS_OK; - api->ipc_response_send ( - req_exec_cfg_ringreenable->source.conn, - &res_lib_cfg_ringreenable, - sizeof (struct res_lib_cfg_ringreenable)); - api->ipc_refcnt_dec(req_exec_cfg_ringreenable->source.conn); - } LEAVE(); } @@ -806,21 +791,15 @@ static void message_handler_req_lib_cfg_ringreenable ( void *conn, const void *msg) { - struct req_exec_cfg_ringreenable req_exec_cfg_ringreenable; - struct iovec iovec; - + struct res_lib_cfg_ringreenable res_lib_cfg_ringreenable; ENTER(); - req_exec_cfg_ringreenable.header.size = - sizeof (struct req_exec_cfg_ringreenable); - req_exec_cfg_ringreenable.header.id = SERVICE_ID_MAKE (CFG_SERVICE, - MESSAGE_REQ_EXEC_CFG_RINGREENABLE); - api->ipc_source_set (&req_exec_cfg_ringreenable.source, conn); - api->ipc_refcnt_inc(conn); - iovec.iov_base = (char *)&req_exec_cfg_ringreenable; - iovec.iov_len = sizeof (struct req_exec_cfg_ringreenable); - - assert (api->totem_mcast (&iovec, 1, TOTEM_SAFE) == 0); + res_lib_cfg_ringreenable.header.id = MESSAGE_RES_CFG_RINGREENABLE; + res_lib_cfg_ringreenable.header.size = sizeof (struct res_lib_cfg_ringreenable); + res_lib_cfg_ringreenable.header.error = CS_ERR_NOT_SUPPORTED; + api->ipc_response_send ( + conn, &res_lib_cfg_ringreenable, + sizeof (struct res_lib_cfg_ringreenable)); LEAVE(); } diff --git a/exec/totempg.c b/exec/totempg.c index 23ffe213..e69198bf 100644 --- a/exec/totempg.c +++ b/exec/totempg.c @@ -1442,15 +1442,6 @@ int totempg_crypto_set ( return (res); } -int totempg_ring_reenable (void) -{ - int res; - - res = totemsrp_ring_reenable (totemsrp_context); - - return (res); -} - #define ONE_IFACE_LEN 63 const char *totempg_ifaces_print (unsigned int nodeid) { diff --git a/exec/totemsrp.c b/exec/totemsrp.c index 2104f87a..1758a663 100644 --- a/exec/totemsrp.c +++ b/exec/totemsrp.c @@ -1121,12 +1121,6 @@ int totemsrp_my_family_get ( return (res); } -int totemsrp_ring_reenable ( - void *srp_context) -{ - return (0); -} - /* * Set operations for use by the membership algorithm diff --git a/exec/totemsrp.h b/exec/totemsrp.h index 4930c937..c5d4092b 100644 --- a/exec/totemsrp.h +++ b/exec/totemsrp.h @@ -120,9 +120,6 @@ extern int totemsrp_crypto_set ( const char *cipher_type, const char *hash_type); -extern int totemsrp_ring_reenable ( - void *srp_context); - void totemsrp_service_ready_register ( void *srp_context, void (*totem_service_ready) (void)); diff --git a/include/corosync/cfg.h b/include/corosync/cfg.h index 22ecd142..c0c4cbd7 100644 --- a/include/corosync/cfg.h +++ b/include/corosync/cfg.h @@ -162,15 +162,6 @@ corosync_cfg_ring_status_get ( char ***status, unsigned int *interface_count); -/** - * @brief corosync_cfg_ring_reenable - * @param cfg_handle - * @return - */ -cs_error_t -corosync_cfg_ring_reenable ( - corosync_cfg_handle_t cfg_handle); - /** * @brief corosync_cfg_kill_node * @param cfg_handle diff --git a/include/corosync/coroapi.h b/include/corosync/coroapi.h index 3a36f255..cd24d26b 100644 --- a/include/corosync/coroapi.h +++ b/include/corosync/coroapi.h @@ -276,8 +276,6 @@ struct corosync_api_v1 { int (*totem_family_get) (void); - int (*totem_ring_reenable) (void); - int (*totem_mcast) (const struct iovec *iovec, unsigned int iov_len, unsigned int guarantee); diff --git a/include/corosync/totem/totempg.h b/include/corosync/totem/totempg.h index 9938e5b2..37776299 100644 --- a/include/corosync/totem/totempg.h +++ b/include/corosync/totem/totempg.h @@ -157,8 +157,6 @@ extern int totempg_my_family_get (void); extern int totempg_crypto_set (const char *cipher_type, const char *hash_type); -extern int totempg_ring_reenable (void); - extern void totempg_service_ready_register ( void (*totem_service_ready) (void)); diff --git a/lib/cfg.c b/lib/cfg.c index abf08bf0..2b05473f 100644 --- a/lib/cfg.c +++ b/lib/cfg.c @@ -367,38 +367,6 @@ exit_handle_put: return (error); } -cs_error_t -corosync_cfg_ring_reenable ( - corosync_cfg_handle_t cfg_handle) -{ - struct cfg_inst *cfg_inst; - struct req_lib_cfg_ringreenable req_lib_cfg_ringreenable; - struct res_lib_cfg_ringreenable res_lib_cfg_ringreenable; - cs_error_t error; - struct iovec iov; - - error = hdb_error_to_cs(hdb_handle_get (&cfg_hdb, cfg_handle, (void *)&cfg_inst)); - if (error != CS_OK) { - return (error); - } - - req_lib_cfg_ringreenable.header.size = sizeof (struct req_lib_cfg_ringreenable); - req_lib_cfg_ringreenable.header.id = MESSAGE_REQ_CFG_RINGREENABLE; - - iov.iov_base = (void *)&req_lib_cfg_ringreenable, - iov.iov_len = sizeof (struct req_lib_cfg_ringreenable); - - error = qb_to_cs_error (qb_ipcc_sendv_recv (cfg_inst->c, - &iov, - 1, - &res_lib_cfg_ringreenable, - sizeof (struct res_lib_cfg_ringreenable), CS_IPC_TIMEOUT_MS)); - - (void)hdb_handle_put (&cfg_hdb, cfg_handle); - - return (error); -} - cs_error_t corosync_cfg_kill_node ( corosync_cfg_handle_t cfg_handle, diff --git a/lib/libcfg.verso b/lib/libcfg.verso index 09b254e9..66ce77b7 100644 --- a/lib/libcfg.verso +++ b/lib/libcfg.verso @@ -1 +1 @@ -6.0.0 +7.0.0 diff --git a/man/corosync-cfgtool.8 b/man/corosync-cfgtool.8 index b190766e..83dd7d11 100644 --- a/man/corosync-cfgtool.8 +++ b/man/corosync-cfgtool.8 @@ -35,7 +35,7 @@ .SH "NAME" corosync-cfgtool \- An administrative tool for corosync. .SH "SYNOPSIS" -.B corosync\-cfgtool [\-i IP_address] [\-s] [\-r] [\-R] [\-k nodeid] [\-a nodeid] [\-h] [\-H] +.B corosync\-cfgtool [\-i IP_address] [\-s] [\-R] [\-k nodeid] [\-a nodeid] [\-h] [\-H] .SH "DESCRIPTION" .B corosync\-cfgtool A tool for displaying and configuring active parameters within corosync. @@ -45,13 +45,14 @@ A tool for displaying and configuring active parameters within corosync. Finds only information about the specified interface IP address. .TP .B -s -Displays the status of the current rings on this node. If any interfaces are +Displays the status of the current links on this node. If any interfaces are faulty, 1 is returned by the binary. If all interfaces are active 0 is returned to the shell. -.TP -.B -r -Reset redundant ring state cluster wide after a fault to -re-enable redundant ring operation. +After each link, the nodes on that link are displayed in order with their status +encoded into a single digit. 1=link enabled, 2=link connected, So a 3 in +a node position indicates that the link is both enabled and connected. +The local link (which will only ever be enabled on link 0) shows as enabled but +not connected for internal reasons. .TP .B -R Tell all instances of corosync in this cluster to reload corosync.conf. diff --git a/tools/corosync-cfgtool.c b/tools/corosync-cfgtool.c index 201977b2..b08e9b45 100644 --- a/tools/corosync-cfgtool.c +++ b/tools/corosync-cfgtool.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2013 Red Hat, Inc. + * Copyright (c) 2006-2017 Red Hat, Inc. * * All rights reserved. * @@ -65,7 +65,8 @@ } while (counter < max); \ } while (0) -static int ringstatusget_do (char *interface_name) +static int +linkstatusget_do (char *interface_name) { cs_error_t result; corosync_cfg_handle_t handle; @@ -76,7 +77,7 @@ static int ringstatusget_do (char *interface_name) unsigned int nodeid; int rc = 0; - printf ("Printing ring status.\n"); + printf ("Printing link status.\n"); result = corosync_cfg_initialize (&handle, NULL); if (result != CS_OK) { printf ("Could not initialize corosync configuration API error %d\n", result); @@ -96,7 +97,7 @@ static int ringstatusget_do (char *interface_name) &interface_status, &interface_count); if (result != CS_OK) { - printf ("Could not get the ring status, the error is: %d\n", result); + printf ("Could not get the link status, the error is: %d\n", result); } else { for (i = 0; i < interface_count; i++) { if ( (interface_name && @@ -104,7 +105,7 @@ static int ringstatusget_do (char *interface_name) strcasecmp (interface_name, interface_names[i]) == 0)) || !interface_name ) { - printf ("RING ID %d\n", i); + printf ("LINK ID %d\n", i); printf ("\tid\t= %s\n", interface_names[i]); printf ("\tstatus\t= %s\n", interface_status[i]); if (strstr(interface_status[i], "FAULTY")) { @@ -125,26 +126,6 @@ static int ringstatusget_do (char *interface_name) return rc; } -static void ringreenable_do (void) -{ - cs_error_t result; - corosync_cfg_handle_t handle; - - printf ("Re-enabling all failed rings.\n"); - result = corosync_cfg_initialize (&handle, NULL); - if (result != CS_OK) { - printf ("Could not initialize corosync configuration API error %d\n", result); - exit (1); - } - - result = corosync_cfg_ring_reenable (handle); - if (result != CS_OK) { - printf ("Could not re-enable ring error %d\n", result); - } - - (void)corosync_cfg_finalize (handle); -} - static int reload_config_do (void) { cs_error_t result; @@ -261,13 +242,11 @@ static void killnode_do(unsigned int nodeid) static void usage_do (void) { - printf ("corosync-cfgtool [-i ] [-s] [-r] [-R] [-k nodeid] [-a nodeid] [-h] [-H]\n\n"); + printf ("corosync-cfgtool [-i ] [-s] [-R] [-k nodeid] [-a nodeid] [-h] [-H]\n\n"); printf ("A tool for displaying and configuring active parameters within corosync.\n"); printf ("options:\n"); printf ("\t-i\tFinds only information about the specified interface IP address.\n"); - printf ("\t-s\tDisplays the status of the current rings on this node.\n"); - printf ("\t-r\tReset redundant ring state cluster wide after a fault to\n"); - printf ("\t\tre-enable redundant ring operation.\n"); + printf ("\t-s\tDisplays the status of the current links on this node.\n"); printf ("\t-R\tTell all instances of corosync in this cluster to reload corosync.conf.\n"); printf ("\t-k\tKill a node identified by node id.\n"); printf ("\t-a\tDisplay the IP address(es) of a node\n"); @@ -292,14 +271,11 @@ int main (int argc, char *argv[]) { interface_name[sizeof(interface_name) - 1] = '\0'; break; case 's': - rc = ringstatusget_do (interface_name); + rc = linkstatusget_do (interface_name); break; case 'R': rc = reload_config_do (); break; - case 'r': - ringreenable_do (); - break; case 'k': nodeid = atoi (optarg); killnode_do(nodeid);