Skip to content

Commit

Permalink
dlm_tool: show status of startup nodes
Browse files Browse the repository at this point in the history
During startup fencing, the dlm_tool status
output was not clear what was happening.
Now it displays the startup_nodes with
state 'U' (unknown).

Signed-off-by: David Teigland <[email protected]>
  • Loading branch information
teigland committed Jan 29, 2013
1 parent 87007d9 commit cbc0685
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 1 deletion.
23 changes: 23 additions & 0 deletions dlm_controld/daemon_cpg.c
Original file line number Diff line number Diff line change
Expand Up @@ -2133,6 +2133,29 @@ void send_state_daemon_nodes(int fd)
}
}

void send_state_startup_nodes(int fd)
{
struct node_daemon *node;
struct dlmc_state st;
char str[DLMC_STATE_MAXSTR];
int str_len;

list_for_each_entry(node, &startup_nodes, list) {
memset(&st, 0, sizeof(st));
st.type = DLMC_STATE_STARTUP_NODE;
st.nodeid = node->nodeid;

memset(str, 0, sizeof(str));
str_len = print_state_daemon_node(node, str);

st.str_len = str_len;

send(fd, &st, sizeof(st), MSG_NOSIGNAL);
if (str_len)
send(fd, str, str_len, MSG_NOSIGNAL);
}
}

static int print_state_daemon(char *str)
{
snprintf(str, DLMC_STATE_MAXSTR-1,
Expand Down
1 change: 1 addition & 0 deletions dlm_controld/dlm_controld.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ struct dlmc_header {

#define DLMC_STATE_DAEMON 1
#define DLMC_STATE_DAEMON_NODE 2
#define DLMC_STATE_STARTUP_NODE 3

struct dlmc_state {
uint32_t type; /* DLMC_STATE_ */
Expand Down
1 change: 1 addition & 0 deletions dlm_controld/dlm_daemon.h
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,7 @@ void set_protocol_stateful(void);
int set_protocol(void);
void send_state_daemon_nodes(int fd);
void send_state_daemon(int fd);
void send_state_startup_nodes(int fd);

void log_config(const struct cpg_name *group_name,
const struct cpg_address *member_list,
Expand Down
12 changes: 11 additions & 1 deletion dlm_controld/lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -275,11 +275,20 @@ static void format_daemon_node(struct dlmc_state *st, char *str, char *bin, uint
char *node_line, char *fence_line)
{
unsigned int delay_fencing, result_wait, killed;
char letter;

if (st->type == DLMC_STATE_STARTUP_NODE)
letter = 'U';
else if (kv(str, "member"))
letter = 'M';
else
letter = 'X';


snprintf(node_line, DLMC_STATE_MAXSTR - 1,
"node %d %c add %u rem %u fail %u fence %u at %u %u\n",
st->nodeid,
kv(str, "member") ? 'M' : 'X',
letter,
kv(str, "add_time"),
kv(str, "rem_time"),
kv(str, "fail_monotime"),
Expand Down Expand Up @@ -394,6 +403,7 @@ int dlmc_print_status(uint32_t flags)
break;

case DLMC_STATE_DAEMON_NODE:
case DLMC_STATE_STARTUP_NODE:

if (flags & DLMC_STATUS_VERBOSE) {
printf("nodeid %d\n", st->nodeid);
Expand Down
1 change: 1 addition & 0 deletions dlm_controld/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -877,6 +877,7 @@ static void *process_queries(void *arg)
case DLMC_CMD_DUMP_STATUS:
send_state_daemon(f);
send_state_daemon_nodes(f);
send_state_startup_nodes(f);
break;
default:
break;
Expand Down

0 comments on commit cbc0685

Please sign in to comment.