Просмотр исходного кода

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 <ccaulfie@redhat.com>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
Christine Caulfield 8 лет назад
Родитель
Сommit
9da89f32c2
12 измененных файлов с 25 добавлено и 133 удалено
  1. 0 1
      exec/apidef.c
  2. 8 29
      exec/cfg.c
  3. 0 9
      exec/totempg.c
  4. 0 6
      exec/totemsrp.c
  5. 0 3
      exec/totemsrp.h
  6. 0 9
      include/corosync/cfg.h
  7. 0 2
      include/corosync/coroapi.h
  8. 0 2
      include/corosync/totem/totempg.h
  9. 0 32
      lib/cfg.c
  10. 1 1
      lib/libcfg.verso
  11. 7 6
      man/corosync-cfgtool.8
  12. 9 33
      tools/corosync-cfgtool.c

+ 0 - 1
exec/apidef.c

@@ -109,7 +109,6 @@ static struct corosync_api_v1 apidef_corosync_api_v1 = {
 	.ipc_refcnt_dec = cs_ipc_refcnt_dec,
 	.ipc_refcnt_dec = cs_ipc_refcnt_dec,
 	.totem_nodeid_get = totempg_my_nodeid_get,
 	.totem_nodeid_get = totempg_my_nodeid_get,
 	.totem_family_get = totempg_my_family_get,
 	.totem_family_get = totempg_my_family_get,
-	.totem_ring_reenable = totempg_ring_reenable,
 	.totem_mcast = main_mcast,
 	.totem_mcast = main_mcast,
 	.totem_ifaces_get = totempg_ifaces_get,
 	.totem_ifaces_get = totempg_ifaces_get,
 	.totem_ifaces_print = totempg_ifaces_print,
 	.totem_ifaces_print = totempg_ifaces_print,

+ 8 - 29
exec/cfg.c

@@ -482,23 +482,8 @@ static void message_handler_req_exec_cfg_ringreenable (
         const void *message,
         const void *message,
         unsigned int nodeid)
         unsigned int nodeid)
 {
 {
-	const struct req_exec_cfg_ringreenable *req_exec_cfg_ringreenable
-	  = message;
-	struct res_lib_cfg_ringreenable res_lib_cfg_ringreenable;
-
 	ENTER();
 	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();
 	LEAVE();
 }
 }
 
 
@@ -806,21 +791,15 @@ static void message_handler_req_lib_cfg_ringreenable (
 	void *conn,
 	void *conn,
 	const void *msg)
 	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();
 	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();
 	LEAVE();
 }
 }

+ 0 - 9
exec/totempg.c

@@ -1442,15 +1442,6 @@ int totempg_crypto_set (
 	return (res);
 	return (res);
 }
 }
 
 
