Procházet zdrojové kódy

votequorum: drop votequorum_leave

this was a compatibility function for cman_tool only.

Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
Reviewed-by: Steven Dake <sdake@redhat.com>
Fabio M. Di Nitto před 14 roky
rodič
revize
23ea4f0f11

+ 0 - 1
include/corosync/ipc_votequorum.h

@@ -47,7 +47,6 @@ enum req_votequorum_types {
 	MESSAGE_REQ_VOTEQUORUM_QDISK_UNREGISTER,
 	MESSAGE_REQ_VOTEQUORUM_QDISK_POLL,
 	MESSAGE_REQ_VOTEQUORUM_QDISK_GETINFO,
-	MESSAGE_REQ_VOTEQUORUM_LEAVING,
 	MESSAGE_REQ_VOTEQUORUM_TRACKSTART,
 	MESSAGE_REQ_VOTEQUORUM_TRACKSTOP
 };

+ 0 - 6
include/corosync/votequorum.h

@@ -194,12 +194,6 @@ cs_error_t votequorum_trackstart (
 cs_error_t votequorum_trackstop (
 	votequorum_handle_t handle);
 
-/**
- * Set our LEAVING flag. we should exit soon after this
- */
-cs_error_t votequorum_leaving (
-	votequorum_handle_t handle);
-
 /**
  * Save and retrieve private data/context
  */

+ 0 - 1
lib/libvotequorum.versions

@@ -11,7 +11,6 @@ COROSYNC_VOTEQUORUM_1.0 {
 		votequorum_qdisk_unregister;
 		votequorum_qdisk_poll;
 		votequorum_qdisk_getinfo;
-		votequorum_leaving;
 		votequorum_trackstart;
 		votequorum_trackstop;
 		votequorum_context_get;

+ 0 - 40
lib/votequorum.c

@@ -448,46 +448,6 @@ error_exit:
 	return (error);
 }
 
-cs_error_t votequorum_leaving (
-	votequorum_handle_t handle)
-{
-	cs_error_t error;
-	struct votequorum_inst *votequorum_inst;
-	struct iovec iov;
-	struct req_lib_votequorum_general req_lib_votequorum_general;
-	struct res_lib_votequorum_status res_lib_votequorum_status;
-
-	error = hdb_error_to_cs(hdb_handle_get (&votequorum_handle_t_db, handle, (void *)&votequorum_inst));
-	if (error != CS_OK) {
-		return (error);
-	}
-
-
-	req_lib_votequorum_general.header.size = sizeof (struct req_lib_votequorum_general);
-	req_lib_votequorum_general.header.id = MESSAGE_REQ_VOTEQUORUM_LEAVING;
-
-	iov.iov_base = (char *)&req_lib_votequorum_general;
-	iov.iov_len = sizeof (struct req_lib_votequorum_general);
-
-        error = qb_to_cs_error(qb_ipcc_sendv_recv (
-		votequorum_inst->c,
-		&iov,
-		1,
-                &res_lib_votequorum_status,
-		sizeof (struct res_lib_votequorum_status), CS_IPC_TIMEOUT_MS));
-
-	if (error != CS_OK) {
-		goto error_exit;
-	}
-
-	error = res_lib_votequorum_status.header.error;
-
-error_exit:
-	hdb_handle_put (&votequorum_handle_t_db, handle);
-
-	return (error);
-}
-
 cs_error_t votequorum_trackstart (
 	votequorum_handle_t handle,
 	uint64_t context,

+ 0 - 1
man/Makefile.am

@@ -101,7 +101,6 @@ dist_man_MANS = \
 	votequorum_finalize.3 \
 	votequorum_getinfo.3 \
 	votequorum_initialize.3 \
-	votequorum_leaving.3 \
 	votequorum_qdisk_getinfo.3 \
 	votequorum_qdisk_poll.3 \
 	votequorum_qdisk_register.3 \

+ 0 - 4
man/index.html

@@ -190,10 +190,6 @@
       Description of the votequorum interface.
       <br>
 
-      <a href="votequorum_leaving.3.html">votequorum_leaving(3)</a>:
-      Description of the votequorum interface.
-      <br>
-
       <a href="votequorum_setexpected.3.html">votequorum_setexpected(3)</a>:
       Description of the votequorum interface.
       <br>

+ 0 - 67
man/votequorum_leaving.3

@@ -1,67 +0,0 @@
-.\"/*
-.\" * Copyright (c) 2009 Red Hat, Inc.
-.\" *
-.\" * All rights reserved.
-.\" *
-.\" * Author: Christine Caulfield <ccaulfie@redhat.com>
-.\" *
-.\" * This software licensed under BSD license, the text of which follows:
-.\" *
-.\" * Redistribution and use in source and binary forms, with or without
-.\" * modification, are permitted provided that the following conditions are met:
-.\" *
-.\" * - Redistributions of source code must retain the above copyright notice,
-.\" *   this list of conditions and the following disclaimer.
-.\" * - Redistributions in binary form must reproduce the above copyright notice,
-.\" *   this list of conditions and the following disclaimer in the documentation
-.\" *   and/or other materials provided with the distribution.
-.\" * - Neither the name of the MontaVista Software, Inc. nor the names of its
-.\" *   contributors may be used to endorse or promote products derived from this
-.\" *   software without specific prior written permission.
-.\" *
-.\" * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-.\" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-.\" * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-.\" * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-.\" * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-.\" * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-.\" * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-.\" * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
-.\" * THE POSSIBILITY OF SUCH DAMAGE.
-.\" */
-.TH VOTEQUORUM_LEAVING 3 2009-01-26 "corosync Man Page" "Corosync Cluster Engine Programmer's Manual"
-.SH NAME
-votequorum_leaving \- Tell other nodes that we are leaving the cluster
-.SH SYNOPSIS
-.B #include <corosync/votequorum.h>
-.sp
-.BI "int votequorum_leaving(votequorum_handle_t " handle ");"
-.SH DESCRIPTION
-The
-.B votequorum_leaving
-function is used to tell the other nodes in the cluster that this node is leaving. They
-will (when the node actually leaves) reduce quorum to keep the cluster running without
-this node.
-.PP
-This function should only be called if it is known that the node is being shut down for
-a known reason and could be out of the cluster for an extended period of time.
-.PP
-Normal behaviour is for the cluster to reduce the total number of votes, but NOT expected_votes
-when a node leave the cluster, so the cluster could become inquorate. This is correct behaviour
-and is ther eto prevent split-brain.
-.PP
-Do NOT call this function unless you know what you are doing.
-.SH RETURN VALUE
-This call returns the CS_OK value if successful, otherwise an error is returned.
-.PP
-.SH ERRORS
-The errors are undocumented.
-.SH "SEE ALSO"
-.BR votequorum_overview (8),
-.BR votequorum_initialize (3),
-.BR votequorum_finalize (3),
-.BR votequorum_dispatch (3),
-.BR votequorum_fd_get (3),
-.PP

+ 1 - 68
services/votequorum.c

@@ -121,7 +121,6 @@ static int quorum;
 static int cluster_is_quorate;
 static int first_trans = 1;
 static unsigned int quorumdev_poll = DEFAULT_QDEV_POLL;
-static unsigned int leaving_timeout = DEFAULT_LEAVE_TMO;
 
 static uint8_t two_node = 0;
 static uint8_t wait_for_all = 0;
@@ -137,7 +136,6 @@ static struct cluster_node *us;
 static struct cluster_node *quorum_device = NULL;
 static char quorum_device_name[VOTEQUORUM_MAX_QDISK_NAME_LEN];
 static corosync_timer_handle_t quorum_device_timer;
-static corosync_timer_handle_t leaving_timer;
 static struct list_head cluster_members_list;
 static struct corosync_api_v1 *corosync_api;
 static struct list_head trackers_list;
@@ -209,8 +207,6 @@ static void message_handler_req_lib_votequorum_qdisk_poll (void *conn,
 static void message_handler_req_lib_votequorum_qdisk_getinfo (void *conn,
 							      const void *message);
 
-static void message_handler_req_lib_votequorum_leaving (void *conn,
-							const void *message);
 static void message_handler_req_lib_votequorum_trackstart (void *conn,
 							   const void *message);
 static void message_handler_req_lib_votequorum_trackstop (void *conn,
@@ -260,14 +256,10 @@ static struct corosync_lib_handler quorum_lib_service[] =
 		.flow_control		= COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED
 	},
 	{ /* 7 */
-		.lib_handler_fn		= message_handler_req_lib_votequorum_leaving,
-		.flow_control		= COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED
-	},
-	{ /* 8 */
 		.lib_handler_fn		= message_handler_req_lib_votequorum_trackstart,
 		.flow_control		= COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED
 	},
-	{ /* 9 */
+	{ /* 8 */
 		.lib_handler_fn		= message_handler_req_lib_votequorum_trackstop,
 		.flow_control		= COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED
 	}
@@ -417,7 +409,6 @@ struct req_exec_quorum_nodeinfo {
  */
 #define RECONFIG_PARAM_EXPECTED_VOTES 1
 #define RECONFIG_PARAM_NODE_VOTES     2
-#define RECONFIG_PARAM_LEAVING        3
 
 struct req_exec_quorum_reconfigure {
 	struct qb_ipc_request_header header __attribute__((aligned(8)));
@@ -447,10 +438,6 @@ static void read_quorum_config(void)
 		quorumdev_poll = DEFAULT_QDEV_POLL;
 	}
 
-	if (icmap_get_uint32("quorum.leaving_timeout", &leaving_timeout) != CS_OK) {
-		leaving_timeout = DEFAULT_LEAVE_TMO;
-	}
-
 	icmap_get_uint8("quorum.two_node", &two_node);
 
 	/*
@@ -1183,14 +1170,6 @@ static void message_handler_req_exec_votequorum_reconfigure (
 		recalculate_quorum(1, 0);  /* Allow decrease */
 		break;
 
-	case RECONFIG_PARAM_LEAVING:
-		if (req_exec_quorum_reconfigure->value == 1 && node->state == NODESTATE_MEMBER) {
-			node->state = NODESTATE_LEAVING;
-		}
-		if (req_exec_quorum_reconfigure->value == 0 && node->state == NODESTATE_LEAVING) {
-			node->state = NODESTATE_MEMBER;
-		}
-		break;
 	}
 
 	LEAVE();
@@ -1209,26 +1188,6 @@ static int quorum_lib_init_fn (void *conn)
 	return (0);
 }
 
-/*
- * Someone called votequorum_leave AGES ago!
- * Assume they forgot to shut down the node.
- */
-static void leaving_timer_fn(void *arg)
-{
-	ENTER();
-
-	if (us->state == NODESTATE_LEAVING) {
-		us->state = NODESTATE_MEMBER;
-	}
-
-	/*
-	 * Tell everyone else we made a mistake
-	 */
-	quorum_exec_send_reconfigure(RECONFIG_PARAM_LEAVING, us->node_id, 0);
-
-	LEAVE();
-}
-
 /*
  * Message from the library
  */
@@ -1396,32 +1355,6 @@ error_exit:
 	LEAVE();
 }
 
-static void message_handler_req_lib_votequorum_leaving (void *conn, const void *message)
-{
-	struct res_lib_votequorum_status res_lib_votequorum_status;
-	cs_error_t error = CS_OK;
-
-	ENTER();
-
-	quorum_exec_send_reconfigure(RECONFIG_PARAM_LEAVING, us->node_id, 1);
-
-	/*
-	 * If we don't shut down in a sensible amount of time then cancel the
-	 * leave status.
-	 */
-	if (leaving_timeout) {
-		corosync_api->timer_add_duration((unsigned long long)leaving_timeout*1000000, NULL,
-						 leaving_timer_fn, &leaving_timer);
-	}
-
-	res_lib_votequorum_status.header.size = sizeof(res_lib_votequorum_status);
-	res_lib_votequorum_status.header.id = MESSAGE_RES_VOTEQUORUM_STATUS;
-	res_lib_votequorum_status.header.error = error;
-	corosync_api->ipc_response_send(conn, &res_lib_votequorum_status, sizeof(res_lib_votequorum_status));
-
-	LEAVE();
-}
-
 static void quorum_device_timer_fn(void *arg)
 {
 	ENTER();