votequorum: Make display of qdevice more intuitive.

corosync-quorumtool displays the votes of the qdevice whether
or not it is active. This is confusing because if it is not active
then the display looks like there is a vote being contributed to
quorum when there is not.

This patch displays 0 for qdevice votes if the device is present
(but inactive) and adds the votes after the name. If the device is
contributing votes then they are displayed as normal.

Signed-off-by: Christine Caulfield <ccaulfie@redhat.com>
This commit is contained in:
Christine Caulfield 2015-09-08 13:41:37 +01:00 committed by Jan Friesse
parent 3a5cb94906
commit fc9817fec4
2 changed files with 19 additions and 4 deletions

View File

@ -100,7 +100,7 @@ static void usage(const char *command)
printf(" -p <num> Number of times to poll qdevice (default 0=infinte)\n");
printf(" -t <secs> Time (in seconds) to wait between polls (default=1)\n");
printf(" -n <name> Name of quorum device (default QDEVICE)\n");
printf(" -c Cast vote (default yes)\n");
printf(" -c Don't cast vote (default is to cast vote)\n");
printf(" -q Don't print device status every poll time (default=will print)\n");
printf(" -m Master wins (default no)\n");
printf(" -1 Print status once and exit\n");
@ -127,7 +127,7 @@ int main(int argc, char *argv[])
master_wins = 1;
break;
case 'c':
cast_vote = 1;
cast_vote = 0;
break;
case '1':
once = 1;

View File

@ -416,6 +416,7 @@ static int compare_nodenames(const void *one, const void *two)
static void display_nodes_data(nodeid_format_t nodeid_format, name_format_t name_format, sorttype_t sort_type)
{
int i, display_qdevice = 0;
unsigned int our_flags = 0;
struct votequorum_info info[g_view_list_entries];
/*
* cache node info because we need to parse them twice
@ -488,6 +489,7 @@ static void display_nodes_data(nodeid_format_t nodeid_format, name_format_t name
printf("%s", g_view_list[i].name);
if (g_view_list[i].node_id == our_nodeid) {
printf(" (local)");
our_flags = info[i].flags;
}
printf("\n");
}
@ -506,8 +508,21 @@ static void display_nodes_data(nodeid_format_t nodeid_format, name_format_t name
} else {
printf("0x%08x ", VOTEQUORUM_QDEVICE_NODEID);
}
print_uint32_padded(info[0].qdevice_votes);
printf(" %s\n", info[0].qdevice_name);
/* If the quorum device is inactive on this node then show votes as 0
so that the display is not confusing */
if (our_flags & VOTEQUORUM_INFO_QDEVICE_CAST_VOTE) {
print_uint32_padded(info[0].qdevice_votes);
}
else {
print_uint32_padded(0);
}
printf(" %s", info[0].qdevice_name);
if (our_flags & VOTEQUORUM_INFO_QDEVICE_CAST_VOTE) {
printf("\n");
}
else {
printf(" (votes %d)\n", info[0].qdevice_votes);
}
}
}