-int totempg_ring_reenable (void)
-{
-	int res;
-
-	res = totemsrp_ring_reenable (totemsrp_context);
-
-	return (res);
-}
-
 #define ONE_IFACE_LEN 63
 #define ONE_IFACE_LEN 63
 const char *totempg_ifaces_print (unsigned int nodeid)
 const char *totempg_ifaces_print (unsigned int nodeid)
 {
 {

+ 0 - 6
exec/totemsrp.c

@@ -1121,12 +1121,6 @@ int totemsrp_my_family_get (
 	return (res);
 	return (res);
 }
 }
 
 
-int totemsrp_ring_reenable (
-        void *srp_context)
-{
-       return (0);
-}
-
 
 
 /*
 /*
  * Set operations for use by the membership algorithm
  * Set operations for use by the membership algorithm

+ 0 - 3
exec/totemsrp.h

@@ -120,9 +120,6 @@ extern int totemsrp_crypto_set (
 	const char *cipher_type,
 	const char *cipher_type,
 	const char *hash_type);
 	const char *hash_type);
 
 
-extern int totemsrp_ring_reenable (
-	void *srp_context);
-
 void totemsrp_service_ready_register (
 void totemsrp_service_ready_register (
 	void *srp_context,
 	void *srp_context,
 	void (*totem_service_ready) (void));
 	void (*totem_service_ready) (void));

+ 0 - 9
include/corosync/cfg.h

@@ -162,15 +162,6 @@ corosync_cfg_ring_status_get (
 	char ***status,
 	char ***status,
 	unsigned int *interface_count);
 	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
  * @brief corosync_cfg_kill_node
  * @param cfg_handle
  * @param cfg_handle

+ 0 - 2
include/corosync/coroapi.h

@@ -276,8 +276,6 @@ struct corosync_api_v1 {
 
 
 	int (*totem_family_get) (void);
 	int (*totem_family_get) (void);
 
 
-	int (*totem_ring_reenable) (void);
-
 	int (*totem_mcast) (const struct iovec *iovec,
 	int (*totem_mcast) (const struct iovec *iovec,
 			    unsigned int iov_len, unsigned int guarantee);
 			    unsigned int iov_len, unsigned int guarantee);
 
 

+ 0 - 2
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_crypto_set (const char *cipher_type, const char *hash_type);
 
 
-extern int totempg_ring_reenable (void);
-
 extern void totempg_service_ready_register (
 extern void totempg_service_ready_register (
 	void (*totem_service_ready) (void));
 	void (*totem_service_ready) (void));
 
 

+ 0 - 32
lib/cfg.c

@@ -367,38 +367,6 @@ exit_handle_put:
 	return (error);
 	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
 cs_error_t
 corosync_cfg_kill_node (
 corosync_cfg_kill_node (
 	corosync_cfg_handle_t cfg_handle,
 	corosync_cfg_handle_t cfg_handle,

+ 1 - 1
lib/libcfg.verso

@@ -1 +1 @@
-6.0.0
+7.0.0

+ 7 - 6
man/corosync-cfgtool.8

@@ -35,7 +35,7 @@
 .SH "NAME"
 .SH "NAME"
 corosync-cfgtool \- An administrative tool for corosync.
 corosync-cfgtool \- An administrative tool for corosync.
 .SH "SYNOPSIS"
 .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"
 .SH "DESCRIPTION"
 .B corosync\-cfgtool
 .B corosync\-cfgtool
 A tool for displaying and configuring active parameters within corosync.
 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.
 Finds only information about the specified interface IP address.
 .TP 
 .TP 
 .B -s
 .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
 faulty, 1 is returned by the binary.  If all interfaces are active 0 is returned
 to the shell.
 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 
 .TP 
 .B -R
 .B -R
 Tell all instances of corosync in this cluster to reload corosync.conf.
 Tell all instances of corosync in this cluster to reload corosync.conf.

+ 9 - 33
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.
  * All rights reserved.
  *
  *
@@ -65,7 +65,8 @@
 		} while (counter < max);			\
 		} while (counter < max);			\
 	} while (0)
 	} while (0)
 
 
-static int ringstatusget_do (char *interface_name)
+static int
+linkstatusget_do (char *interface_name)
 {
 {
 	cs_error_t result;
 	cs_error_t result;
 	corosync_cfg_handle_t handle;
 	corosync_cfg_handle_t handle;
@@ -76,7 +77,7 @@ static int ringstatusget_do (char *interface_name)
 	unsigned int nodeid;
 	unsigned int nodeid;
 	int rc = 0;
 	int rc = 0;
 
 
-	printf ("Printing ring status.\n");
+	printf ("Printing link status.\n");
 	result = corosync_cfg_initialize (&handle, NULL);
 	result = corosync_cfg_initialize (&handle, NULL);
 	if (result != CS_OK) {
 	if (result != CS_OK) {
 		printf ("Could not initialize corosync configuration API error %d\n", result);
 		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_status,
 				&interface_count);
 				&interface_count);
 	if (result != CS_OK) {
 	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 {
 	} else {
 		for (i = 0; i < interface_count; i++) {
 		for (i = 0; i < interface_count; i++) {
 			if ( (interface_name && 
 			if ( (interface_name && 
@@ -104,7 +105,7 @@ static int ringstatusget_do (char *interface_name)
 				strcasecmp (interface_name, interface_names[i]) == 0)) ||
 				strcasecmp (interface_name, interface_names[i]) == 0)) ||
 				!interface_name ) {
 				!interface_name ) {
 
 
-				printf ("RING ID %d\n", i);
+				printf ("LINK ID %d\n", i);
 				printf ("\tid\t= %s\n", interface_names[i]);
 				printf ("\tid\t= %s\n", interface_names[i]);
 				printf ("\tstatus\t= %s\n", interface_status[i]);
 				printf ("\tstatus\t= %s\n", interface_status[i]);
 				if (strstr(interface_status[i], "FAULTY")) {
 				if (strstr(interface_status[i], "FAULTY")) {
@@ -125,26 +126,6 @@ static int ringstatusget_do (char *interface_name)
 	return rc;
 	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)
 static int reload_config_do (void)
 {
 {
 	cs_error_t result;
 	cs_error_t result;
@@ -261,13 +242,11 @@ static void killnode_do(unsigned int nodeid)
 
 
 static void usage_do (void)
 static void usage_do (void)
 {
 {
-	printf ("corosync-cfgtool [-i <interface ip>] [-s] [-r] [-R] [-k nodeid] [-a nodeid] [-h] [-H]\n\n");
+	printf ("corosync-cfgtool [-i <interface ip>] [-s] [-R] [-k nodeid] [-a nodeid] [-h] [-H]\n\n");
 	printf ("A tool for displaying and configuring active parameters within corosync.\n");
 	printf ("A tool for displaying and configuring active parameters within corosync.\n");
 	printf ("options:\n");
 	printf ("options:\n");
 	printf ("\t-i\tFinds only information about the specified interface IP address.\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-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-k\tKill a node identified by node id.\n");
 	printf ("\t-a\tDisplay the IP address(es) of a node\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';
 			interface_name[sizeof(interface_name) - 1] = '\0';
 			break;
 			break;
 		case 's':
 		case 's':
-			rc = ringstatusget_do (interface_name);
+			rc = linkstatusget_do (interface_name);
 			break;
 			break;
 		case 'R':
 		case 'R':
 			rc = reload_config_do ();
 			rc = reload_config_do ();
 			break;
 			break;
-		case 'r':
-			ringreenable_do ();
-			break;
 		case 'k':
 		case 'k':
 			nodeid = atoi (optarg);
 			nodeid = atoi (optarg);
 			killnode_do(nodeid);
 			killnode_do(nodeid);