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

Handle errors from cluster_status #3735

Draft
wants to merge 11 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 2 additions & 0 deletions include/crm/pengine/status.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ extern "C" {

const char *rsc_printable_id(const pcmk_resource_t *rsc);

int pcmk_unpack_scheduler_input(pcmk_scheduler_t *scheduler);

// NOTE: sbd (as of at least 1.5.2) uses this
gboolean cluster_status(pcmk_scheduler_t *scheduler);

Expand Down
23 changes: 16 additions & 7 deletions lib/pengine/status.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,9 @@ check_for_deprecated_rules(pcmk_scheduler_t *scheduler)
}
}

/*
* Unpack everything
/*!
* Unpack scheduler input
*
* At the end you'll have:
* - A list of nodes
* - A list of resources (each with any dependencies on other resources)
Expand All @@ -98,23 +99,25 @@ check_for_deprecated_rules(pcmk_scheduler_t *scheduler)
* - A list of nodes that need to be stonith'd
* - A list of nodes that need to be shutdown
* - A list of the possible stop/start actions (without dependencies)
*
* \return Standard Pacemaker return code
*/
gboolean
cluster_status(pcmk_scheduler_t * scheduler)
int
pcmk_unpack_scheduler_input(pcmk_scheduler_t *scheduler)
{
const char *new_version = NULL;
xmlNode *section = NULL;

if ((scheduler == NULL) || (scheduler->input == NULL)) {
return FALSE;
return EINVAL;
clumens marked this conversation as resolved.
Show resolved Hide resolved
}

new_version = crm_element_value(scheduler->input, PCMK_XA_CRM_FEATURE_SET);

if (pcmk__check_feature_set(new_version) != pcmk_rc_ok) {
pcmk__config_err("Can't process CIB with feature set '%s' greater than our own '%s'",
new_version, CRM_FEATURE_SET);
return FALSE;
return pcmk_rc_schema_validation;
clumens marked this conversation as resolved.
Show resolved Hide resolved
}

crm_trace("Beginning unpack");
Expand Down Expand Up @@ -202,7 +205,13 @@ cluster_status(pcmk_scheduler_t * scheduler)
}

pcmk__set_scheduler_flags(scheduler, pcmk__sched_have_status);
return TRUE;
return pcmk_rc_ok;
}

gboolean
cluster_status(pcmk_scheduler_t * scheduler)
{
return pcmk_unpack_scheduler_input(scheduler) == pcmk_rc_ok;
}

/*!
Expand Down