mirror of
https://git.proxmox.com/git/mirror_corosync
synced 2025-07-26 13:14:16 +00:00
votequorum: rename qdisk to qdevice
a quorum device is not necessarely a disk and this also aligns various names to be generic Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com> Reviewed-By: Christine Caulfield <ccaulfie@redhat.com>
This commit is contained in:
parent
769fc913f3
commit
ccd36af00e
@ -68,7 +68,7 @@ static struct corosync_api_v1 *corosync_api;
|
||||
#define DEFAULT_QDEV_POLL 10000
|
||||
|
||||
static unsigned int quorumdev_poll = DEFAULT_QDEV_POLL;
|
||||
static char quorum_device_name[VOTEQUORUM_MAX_QDISK_NAME_LEN];
|
||||
static char quorum_device_name[VOTEQUORUM_MAX_QDEVICE_NAME_LEN];
|
||||
#endif
|
||||
|
||||
static uint8_t two_node = 0;
|
||||
@ -136,7 +136,7 @@ static int votequorum_exec_send_reconfigure(uint8_t param, unsigned int nodeid,
|
||||
*/
|
||||
|
||||
#define NODE_FLAGS_BEENDOWN 1
|
||||
#define NODE_FLAGS_QDISK 8
|
||||
#define NODE_FLAGS_QDEVICE 8
|
||||
#define NODE_FLAGS_REMOVED 16
|
||||
#define NODE_FLAGS_US 32
|
||||
|
||||
@ -266,16 +266,16 @@ static void message_handler_req_lib_votequorum_trackstop (void *conn,
|
||||
const void *message);
|
||||
|
||||
#ifdef EXPERIMENTAL_QUORUM_DEVICE_API
|
||||
static void message_handler_req_lib_votequorum_qdisk_register (void *conn,
|
||||
static void message_handler_req_lib_votequorum_qdevice_register (void *conn,
|
||||
const void *message);
|
||||
|
||||
static void message_handler_req_lib_votequorum_qdisk_unregister (void *conn,
|
||||
static void message_handler_req_lib_votequorum_qdevice_unregister (void *conn,
|
||||
const void *message);
|
||||
|
||||
static void message_handler_req_lib_votequorum_qdisk_poll (void *conn,
|
||||
static void message_handler_req_lib_votequorum_qdevice_poll (void *conn,
|
||||
const void *message);
|
||||
|
||||
static void message_handler_req_lib_votequorum_qdisk_getinfo (void *conn,
|
||||
static void message_handler_req_lib_votequorum_qdevice_getinfo (void *conn,
|
||||
const void *message);
|
||||
#endif
|
||||
|
||||
@ -303,19 +303,19 @@ static struct corosync_lib_handler quorum_lib_service[] =
|
||||
#ifdef EXPERIMENTAL_QUORUM_DEVICE_API
|
||||
},
|
||||
{ /* 5 */
|
||||
.lib_handler_fn = message_handler_req_lib_votequorum_qdisk_register,
|
||||
.lib_handler_fn = message_handler_req_lib_votequorum_qdevice_register,
|
||||
.flow_control = COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED
|
||||
},
|
||||
{ /* 6 */
|
||||
.lib_handler_fn = message_handler_req_lib_votequorum_qdisk_unregister,
|
||||
.lib_handler_fn = message_handler_req_lib_votequorum_qdevice_unregister,
|
||||
.flow_control = COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED
|
||||
},
|
||||
{ /* 7 */
|
||||
.lib_handler_fn = message_handler_req_lib_votequorum_qdisk_poll,
|
||||
.lib_handler_fn = message_handler_req_lib_votequorum_qdevice_poll,
|
||||
.flow_control = COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED
|
||||
},
|
||||
{ /* 8 */
|
||||
.lib_handler_fn = message_handler_req_lib_votequorum_qdisk_getinfo,
|
||||
.lib_handler_fn = message_handler_req_lib_votequorum_qdevice_getinfo,
|
||||
.flow_control = COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED
|
||||
#endif
|
||||
}
|
||||
@ -1575,10 +1575,10 @@ static void message_handler_req_lib_votequorum_trackstop (void *conn,
|
||||
}
|
||||
|
||||
#ifdef EXPERIMENTAL_QUORUM_DEVICE_API
|
||||
static void message_handler_req_lib_votequorum_qdisk_register (void *conn,
|
||||
static void message_handler_req_lib_votequorum_qdevice_register (void *conn,
|
||||
const void *message)
|
||||
{
|
||||
const struct req_lib_votequorum_qdisk_register *req_lib_votequorum_qdisk_register = message;
|
||||
const struct req_lib_votequorum_qdevice_register *req_lib_votequorum_qdevice_register = message;
|
||||
struct res_lib_votequorum_status res_lib_votequorum_status;
|
||||
cs_error_t error = CS_OK;
|
||||
|
||||
@ -1589,8 +1589,8 @@ static void message_handler_req_lib_votequorum_qdisk_register (void *conn,
|
||||
} else {
|
||||
quorum_device = allocate_node(0);
|
||||
quorum_device->state = NODESTATE_DEAD;
|
||||
quorum_device->votes = req_lib_votequorum_qdisk_register->votes;
|
||||
strcpy(quorum_device_name, req_lib_votequorum_qdisk_register->name);
|
||||
quorum_device->votes = req_lib_votequorum_qdevice_register->votes;
|
||||
strcpy(quorum_device_name, req_lib_votequorum_qdevice_register->name);
|
||||
list_add(&quorum_device->list, &cluster_members_list);
|
||||
}
|
||||
|
||||
@ -1602,7 +1602,7 @@ static void message_handler_req_lib_votequorum_qdisk_register (void *conn,
|
||||
LEAVE();
|
||||
}
|
||||
|
||||
static void message_handler_req_lib_votequorum_qdisk_unregister (void *conn,
|
||||
static void message_handler_req_lib_votequorum_qdevice_unregister (void *conn,
|
||||
const void *message)
|
||||
{
|
||||
struct res_lib_votequorum_status res_lib_votequorum_status;
|
||||
@ -1629,17 +1629,17 @@ static void message_handler_req_lib_votequorum_qdisk_unregister (void *conn,
|
||||
LEAVE();
|
||||
}
|
||||
|
||||
static void message_handler_req_lib_votequorum_qdisk_poll (void *conn,
|
||||
static void message_handler_req_lib_votequorum_qdevice_poll (void *conn,
|
||||
const void *message)
|
||||
{
|
||||
const struct req_lib_votequorum_qdisk_poll *req_lib_votequorum_qdisk_poll = message;
|
||||
const struct req_lib_votequorum_qdevice_poll *req_lib_votequorum_qdevice_poll = message;
|
||||
struct res_lib_votequorum_status res_lib_votequorum_status;
|
||||
cs_error_t error = CS_OK;
|
||||
|
||||
ENTER();
|
||||
|
||||
if (quorum_device) {
|
||||
if (req_lib_votequorum_qdisk_poll->state) {
|
||||
if (req_lib_votequorum_qdevice_poll->state) {
|
||||
quorum_device->last_hello = qb_util_nano_current_get ();
|
||||
if (quorum_device->state == NODESTATE_DEAD) {
|
||||
quorum_device->state = NODESTATE_MEMBER;
|
||||
@ -1670,31 +1670,31 @@ static void message_handler_req_lib_votequorum_qdisk_poll (void *conn,
|
||||
LEAVE();
|
||||
}
|
||||
|
||||
static void message_handler_req_lib_votequorum_qdisk_getinfo (void *conn,
|
||||
static void message_handler_req_lib_votequorum_qdevice_getinfo (void *conn,
|
||||
const void *message)
|
||||
{
|
||||
struct res_lib_votequorum_qdisk_getinfo res_lib_votequorum_qdisk_getinfo;
|
||||
struct res_lib_votequorum_qdevice_getinfo res_lib_votequorum_qdevice_getinfo;
|
||||
cs_error_t error = CS_OK;
|
||||
|
||||
ENTER();
|
||||
|
||||
if (quorum_device) {
|
||||
log_printf(LOGSYS_LEVEL_DEBUG, "got qdisk_getinfo state %d", quorum_device->state);
|
||||
res_lib_votequorum_qdisk_getinfo.votes = quorum_device->votes;
|
||||
log_printf(LOGSYS_LEVEL_DEBUG, "got qdevice_getinfo state %d", quorum_device->state);
|
||||
res_lib_votequorum_qdevice_getinfo.votes = quorum_device->votes;
|
||||
if (quorum_device->state == NODESTATE_MEMBER) {
|
||||
res_lib_votequorum_qdisk_getinfo.state = 1;
|
||||
res_lib_votequorum_qdevice_getinfo.state = 1;
|
||||
} else {
|
||||
res_lib_votequorum_qdisk_getinfo.state = 0;
|
||||
res_lib_votequorum_qdevice_getinfo.state = 0;
|
||||
}
|
||||
strcpy(res_lib_votequorum_qdisk_getinfo.name, quorum_device_name);
|
||||
strcpy(res_lib_votequorum_qdevice_getinfo.name, quorum_device_name);
|
||||
} else {
|
||||
error = CS_ERR_NOT_EXIST;
|
||||
}
|
||||
|
||||
res_lib_votequorum_qdisk_getinfo.header.size = sizeof(res_lib_votequorum_qdisk_getinfo);
|
||||
res_lib_votequorum_qdisk_getinfo.header.id = MESSAGE_RES_VOTEQUORUM_GETINFO;
|
||||
res_lib_votequorum_qdisk_getinfo.header.error = error;
|
||||
corosync_api->ipc_response_send(conn, &res_lib_votequorum_qdisk_getinfo, sizeof(res_lib_votequorum_qdisk_getinfo));
|
||||
res_lib_votequorum_qdevice_getinfo.header.size = sizeof(res_lib_votequorum_qdevice_getinfo);
|
||||
res_lib_votequorum_qdevice_getinfo.header.id = MESSAGE_RES_VOTEQUORUM_GETINFO;
|
||||
res_lib_votequorum_qdevice_getinfo.header.error = error;
|
||||
corosync_api->ipc_response_send(conn, &res_lib_votequorum_qdevice_getinfo, sizeof(res_lib_votequorum_qdevice_getinfo));
|
||||
|
||||
LEAVE();
|
||||
}
|
||||
|
@ -36,7 +36,7 @@
|
||||
#define IPC_VOTEQUORUM_H_DEFINED
|
||||
|
||||
#include <corosync/mar_gen.h>
|
||||
#define VOTEQUORUM_MAX_QDISK_NAME_LEN 255
|
||||
#define VOTEQUORUM_MAX_QDEVICE_NAME_LEN 255
|
||||
|
||||
enum req_votequorum_types {
|
||||
MESSAGE_REQ_VOTEQUORUM_GETINFO = 0,
|
||||
@ -46,17 +46,17 @@ enum req_votequorum_types {
|
||||
MESSAGE_REQ_VOTEQUORUM_TRACKSTOP
|
||||
#ifdef EXPERIMENTAL_QUORUM_DEVICE_API
|
||||
,
|
||||
MESSAGE_REQ_VOTEQUORUM_QDISK_REGISTER,
|
||||
MESSAGE_REQ_VOTEQUORUM_QDISK_UNREGISTER,
|
||||
MESSAGE_REQ_VOTEQUORUM_QDISK_POLL,
|
||||
MESSAGE_REQ_VOTEQUORUM_QDISK_GETINFO
|
||||
MESSAGE_REQ_VOTEQUORUM_QDEVICE_REGISTER,
|
||||
MESSAGE_REQ_VOTEQUORUM_QDEVICE_UNREGISTER,
|
||||
MESSAGE_REQ_VOTEQUORUM_QDEVICE_POLL,
|
||||
MESSAGE_REQ_VOTEQUORUM_QDEVICE_GETINFO
|
||||
#endif
|
||||
};
|
||||
|
||||
enum res_votequorum_types {
|
||||
MESSAGE_RES_VOTEQUORUM_STATUS = 0,
|
||||
MESSAGE_RES_VOTEQUORUM_GETINFO,
|
||||
MESSAGE_RES_VOTEQUORUM_QDISK_GETINFO,
|
||||
MESSAGE_RES_VOTEQUORUM_QDEVICE_GETINFO,
|
||||
MESSAGE_RES_VOTEQUORUM_TRACKSTART,
|
||||
MESSAGE_RES_VOTEQUORUM_NOTIFICATION,
|
||||
MESSAGE_RES_VOTEQUORUM_EXPECTEDVOTES_NOTIFICATION
|
||||
@ -68,13 +68,13 @@ struct req_lib_votequorum_setvotes {
|
||||
int nodeid;
|
||||
};
|
||||
|
||||
struct req_lib_votequorum_qdisk_register {
|
||||
struct req_lib_votequorum_qdevice_register {
|
||||
struct qb_ipc_request_header header __attribute__((aligned(8)));
|
||||
unsigned int votes;
|
||||
char name[VOTEQUORUM_MAX_QDISK_NAME_LEN];
|
||||
char name[VOTEQUORUM_MAX_QDEVICE_NAME_LEN];
|
||||
};
|
||||
|
||||
struct req_lib_votequorum_qdisk_poll {
|
||||
struct req_lib_votequorum_qdevice_poll {
|
||||
struct qb_ipc_request_header header __attribute__((aligned(8)));
|
||||
int state;
|
||||
};
|
||||
@ -120,11 +120,11 @@ struct res_lib_votequorum_getinfo {
|
||||
unsigned int flags;
|
||||
};
|
||||
|
||||
struct res_lib_votequorum_qdisk_getinfo {
|
||||
struct res_lib_votequorum_qdevice_getinfo {
|
||||
struct qb_ipc_response_header header __attribute__((aligned(8)));
|
||||
unsigned int votes;
|
||||
unsigned int state;
|
||||
char name[VOTEQUORUM_MAX_QDISK_NAME_LEN];
|
||||
char name[VOTEQUORUM_MAX_QDEVICE_NAME_LEN];
|
||||
};
|
||||
|
||||
struct votequorum_node {
|
||||
|
@ -43,7 +43,7 @@ extern "C" {
|
||||
typedef uint64_t votequorum_handle_t;
|
||||
|
||||
#ifdef EXPERIMENTAL_QUORUM_DEVICE_API
|
||||
#define VOTEQUORUM_MAX_QDISK_NAME_LEN 255
|
||||
#define VOTEQUORUM_MAX_QDEVICE_NAME_LEN 255
|
||||
#endif
|
||||
|
||||
#define VOTEQUORUM_INFO_FLAG_TWONODE 1
|
||||
@ -72,10 +72,10 @@ struct votequorum_info {
|
||||
};
|
||||
|
||||
#ifdef EXPERIMENTAL_QUORUM_DEVICE_API
|
||||
struct votequorum_qdisk_info {
|
||||
struct votequorum_qdevice_info {
|
||||
unsigned int votes;
|
||||
unsigned int state;
|
||||
char name[VOTEQUORUM_MAX_QDISK_NAME_LEN];
|
||||
char name[VOTEQUORUM_MAX_QDEVICE_NAME_LEN];
|
||||
};
|
||||
#endif
|
||||
|
||||
@ -184,7 +184,7 @@ cs_error_t votequorum_context_set (
|
||||
*
|
||||
* it will be DEAD until polled
|
||||
*/
|
||||
cs_error_t votequorum_qdisk_register (
|
||||
cs_error_t votequorum_qdevice_register (
|
||||
votequorum_handle_t handle,
|
||||
const char *name,
|
||||
unsigned int votes);
|
||||
@ -192,22 +192,22 @@ cs_error_t votequorum_qdisk_register (
|
||||
/**
|
||||
* Unregister a quorum device
|
||||
*/
|
||||
cs_error_t votequorum_qdisk_unregister (
|
||||
cs_error_t votequorum_qdevice_unregister (
|
||||
votequorum_handle_t handle);
|
||||
|
||||
/**
|
||||
* Poll a quorum device
|
||||
*/
|
||||
cs_error_t votequorum_qdisk_poll (
|
||||
cs_error_t votequorum_qdevice_poll (
|
||||
votequorum_handle_t handle,
|
||||
unsigned int state);
|
||||
|
||||
/**
|
||||
* Get quorum device information
|
||||
*/
|
||||
cs_error_t votequorum_qdisk_getinfo (
|
||||
cs_error_t votequorum_qdevice_getinfo (
|
||||
votequorum_handle_t handle,
|
||||
struct votequorum_qdisk_info *info);
|
||||
struct votequorum_qdevice_info *info);
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -7,10 +7,10 @@ COROSYNC_VOTEQUORUM_1.0 {
|
||||
votequorum_getinfo;
|
||||
votequorum_setexpected;
|
||||
votequorum_setvotes;
|
||||
votequorum_qdisk_register;
|
||||
votequorum_qdisk_unregister;
|
||||
votequorum_qdisk_poll;
|
||||
votequorum_qdisk_getinfo;
|
||||
votequorum_qdevice_register;
|
||||
votequorum_qdevice_unregister;
|
||||
votequorum_qdevice_poll;
|
||||
votequorum_qdevice_getinfo;
|
||||
votequorum_trackstart;
|
||||
votequorum_trackstop;
|
||||
votequorum_context_get;
|
||||
|
@ -530,7 +530,7 @@ error_put:
|
||||
}
|
||||
|
||||
#ifdef EXPERIMENTAL_QUORUM_DEVICE_API
|
||||
cs_error_t votequorum_qdisk_register (
|
||||
cs_error_t votequorum_qdevice_register (
|
||||
votequorum_handle_t handle,
|
||||
const char *name,
|
||||
unsigned int votes)
|
||||
@ -538,10 +538,10 @@ cs_error_t votequorum_qdisk_register (
|
||||
cs_error_t error;
|
||||
struct votequorum_inst *votequorum_inst;
|
||||
struct iovec iov;
|
||||
struct req_lib_votequorum_qdisk_register req_lib_votequorum_qdisk_register;
|
||||
struct req_lib_votequorum_qdevice_register req_lib_votequorum_qdevice_register;
|
||||
struct res_lib_votequorum_status res_lib_votequorum_status;
|
||||
|
||||
if (strlen(name) > VOTEQUORUM_MAX_QDISK_NAME_LEN)
|
||||
if (strlen(name) > VOTEQUORUM_MAX_QDEVICE_NAME_LEN)
|
||||
return CS_ERR_INVALID_PARAM;
|
||||
|
||||
error = hdb_error_to_cs(hdb_handle_get (&votequorum_handle_t_db, handle, (void *)&votequorum_inst));
|
||||
@ -550,13 +550,13 @@ cs_error_t votequorum_qdisk_register (
|
||||
}
|
||||
|
||||
|
||||
req_lib_votequorum_qdisk_register.header.size = sizeof (struct req_lib_votequorum_qdisk_register);
|
||||
req_lib_votequorum_qdisk_register.header.id = MESSAGE_REQ_VOTEQUORUM_QDISK_REGISTER;
|
||||
strcpy(req_lib_votequorum_qdisk_register.name, name);
|
||||
req_lib_votequorum_qdisk_register.votes = votes;
|
||||
req_lib_votequorum_qdevice_register.header.size = sizeof (struct req_lib_votequorum_qdevice_register);
|
||||
req_lib_votequorum_qdevice_register.header.id = MESSAGE_REQ_VOTEQUORUM_QDEVICE_REGISTER;
|
||||
strcpy(req_lib_votequorum_qdevice_register.name, name);
|
||||
req_lib_votequorum_qdevice_register.votes = votes;
|
||||
|
||||
iov.iov_base = (char *)&req_lib_votequorum_qdisk_register;
|
||||
iov.iov_len = sizeof (struct req_lib_votequorum_qdisk_register);
|
||||
iov.iov_base = (char *)&req_lib_votequorum_qdevice_register;
|
||||
iov.iov_len = sizeof (struct req_lib_votequorum_qdevice_register);
|
||||
|
||||
error = qb_to_cs_error(qb_ipcc_sendv_recv (
|
||||
votequorum_inst->c,
|
||||
@ -577,14 +577,14 @@ error_exit:
|
||||
return (error);
|
||||
}
|
||||
|
||||
cs_error_t votequorum_qdisk_poll (
|
||||
cs_error_t votequorum_qdevice_poll (
|
||||
votequorum_handle_t handle,
|
||||
unsigned int state)
|
||||
{
|
||||
cs_error_t error;
|
||||
struct votequorum_inst *votequorum_inst;
|
||||
struct iovec iov;
|
||||
struct req_lib_votequorum_qdisk_poll req_lib_votequorum_qdisk_poll;
|
||||
struct req_lib_votequorum_qdevice_poll req_lib_votequorum_qdevice_poll;
|
||||
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));
|
||||
@ -593,12 +593,12 @@ cs_error_t votequorum_qdisk_poll (
|
||||
}
|
||||
|
||||
|
||||
req_lib_votequorum_qdisk_poll.header.size = sizeof (struct req_lib_votequorum_qdisk_poll);
|
||||
req_lib_votequorum_qdisk_poll.header.id = MESSAGE_REQ_VOTEQUORUM_QDISK_POLL;
|
||||
req_lib_votequorum_qdisk_poll.state = state;
|
||||
req_lib_votequorum_qdevice_poll.header.size = sizeof (struct req_lib_votequorum_qdevice_poll);
|
||||
req_lib_votequorum_qdevice_poll.header.id = MESSAGE_REQ_VOTEQUORUM_QDEVICE_POLL;
|
||||
req_lib_votequorum_qdevice_poll.state = state;
|
||||
|
||||
iov.iov_base = (char *)&req_lib_votequorum_qdisk_poll;
|
||||
iov.iov_len = sizeof (struct req_lib_votequorum_qdisk_poll);
|
||||
iov.iov_base = (char *)&req_lib_votequorum_qdevice_poll;
|
||||
iov.iov_len = sizeof (struct req_lib_votequorum_qdevice_poll);
|
||||
|
||||
error = qb_to_cs_error(qb_ipcc_sendv_recv (
|
||||
votequorum_inst->c,
|
||||
@ -619,7 +619,7 @@ error_exit:
|
||||
return (error);
|
||||
}
|
||||
|
||||
cs_error_t votequorum_qdisk_unregister (
|
||||
cs_error_t votequorum_qdevice_unregister (
|
||||
votequorum_handle_t handle)
|
||||
{
|
||||
cs_error_t error;
|
||||
@ -634,7 +634,7 @@ cs_error_t votequorum_qdisk_unregister (
|
||||
}
|
||||
|
||||
req_lib_votequorum_general.header.size = sizeof (struct req_lib_votequorum_general);
|
||||
req_lib_votequorum_general.header.id = MESSAGE_REQ_VOTEQUORUM_QDISK_UNREGISTER;
|
||||
req_lib_votequorum_general.header.id = MESSAGE_REQ_VOTEQUORUM_QDEVICE_UNREGISTER;
|
||||
|
||||
iov.iov_base = (char *)&req_lib_votequorum_general;
|
||||
iov.iov_len = sizeof (struct req_lib_votequorum_general);
|
||||
@ -658,15 +658,15 @@ error_exit:
|
||||
return (error);
|
||||
}
|
||||
|
||||
cs_error_t votequorum_qdisk_getinfo (
|
||||
cs_error_t votequorum_qdevice_getinfo (
|
||||
votequorum_handle_t handle,
|
||||
struct votequorum_qdisk_info *qinfo)
|
||||
struct votequorum_qdevice_info *qinfo)
|
||||
{
|
||||
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_qdisk_getinfo res_lib_votequorum_qdisk_getinfo;
|
||||
struct res_lib_votequorum_qdevice_getinfo res_lib_votequorum_qdevice_getinfo;
|
||||
|
||||
error = hdb_error_to_cs(hdb_handle_get (&votequorum_handle_t_db, handle, (void *)&votequorum_inst));
|
||||
if (error != CS_OK) {
|
||||
@ -675,7 +675,7 @@ cs_error_t votequorum_qdisk_getinfo (
|
||||
|
||||
|
||||
req_lib_votequorum_general.header.size = sizeof (struct req_lib_votequorum_general);
|
||||
req_lib_votequorum_general.header.id = MESSAGE_REQ_VOTEQUORUM_QDISK_GETINFO;
|
||||
req_lib_votequorum_general.header.id = MESSAGE_REQ_VOTEQUORUM_QDEVICE_GETINFO;
|
||||
|
||||
iov.iov_base = (char *)&req_lib_votequorum_general;
|
||||
iov.iov_len = sizeof (struct req_lib_votequorum_general);
|
||||
@ -684,18 +684,18 @@ cs_error_t votequorum_qdisk_getinfo (
|
||||
votequorum_inst->c,
|
||||
&iov,
|
||||
1,
|
||||
&res_lib_votequorum_qdisk_getinfo,
|
||||
sizeof (struct res_lib_votequorum_qdisk_getinfo), CS_IPC_TIMEOUT_MS));
|
||||
&res_lib_votequorum_qdevice_getinfo,
|
||||
sizeof (struct res_lib_votequorum_qdevice_getinfo), CS_IPC_TIMEOUT_MS));
|
||||
|
||||
if (error != CS_OK) {
|
||||
goto error_exit;
|
||||
}
|
||||
|
||||
error = res_lib_votequorum_qdisk_getinfo.header.error;
|
||||
error = res_lib_votequorum_qdevice_getinfo.header.error;
|
||||
|
||||
qinfo->votes = res_lib_votequorum_qdisk_getinfo.votes;
|
||||
qinfo->state = res_lib_votequorum_qdisk_getinfo.state;
|
||||
strcpy(qinfo->name, res_lib_votequorum_qdisk_getinfo.name);
|
||||
qinfo->votes = res_lib_votequorum_qdevice_getinfo.votes;
|
||||
qinfo->state = res_lib_votequorum_qdevice_getinfo.state;
|
||||
strcpy(qinfo->name, res_lib_votequorum_qdevice_getinfo.name);
|
||||
|
||||
|
||||
error_exit:
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Copyright (c) 2004 MontaVista Software, Inc.
|
||||
# Copyright (c) 2009 Red Hat, Inc.
|
||||
# Copyright (c) 2009, 2012 Red Hat, Inc.
|
||||
#
|
||||
# Authors: Steven Dake (sdake@redhat.com)
|
||||
# Fabio M. Di Nitto (fdinitto@redhat.com)
|
||||
@ -93,10 +93,10 @@ dist_man_MANS = \
|
||||
votequorum_finalize.3 \
|
||||
votequorum_getinfo.3 \
|
||||
votequorum_initialize.3 \
|
||||
votequorum_qdisk_getinfo.3 \
|
||||
votequorum_qdisk_poll.3 \
|
||||
votequorum_qdisk_register.3 \
|
||||
votequorum_qdisk_unregister.3 \
|
||||
votequorum_qdevice_getinfo.3 \
|
||||
votequorum_qdevice_poll.3 \
|
||||
votequorum_qdevice_register.3 \
|
||||
votequorum_qdevice_unregister.3 \
|
||||
votequorum_setexpected.3 \
|
||||
votequorum_setvotes.3 \
|
||||
sam_data_getsize.3 \
|
||||
|
@ -287,21 +287,23 @@
|
||||
Description of the votequorum interface.
|
||||
<br>
|
||||
|
||||
<a href="votequorum_qdisk_register.3.html">
|
||||
votequorum_qdisk_register(3)</a>:
|
||||
<a href="votequorum_qdevice_register.3.html">
|
||||
votequorum_qdevice_register(3)</a>:
|
||||
Description of the votequorum interface.
|
||||
<br>
|
||||
|
||||
<a href="votequorum_qdisk_unregister.3.html">
|
||||
votequorum_qdisk_unregister(3)</a>:
|
||||
<a href="votequorum_qdevice_unregister.3.html">
|
||||
votequorum_qdevice_unregister(3)</a>:
|
||||
Description of the votequorum interface.
|
||||
<br>
|
||||
|
||||
<a href="votequorum_qdisk_poll.3.html">votequorum_qdisk_poll(3)</a>:
|
||||
<a href="votequorum_qdevice_poll.3.html">
|
||||
votequorum_qdevice_poll(3)</a>:
|
||||
Description of the votequorum interface.
|
||||
<br>
|
||||
|
||||
<a href="votequorum_qdisk_getinfo.3.html">votequorum_qdisk_getinfo(3)</a>:
|
||||
<a href="votequorum_qdevice_getinfo.3.html">
|
||||
votequorum_qdevice_getinfo(3)</a>:
|
||||
Description of the votequorum interface.
|
||||
<br>
|
||||
|
||||
|
@ -68,10 +68,10 @@ No known bugs at the time of writing. The authors are from outerspace. Deal with
|
||||
.BR votequorum_finalize (3),
|
||||
.BR votequorum_getinfo (3),
|
||||
.BR votequorum_initialize (3),
|
||||
.BR votequorum_qdisk_getinfo (3),
|
||||
.BR votequorum_qdisk_poll (3),
|
||||
.BR votequorum_qdisk_register (3),
|
||||
.BR votequorum_qdisk_unregister (3),
|
||||
.BR votequorum_qdevice_getinfo (3),
|
||||
.BR votequorum_qdevice_poll (3),
|
||||
.BR votequorum_qdevice_register (3),
|
||||
.BR votequorum_qdevice_unregister (3),
|
||||
.BR votequorum_setexpected (3),
|
||||
.BR votequorum_setvotes (3)
|
||||
.PP
|
||||
|
@ -1,5 +1,5 @@
|
||||
.\"/*
|
||||
.\" * Copyright (c) 2009 Red Hat, Inc.
|
||||
.\" * Copyright (c) 2009,2012 Red Hat, Inc.
|
||||
.\" *
|
||||
.\" * All rights reserved.
|
||||
.\" *
|
||||
@ -31,16 +31,16 @@
|
||||
.\" * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
||||
.\" * THE POSSIBILITY OF SUCH DAMAGE.
|
||||
.\" */
|
||||
.TH VOTEQUORUM_QDISK_GETINFO 3 2009-01-26 "corosync Man Page" "Corosync Cluster Engine Programmer's Manual"
|
||||
.TH VOTEQUORUM_QDEVICE_GETINFO 3 2012-01-27 "corosync Man Page" "Corosync Cluster Engine Programmer's Manual"
|
||||
.SH NAME
|
||||
votequorum_qdisk_getinfo \- Get details of the quorum device
|
||||
votequorum_qdevice_getinfo \- Get details of the quorum device
|
||||
.SH SYNOPSIS
|
||||
.B #include <corosync/votequorum.h>
|
||||
.sp
|
||||
.BI "int votequorum_qdisk_getinfo(votequorum_handle_t " handle ", struct votequorum_qdisk_info " *info ");"
|
||||
.BI "int votequorum_qdevice_getinfo(votequorum_handle_t " handle ", struct votequorum_qdevice_info " *info ");"
|
||||
.SH DESCRIPTION
|
||||
The
|
||||
.B votequorum_qdisk_getinfo
|
||||
.B votequorum_qdevice_getinfo
|
||||
Returns information about the quorum device in the following structure:
|
||||
.PP
|
||||
.PP
|
||||
@ -50,10 +50,10 @@ Returns information about the quorum device in the following structure:
|
||||
.nf
|
||||
.ta 4n 20n 32n
|
||||
|
||||
struct votequorum_qdisk_info {
|
||||
struct votequorum_qdevice_info {
|
||||
unsigned int votes;
|
||||
unsigned int state;
|
||||
char name[VOTEQUORUM_MAX_QDISK_NAME_LEN];
|
||||
char name[VOTEQUORUM_MAX_QDEVICE_NAME_LEN];
|
||||
};
|
||||
|
||||
.ta
|
||||
@ -74,7 +74,7 @@ The errors are undocumented.
|
||||
.BR votequorum_finalize (3),
|
||||
.BR votequorum_dispatch (3),
|
||||
.BR votequorum_fd_get (3),
|
||||
.BR votequorum_qdisk_poll (3),
|
||||
.BR votequorum_qdisk_unregister (3),
|
||||
.BR votequorum_qdisk_getinfo (3),
|
||||
.BR votequorum_qdevice_poll (3),
|
||||
.BR votequorum_qdevice_unregister (3),
|
||||
.BR votequorum_qdevice_getinfo (3),
|
||||
.PP
|
@ -1,5 +1,5 @@
|
||||
.\"/*
|
||||
.\" * Copyright (c) 2009 Red Hat, Inc.
|
||||
.\" * Copyright (c) 2009,2012 Red Hat, Inc.
|
||||
.\" *
|
||||
.\" * All rights reserved.
|
||||
.\" *
|
||||
@ -31,23 +31,23 @@
|
||||
.\" * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
||||
.\" * THE POSSIBILITY OF SUCH DAMAGE.
|
||||
.\" */
|
||||
.TH VOTEQUORUM_QDISK_POLL 3 2009-01-26 "corosync Man Page" "Corosync Cluster Engine Programmer's Manual"
|
||||
.TH VOTEQUORUM_QDEVICE_POLL 3 2009-01-26 "corosync Man Page" "Corosync Cluster Engine Programmer's Manual"
|
||||
.SH NAME
|
||||
votequorum_qdisk_poll \- Tells votequorum the result of the quorum device poll
|
||||
votequorum_qdevice_poll \- Tells votequorum the result of the quorum device poll
|
||||
.SH SYNOPSIS
|
||||
.B #include <corosync/votequorum.h>
|
||||
.sp
|
||||
.BI "int votequorum_qdisk_poll(votequorum_handle_t " handle ", unsigned int " state ");"
|
||||
.BI "int votequorum_qdevice_poll(votequorum_handle_t " handle ", unsigned int " state ");"
|
||||
.SH DESCRIPTION
|
||||
The
|
||||
.B votequorum_qdisk_poll
|
||||
is called by the quorum device subsyetem (not provided as part of votequorum) to tell
|
||||
.B votequorum_qdevice_poll
|
||||
is called by the quorum device subsystem (not provided as part of votequorum) to tell
|
||||
the voting system if the qurum device is present/active or not. If
|
||||
.B state
|
||||
is 1 then the votes for the device are included in the quorum calculation, otherwise not.
|
||||
This routine should be called at regular intervals to ensure that the device status
|
||||
is always known to votequorum. If
|
||||
.B votequorum_qdisk_poll
|
||||
.B votequorum_qdevice_poll
|
||||
is not called after (default) 10 seconds then the device will be deeded to be dead and
|
||||
its votes removed from the cluster. This does not unregister the device.
|
||||
The default poll time can be changed by setting the object database variable
|
||||
@ -63,7 +63,7 @@ The errors are undocumented.
|
||||
.BR votequorum_finalize (3),
|
||||
.BR votequorum_dispatch (3),
|
||||
.BR votequorum_fd_get (3),
|
||||
.BR votequorum_qdisk_poll (3),
|
||||
.BR votequorum_qdisk_unregister (3),
|
||||
.BR votequorum_qdisk_getinfo (3),
|
||||
.BR votequorum_qdevice_register (3),
|
||||
.BR votequorum_qdevice_unregister (3),
|
||||
.BR votequorum_qdevice_getinfo (3),
|
||||
.PP
|
@ -1,5 +1,5 @@
|
||||
.\"/*
|
||||
.\" * Copyright (c) 2009 Red Hat, Inc.
|
||||
.\" * Copyright (c) 2009,2012 Red Hat, Inc.
|
||||
.\" *
|
||||
.\" * All rights reserved.
|
||||
.\" *
|
||||
@ -31,22 +31,22 @@
|
||||
.\" * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
||||
.\" * THE POSSIBILITY OF SUCH DAMAGE.
|
||||
.\" */
|
||||
.TH VOTEQUORUM_QDISK_REGISTER 3 2009-01-26 "corosync Man Page" "Corosync Cluster Engine Programmer's Manual"
|
||||
.TH VOTEQUORUM_QDEVICE_REGISTER 3 2009-01-26 "corosync Man Page" "Corosync Cluster Engine Programmer's Manual"
|
||||
.SH NAME
|
||||
votequorum_qdisk_register \- Registers a new quorum device
|
||||
votequorum_qdevice_register \- Registers a new quorum device
|
||||
.SH SYNOPSIS
|
||||
.B #include <corosync/votequorum.h>
|
||||
.sp
|
||||
.BI "int votequorum_qdisk_register(votequorum_handle_t " handle ", char * " name ", unsigned int " votes ");"
|
||||
.BI "int votequorum_qdevice_register(votequorum_handle_t " handle ", char * " name ", unsigned int " votes ");"
|
||||
.SH DESCRIPTION
|
||||
The
|
||||
.B votequorum_qdisk_register
|
||||
.B votequorum_qdevice_register
|
||||
is used to register a new quorum device. A quorum device is an external way of adding votes to a small
|
||||
cluster. The quorum device is, in effect, a pseudo node in the cluster that provide votes based on some
|
||||
external device, usually a shared disk partition or perhaps a network router.
|
||||
.br
|
||||
This call creates the device but does not mark it active.
|
||||
.B votequorum_qdisk_poll
|
||||
.B votequorum_qdevice_poll
|
||||
must be called for the votes to be included in the quorum calculation.
|
||||
.br
|
||||
Note that it is the responsibility of the quorum device subsystem (not provided as part of votequorum)
|
||||
@ -62,7 +62,7 @@ The errors are undocumented.
|
||||
.BR votequorum_finalize (3),
|
||||
.BR votequorum_dispatch (3),
|
||||
.BR votequorum_fd_get (3),
|
||||
.BR votequorum_qdisk_poll (3),
|
||||
.BR votequorum_qdisk_unregister (3),
|
||||
.BR votequorum_qdisk_getinfo (3),
|
||||
.BR votequorum_qdevice_poll (3),
|
||||
.BR votequorum_qdevice_unregister (3),
|
||||
.BR votequorum_qdevice_getinfo (3),
|
||||
.PP
|
@ -1,5 +1,5 @@
|
||||
.\"/*
|
||||
.\" * Copyright (c) 2009 Red Hat, Inc.
|
||||
.\" * Copyright (c) 2009,2012 Red Hat, Inc.
|
||||
.\" *
|
||||
.\" * All rights reserved.
|
||||
.\" *
|
||||
@ -31,16 +31,16 @@
|
||||
.\" * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
||||
.\" * THE POSSIBILITY OF SUCH DAMAGE.
|
||||
.\" */
|
||||
.TH VOTEQUORUM_QDISK_UNREGISTER 3 2009-01-26 "corosync Man Page" "Corosync Cluster Engine Programmer's Manual"
|
||||
.TH VOTEQUORUM_QDEVICE_UNREGISTER 3 2009-01-26 "corosync Man Page" "Corosync Cluster Engine Programmer's Manual"
|
||||
.SH NAME
|
||||
votequorum_qdisk_unregister \- Unregisters a new quorum device
|
||||
votequorum_qdevice_unregister \- Unregisters a new quorum device
|
||||
.SH SYNOPSIS
|
||||
.B #include <corosync/votequorum.h>
|
||||
.sp
|
||||
.BI "int votequorum_qdisk_unregister(votequorum_handle_t " handle ");"
|
||||
.BI "int votequorum_qdevice_unregister(votequorum_handle_t " handle ");"
|
||||
.SH DESCRIPTION
|
||||
The
|
||||
.B votequorum_qdisk_unregister
|
||||
.B votequorum_qdevice_unregister
|
||||
unregisters a quorum device. Any votes it had will be removed from the cluster. Not that this could
|
||||
make the cluster inquorate.
|
||||
.SH RETURN VALUE
|
||||
@ -54,7 +54,7 @@ The errors are undocumented.
|
||||
.BR votequorum_finalize (3),
|
||||
.BR votequorum_dispatch (3),
|
||||
.BR votequorum_fd_get (3),
|
||||
.BR votequorum_qdisk_poll (3),
|
||||
.BR votequorum_qdisk_unregister (3),
|
||||
.BR votequorum_qdisk_getinfo (3),
|
||||
.BR votequorum_qdevice_poll (3),
|
||||
.BR votequorum_qdevice_register (3),
|
||||
.BR votequorum_qdevice_getinfo (3),
|
||||
.PP
|
@ -47,13 +47,13 @@ static votequorum_handle_t handle;
|
||||
|
||||
static void print_info(int ok_to_fail)
|
||||
{
|
||||
struct votequorum_qdisk_info qinfo;
|
||||
struct votequorum_qdevice_info qinfo;
|
||||
int err;
|
||||
|
||||
if ( (err=votequorum_qdisk_getinfo(handle, &qinfo)) != CS_OK)
|
||||
fprintf(stderr, "votequorum_qdisk_getinfo error %d: %s\n", err, ok_to_fail?"OK":"FAILED");
|
||||
if ( (err=votequorum_qdevice_getinfo(handle, &qinfo)) != CS_OK)
|
||||
fprintf(stderr, "votequorum_qdevice_getinfo error %d: %s\n", err, ok_to_fail?"OK":"FAILED");
|
||||
else {
|
||||
printf("qdisk votes %d\n", qinfo.votes);
|
||||
printf("qdevice votes %d\n", qinfo.votes);
|
||||
printf("state %d\n", qinfo.state);
|
||||
printf("name %s\n", qinfo.name);
|
||||
printf("\n");
|
||||
@ -82,24 +82,24 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
if (argc >= 2) {
|
||||
if ( (err=votequorum_qdisk_register(handle, "QDISK", 4)) != CS_OK)
|
||||
fprintf(stderr, "qdisk_register FAILED: %d\n", err);
|
||||
if ( (err=votequorum_qdevice_register(handle, "QDEVICE", 4)) != CS_OK)
|
||||
fprintf(stderr, "qdevice_register FAILED: %d\n", err);
|
||||
|
||||
while (pollcount--) {
|
||||
print_info(0);
|
||||
if ((err=votequorum_qdisk_poll(handle, 1)) != CS_OK)
|
||||
fprintf(stderr, "qdisk poll FAILED: %d\n", err);
|
||||
if ((err=votequorum_qdevice_poll(handle, 1)) != CS_OK)
|
||||
fprintf(stderr, "qdevice poll FAILED: %d\n", err);
|
||||
print_info(0);
|
||||
sleep(polltime);
|
||||
}
|
||||
if ((err= votequorum_qdisk_unregister(handle)) != CS_OK)
|
||||
fprintf(stderr, "qdisk unregister FAILED: %d\n", err);
|
||||
if ((err= votequorum_qdevice_unregister(handle)) != CS_OK)
|
||||
fprintf(stderr, "qdevice unregister FAILED: %d\n", err);
|
||||
}
|
||||
print_info(1);
|
||||
|
||||
votequorum_finalize(handle);
|
||||
#else
|
||||
fprintf(stderr, "qdisk support is not built in corosync/votequorum\n");
|
||||
fprintf(stderr, "qdevice support is not built in corosync/votequorum\n");
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user