* Silly default to prevent accidents!
*/
#define DEFAULT_EXPECTED 1024
+
+#ifdef EXPERIMENTAL_QUORUM_DEVICE_API
#define DEFAULT_QDEV_POLL 10000
static unsigned int quorumdev_poll = DEFAULT_QDEV_POLL;
static char quorum_device_name[VOTEQUORUM_MAX_QDISK_NAME_LEN];
+#endif
static uint8_t two_node = 0;
* votequorum timers
*/
+#ifdef EXPERIMENTAL_QUORUM_DEVICE_API
static corosync_timer_handle_t quorum_device_timer;
+#endif
static corosync_timer_handle_t last_man_standing_timer;
static int last_man_standing_timer_set = 0;
static void message_handler_req_lib_votequorum_setvotes (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,
+ const void *message);
+
+#ifdef EXPERIMENTAL_QUORUM_DEVICE_API
static void message_handler_req_lib_votequorum_qdisk_register (void *conn,
const void *message);
static void message_handler_req_lib_votequorum_qdisk_getinfo (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,
- const void *message);
+#endif
static struct corosync_lib_handler quorum_lib_service[] =
{
.flow_control = COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED
},
{ /* 3 */
- .lib_handler_fn = message_handler_req_lib_votequorum_qdisk_register,
+ .lib_handler_fn = message_handler_req_lib_votequorum_trackstart,
.flow_control = COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED
},
{ /* 4 */
- .lib_handler_fn = message_handler_req_lib_votequorum_qdisk_unregister,
+ .lib_handler_fn = message_handler_req_lib_votequorum_trackstop,
.flow_control = COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED
+#ifdef EXPERIMENTAL_QUORUM_DEVICE_API
},
{ /* 5 */
- .lib_handler_fn = message_handler_req_lib_votequorum_qdisk_poll,
+ .lib_handler_fn = message_handler_req_lib_votequorum_qdisk_register,
.flow_control = COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED
},
{ /* 6 */
- .lib_handler_fn = message_handler_req_lib_votequorum_qdisk_getinfo,
+ .lib_handler_fn = message_handler_req_lib_votequorum_qdisk_unregister,
.flow_control = COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED
},
{ /* 7 */
- .lib_handler_fn = message_handler_req_lib_votequorum_trackstart,
+ .lib_handler_fn = message_handler_req_lib_votequorum_qdisk_poll,
.flow_control = COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED
},
{ /* 8 */
- .lib_handler_fn = message_handler_req_lib_votequorum_trackstop,
+ .lib_handler_fn = message_handler_req_lib_votequorum_qdisk_getinfo,
.flow_control = COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED
+#endif
}
};
us->votes = 1;
}
+#ifdef EXPERIMENTAL_QUORUM_DEVICE_API
if (icmap_get_uint32("quorum.quorumdev_poll", &quorumdev_poll) != CS_OK) {
quorumdev_poll = DEFAULT_QDEV_POLL;
}
+#endif
icmap_get_uint8("quorum.two_node", &two_node);
* library internal functions
*/
+#ifdef EXPERIMENTAL_QUORUM_DEVICE_API
static void quorum_device_timer_fn(void *arg)
{
ENTER();
LEAVE();
}
+#endif
/*
* Library Handler Functions
LEAVE();
}
+static void message_handler_req_lib_votequorum_trackstart (void *conn,
+ const void *message)
+{
+ const struct req_lib_votequorum_trackstart *req_lib_votequorum_trackstart = message;
+ struct res_lib_votequorum_status res_lib_votequorum_status;
+ struct quorum_pd *quorum_pd = (struct quorum_pd *)corosync_api->ipc_private_data_get (conn);
+
+ ENTER();
+ /*
+ * If an immediate listing of the current cluster membership
+ * is requested, generate membership list
+ */
+ if (req_lib_votequorum_trackstart->track_flags & CS_TRACK_CURRENT ||
+ req_lib_votequorum_trackstart->track_flags & CS_TRACK_CHANGES) {
+ log_printf(LOGSYS_LEVEL_DEBUG, "sending initial status to %p\n", conn);
+ votequorum_exec_send_quorum_notification(conn, req_lib_votequorum_trackstart->context);
+ }
+
+ /*
+ * Record requests for tracking
+ */
+ if (req_lib_votequorum_trackstart->track_flags & CS_TRACK_CHANGES ||
+ req_lib_votequorum_trackstart->track_flags & CS_TRACK_CHANGES_ONLY) {
+
+ quorum_pd->track_flags = req_lib_votequorum_trackstart->track_flags;
+ quorum_pd->tracking_enabled = 1;
+ quorum_pd->tracking_context = req_lib_votequorum_trackstart->context;
+
+ list_add (&quorum_pd->list, &trackers_list);
+ }
+
+ 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 = CS_OK;
+ corosync_api->ipc_response_send(conn, &res_lib_votequorum_status, sizeof(res_lib_votequorum_status));
+
+ LEAVE();
+}
+
+static void message_handler_req_lib_votequorum_trackstop (void *conn,
+ const void *message)
+{
+ struct res_lib_votequorum_status res_lib_votequorum_status;
+ struct quorum_pd *quorum_pd = (struct quorum_pd *)corosync_api->ipc_private_data_get (conn);
+ int error = CS_OK;
+
+ ENTER();
+
+ if (quorum_pd->tracking_enabled) {
+ error = CS_OK;
+ quorum_pd->tracking_enabled = 0;
+ list_del (&quorum_pd->list);
+ list_init (&quorum_pd->list);
+ } else {
+ error = CS_ERR_NOT_EXIST;
+ }
+
+ 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();
+}
+
+#ifdef EXPERIMENTAL_QUORUM_DEVICE_API
static void message_handler_req_lib_votequorum_qdisk_register (void *conn,
const void *message)
{
LEAVE();
}
-
-static void message_handler_req_lib_votequorum_trackstart (void *conn,
- const void *message)
-{
- const struct req_lib_votequorum_trackstart *req_lib_votequorum_trackstart = message;
- struct res_lib_votequorum_status res_lib_votequorum_status;
- struct quorum_pd *quorum_pd = (struct quorum_pd *)corosync_api->ipc_private_data_get (conn);
-
- ENTER();
- /*
- * If an immediate listing of the current cluster membership
- * is requested, generate membership list
- */
- if (req_lib_votequorum_trackstart->track_flags & CS_TRACK_CURRENT ||
- req_lib_votequorum_trackstart->track_flags & CS_TRACK_CHANGES) {
- log_printf(LOGSYS_LEVEL_DEBUG, "sending initial status to %p\n", conn);
- votequorum_exec_send_quorum_notification(conn, req_lib_votequorum_trackstart->context);
- }
-
- /*
- * Record requests for tracking
- */
- if (req_lib_votequorum_trackstart->track_flags & CS_TRACK_CHANGES ||
- req_lib_votequorum_trackstart->track_flags & CS_TRACK_CHANGES_ONLY) {
-
- quorum_pd->track_flags = req_lib_votequorum_trackstart->track_flags;
- quorum_pd->tracking_enabled = 1;
- quorum_pd->tracking_context = req_lib_votequorum_trackstart->context;
-
- list_add (&quorum_pd->list, &trackers_list);
- }
-
- 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 = CS_OK;
- corosync_api->ipc_response_send(conn, &res_lib_votequorum_status, sizeof(res_lib_votequorum_status));
-
- LEAVE();
-}
-
-static void message_handler_req_lib_votequorum_trackstop (void *conn,
- const void *message)
-{
- struct res_lib_votequorum_status res_lib_votequorum_status;
- struct quorum_pd *quorum_pd = (struct quorum_pd *)corosync_api->ipc_private_data_get (conn);
- int error = CS_OK;
-
- ENTER();
-
- if (quorum_pd->tracking_enabled) {
- error = CS_OK;
- quorum_pd->tracking_enabled = 0;
- list_del (&quorum_pd->list);
- list_init (&quorum_pd->list);
- } else {
- error = CS_ERR_NOT_EXIST;
- }
-
- 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();
-}
+#endif
MESSAGE_REQ_VOTEQUORUM_GETINFO = 0,
MESSAGE_REQ_VOTEQUORUM_SETEXPECTED,
MESSAGE_REQ_VOTEQUORUM_SETVOTES,
+ MESSAGE_REQ_VOTEQUORUM_TRACKSTART,
+ 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_TRACKSTART,
- MESSAGE_REQ_VOTEQUORUM_TRACKSTOP
+ MESSAGE_REQ_VOTEQUORUM_QDISK_GETINFO
+#endif
};
enum res_votequorum_types {
/*
- * Copyright (c) 2009-2011 Red Hat, Inc.
+ * Copyright (c) 2009-2012 Red Hat, Inc.
*
* All rights reserved.
*
typedef uint64_t votequorum_handle_t;
+#ifdef EXPERIMENTAL_QUORUM_DEVICE_API
#define VOTEQUORUM_MAX_QDISK_NAME_LEN 255
+#endif
#define VOTEQUORUM_INFO_FLAG_TWONODE 1
#define VOTEQUORUM_INFO_FLAG_QUORATE 2
unsigned int flags;
};
+#ifdef EXPERIMENTAL_QUORUM_DEVICE_API
struct votequorum_qdisk_info {
unsigned int votes;
unsigned int state;
char name[VOTEQUORUM_MAX_QDISK_NAME_LEN];
};
+#endif
typedef struct {
uint32_t nodeid;
unsigned int nodeid,
unsigned int votes);
+/**
+ * Track node and quorum changes
+ */
+cs_error_t votequorum_trackstart (
+ votequorum_handle_t handle,
+ uint64_t context,
+ unsigned int flags );
+
+cs_error_t votequorum_trackstop (
+ votequorum_handle_t handle);
+
+/**
+ * Save and retrieve private data/context
+ */
+cs_error_t votequorum_context_get (
+ votequorum_handle_t handle,
+ void **context);
+
+cs_error_t votequorum_context_set (
+ votequorum_handle_t handle,
+ void *context);
+
+#ifdef EXPERIMENTAL_QUORUM_DEVICE_API
/**
* Register a quorum device
*
votequorum_handle_t handle,
struct votequorum_qdisk_info *info);
-/**
- * Track node and quorum changes
- */
-cs_error_t votequorum_trackstart (
- votequorum_handle_t handle,
- uint64_t context,
- unsigned int flags );
-
-cs_error_t votequorum_trackstop (
- votequorum_handle_t handle);
-
-/**
- * Save and retrieve private data/context
- */
-cs_error_t votequorum_context_get (
- votequorum_handle_t handle,
- void **context);
-
-cs_error_t votequorum_context_set (
- votequorum_handle_t handle,
- void *context);
+#endif
#ifdef __cplusplus
}
return (error);
}
-cs_error_t votequorum_qdisk_register (
- votequorum_handle_t handle,
- const char *name,
- unsigned int votes)
-{
- cs_error_t error;
- struct votequorum_inst *votequorum_inst;
- struct iovec iov;
- struct req_lib_votequorum_qdisk_register req_lib_votequorum_qdisk_register;
- struct res_lib_votequorum_status res_lib_votequorum_status;
-
- if (strlen(name) > VOTEQUORUM_MAX_QDISK_NAME_LEN)
- return CS_ERR_INVALID_PARAM;
-
- 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_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;
-
- iov.iov_base = (char *)&req_lib_votequorum_qdisk_register;
- iov.iov_len = sizeof (struct req_lib_votequorum_qdisk_register);
-
- 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_qdisk_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 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_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;
-
- iov.iov_base = (char *)&req_lib_votequorum_qdisk_poll;
- iov.iov_len = sizeof (struct req_lib_votequorum_qdisk_poll);
-
- 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_qdisk_unregister (
- 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_QDISK_UNREGISTER;
-
- 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_qdisk_getinfo (
- votequorum_handle_t handle,
- struct votequorum_qdisk_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;
-
- 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_QDISK_GETINFO;
-
- 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_qdisk_getinfo,
- sizeof (struct res_lib_votequorum_qdisk_getinfo), CS_IPC_TIMEOUT_MS));
-
- if (error != CS_OK) {
- goto error_exit;
- }
-
- error = res_lib_votequorum_qdisk_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);
-
-
-error_exit:
- hdb_handle_put (&votequorum_handle_t_db, handle);
-
- return (error);
-}
-
cs_error_t votequorum_trackstart (
votequorum_handle_t handle,
uint64_t context,
hdb_handle_put (&votequorum_handle_t_db, handle);
return (error);
}
+
+#ifdef EXPERIMENTAL_QUORUM_DEVICE_API
+cs_error_t votequorum_qdisk_register (
+ votequorum_handle_t handle,
+ const char *name,
+ unsigned int votes)
+{
+ cs_error_t error;
+ struct votequorum_inst *votequorum_inst;
+ struct iovec iov;
+ struct req_lib_votequorum_qdisk_register req_lib_votequorum_qdisk_register;
+ struct res_lib_votequorum_status res_lib_votequorum_status;
+
+ if (strlen(name) > VOTEQUORUM_MAX_QDISK_NAME_LEN)
+ return CS_ERR_INVALID_PARAM;
+
+ 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_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;
+
+ iov.iov_base = (char *)&req_lib_votequorum_qdisk_register;
+ iov.iov_len = sizeof (struct req_lib_votequorum_qdisk_register);
+
+ 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_qdisk_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 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_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;
+
+ iov.iov_base = (char *)&req_lib_votequorum_qdisk_poll;
+ iov.iov_len = sizeof (struct req_lib_votequorum_qdisk_poll);
+
+ 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_qdisk_unregister (
+ 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_QDISK_UNREGISTER;
+
+ 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_qdisk_getinfo (
+ votequorum_handle_t handle,
+ struct votequorum_qdisk_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;
+
+ 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_QDISK_GETINFO;
+
+ 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_qdisk_getinfo,
+ sizeof (struct res_lib_votequorum_qdisk_getinfo), CS_IPC_TIMEOUT_MS));
+
+ if (error != CS_OK) {
+ goto error_exit;
+ }
+
+ error = res_lib_votequorum_qdisk_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);
+
+
+error_exit:
+ hdb_handle_put (&votequorum_handle_t_db, handle);
+
+ return (error);
+}
+#endif
+
#include <corosync/corotypes.h>
#include <corosync/votequorum.h>
+#ifdef EXPERIMENTAL_QUORUM_DEVICE_API
static votequorum_handle_t handle;
-
static void print_info(int ok_to_fail)
{
struct votequorum_qdisk_info qinfo;
printf("\n");
}
}
+#endif
int main(int argc, char *argv[])
{
+#ifdef EXPERIMENTAL_QUORUM_DEVICE_API
int pollcount=0, polltime=1;
int err;
}
print_info(1);
+ votequorum_finalize(handle);
+#else
+ fprintf(stderr, "qdisk support is not built in corosync/votequorum\n");
+#endif
return 0;
}