Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

avoid some probably unnecessary watchdog-reboots with pacemaker_remot… #14

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 78 additions & 3 deletions src/sbd-pacemaker.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,18 +94,79 @@ mon_timer_reconnect(gpointer data)
cl_log(LOG_INFO, "CIB reconnect successful");
}

notify_parent();
return FALSE;
}

static void
mon_cib_connection_destroy(gpointer user_data)
{
if (cib) {
cib->cmds->signoff(cib);
set_servant_health(pcmk_health_transient, LOG_WARNING, "Disconnected from CIB");
timer_id_reconnect = g_timeout_add(reconnect_msec, mon_timer_reconnect, NULL);
int new_servant_health = pcmk_health_transient;
xmlNode *cib_copy = NULL;
pe_working_set_t data_set;
node_t *node;

/* use leftover info to check if we are running
* on a remote-node without active resources
*/
if (current_cib) {
cib_copy = copy_xml(current_cib);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why make a copy if you're going to free the original at the end anyway?

if (cli_config_update(&cib_copy, NULL, FALSE)) {
last_refresh = time(NULL);
set_working_set_defaults(&data_set);
data_set.input = cib_copy;
data_set.flags |= pe_flag_have_stonith_resource;
cluster_status(&data_set);
compute_status(&data_set);
node = pe_find_node(data_set.nodes, local_uname);
if ((node != NULL) &&
(node->details->type == node_remote) &&
(node->details->running_rsc == NULL)) {

if (data_set.no_quorum_policy != no_quorum_suicide) {
new_servant_health = pcmk_health_online;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd be wary of re-using "online" here, pcmk_health_pending might be better or invent a new one that means "safely disconnected dont shoot!"

cl_log(LOG_INFO,
"found remote node without remaining resources");
} else {
/* Assuming reason for setting no-quorum-policy
* to suicide is hope to regain connectivity
* by rebooting or simply for the case there
* might be something wrong with ourself.
* Alternative would be to make configurable
* independently for remote-nodes in sbd-config,
* via cluster-property or even on a per
* remote-node basis as resource-attribute.
*/
cl_log(LOG_INFO,
"found remote node without remaining resources - "
"still suiciding derived from no-quorum-policy");
}
} else {
cl_log(LOG_INFO, "assuming that there are still "
"resources to be handled");
}
cleanup_calculations(&data_set);
} else {
cl_log(LOG_INFO, "cli_config_update failed");
}
} else {
cl_log(LOG_INFO, "found cib on destroy but current_cib is empty");
}
cib->cmds->signoff(cib);
set_servant_health(new_servant_health, LOG_WARNING,
"Disconnected from CIB");
timer_id_reconnect = g_timeout_add(reconnect_msec,
mon_timer_reconnect, NULL);
}
cib_connected = 0;
if (current_cib) {
/* cleanup the copy and prevent status being evaluated
* again based on the old data
*/
free_xml(current_cib);
current_cib = NULL;
}
return;
}

Expand Down Expand Up @@ -204,6 +265,18 @@ compute_status(pe_working_set_t * data_set)

updates++;

if (node != NULL) {
if (node->details->type == node_remote) {
cl_log(LOG_INFO,
"'%s' is a remote-node that has %sresources running",
local_uname, (node->details->running_rsc == NULL)?"no ":"");
} else {
cl_log(LOG_INFO, "'%s' is a full cluster-node", local_uname);
}
} else {
cl_log(LOG_INFO, "didn't find ourself (%s) in cib", local_uname);
}

if (data_set->dc_node == NULL) {
set_servant_health(pcmk_health_transient, LOG_INFO, "We don't have a DC right now.");
notify_parent();
Expand Down Expand Up @@ -406,8 +479,10 @@ servant_pcmk(const char *diskname, int mode, const void* argp)
} while (exit_code == -ENOTCONN);

if (exit_code != 0) {
cl_log(LOG_WARNING, "Failed connecting to the cib");
clean_up(-exit_code);
}
cl_log(LOG_INFO, "Connected to cib");
}

mainloop = g_main_new(FALSE);
Expand Down