us->flags |= NODE_FLAGS_QDEVICE_ALIVE;
- if (req_lib_votequorum_qdevice_poll->state) {
+ if (req_lib_votequorum_qdevice_poll->cast_vote) {
us->flags |= NODE_FLAGS_QDEVICE_CAST_VOTE;
} else {
us->flags &= ~NODE_FLAGS_QDEVICE_CAST_VOTE;
nodeid, alive_status, vote_status);
res_lib_votequorum_qdevice_getinfo.votes = qdevice->votes;
res_lib_votequorum_qdevice_getinfo.alive = alive_status;
- res_lib_votequorum_qdevice_getinfo.vote = vote_status;
+ res_lib_votequorum_qdevice_getinfo.cast_vote = vote_status;
strcpy(res_lib_votequorum_qdevice_getinfo.name, qdevice_name);
} else {
error = CS_ERR_NOT_EXIST;
struct req_lib_votequorum_qdevice_poll {
struct qb_ipc_request_header header __attribute__((aligned(8)));
char name[VOTEQUORUM_MAX_QDEVICE_NAME_LEN];
- int state;
+ int cast_vote;
};
struct req_lib_votequorum_qdevice_getinfo {
struct qb_ipc_response_header header __attribute__((aligned(8)));
unsigned int votes;
unsigned int alive;
- unsigned int vote;
+ unsigned int cast_vote;
char name[VOTEQUORUM_MAX_QDEVICE_NAME_LEN];
};
struct votequorum_qdevice_info {
unsigned int votes;
unsigned int alive;
- unsigned int vote;
+ unsigned int cast_vote;
char name[VOTEQUORUM_MAX_QDEVICE_NAME_LEN];
};
cs_error_t votequorum_qdevice_poll (
votequorum_handle_t handle,
const char *name,
- unsigned int state);
+ unsigned int cast_vote);
/**
* Get quorum device information
cs_error_t votequorum_qdevice_poll (
votequorum_handle_t handle,
const char *name,
- unsigned int state)
+ unsigned int cast_vote)
{
cs_error_t error;
struct votequorum_inst *votequorum_inst;
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;
strcpy(req_lib_votequorum_qdevice_poll.name, name);
- req_lib_votequorum_qdevice_poll.state = state;
+ req_lib_votequorum_qdevice_poll.cast_vote = cast_vote;
iov.iov_base = (char *)&req_lib_votequorum_qdevice_poll;
iov.iov_len = sizeof (struct req_lib_votequorum_qdevice_poll);
qinfo->votes = res_lib_votequorum_qdevice_getinfo.votes;
qinfo->alive = res_lib_votequorum_qdevice_getinfo.alive;
- qinfo->vote = res_lib_votequorum_qdevice_getinfo.vote;
+ qinfo->cast_vote = res_lib_votequorum_qdevice_getinfo.cast_vote;
strcpy(qinfo->name, res_lib_votequorum_qdevice_getinfo.name);
.SH SYNOPSIS
.B #include <corosync/votequorum.h>
.sp
-.BI "int votequorum_qdevice_poll(votequorum_handle_t " handle ", unsigned int " state ");"
+.BI "int votequorum_qdevice_poll(votequorum_handle_t " handle ", unsigned int " cast_vote ");"
.SH DESCRIPTION
The
.B votequorum_qdevice_poll
is called by the quorum device subsystem (not provided as part of votequorum) to tell
the voting system if the quorum device is present/active or not. If
-.B state
+.B cast_vote
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
fprintf(stderr, "votequorum_qdevice_getinfo error %d: %s\n", err, ok_to_fail?"OK":"FAILED");
else {
printf("qdevice votes %d\n", qinfo.votes);
- printf("alive %d\n", qinfo.alive);
- printf("vote %d\n", qinfo.vote);
- printf("name %s\n", qinfo.name);
+ printf("alive %d\n", qinfo.alive);
+ printf("cast vote %d\n", qinfo.cast_vote);
+ printf("name %s\n", qinfo.name);
printf("\n");
}
}
int main(int argc, char *argv[])
{
int ret = 0;
+ int cast_vote = 1;
int pollcount=0, polltime=1;
int err;
if (argc >= 3 && atoi(argv[2])) {
polltime = atoi(argv[2]);
}
+ if (argc >= 4) {
+ cast_vote = atoi(argv[3]);
+ }
if (argc >= 2) {
if ( (err=votequorum_qdevice_register(handle, "QDEVICE")) != CS_OK) {
while (pollcount--) {
print_info(0);
- if ((err=votequorum_qdevice_poll(handle, "QDEVICE", 1)) != CS_OK) {
+ if ((err=votequorum_qdevice_poll(handle, "QDEVICE", cast_vote)) != CS_OK) {
fprintf(stderr, "qdevice poll FAILED: %d\n", err);
ret = -1;
goto out;
printf("0x%08x ", VOTEQUORUM_NODEID_QDEVICE);
}
print_uint32_padded(qinfo.votes);
- printf("%s (%s/%s)\n", qinfo.name, qinfo.alive?"Alive":"Not alive", qinfo.vote?"Voting":"Not voting");
+ printf("%s (%s/%s)\n", qinfo.name,
+ qinfo.alive?"Alive":"Not alive",
+ qinfo.cast_vote?"Voting":"Not voting");
}
}
}