Skip to content

Commit

Permalink
API: libcrmcommon: drop pcmk_scheduler_t config_hash member
Browse files Browse the repository at this point in the history
Move it to pcmk__scheduler_private_t as options.

This breaks API backward compatibility.
  • Loading branch information
kgaillot committed Jun 24, 2024
1 parent cdb82aa commit 14dabe3
Show file tree
Hide file tree
Showing 10 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion daemons/schedulerd/schedulerd_messages.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ handle_pecalc_request(pcmk__request_t *request)
series_id = 2;
}

value = pcmk__cluster_option(scheduler->config_hash,
value = pcmk__cluster_option(scheduler->priv->options,
series[series_id].param);
if ((value == NULL)
|| (pcmk__scan_min_int(value, &series_wrap, -1) != pcmk_rc_ok)) {
Expand Down
2 changes: 0 additions & 2 deletions include/crm/common/scheduler.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,6 @@ struct pcmk__scheduler {
//! \deprecated Call pcmk_get_no_quorum_policy() to get no-quorum policy
enum pe_quorum_policy no_quorum_policy; // Response to loss of quorum

GHashTable *config_hash; // Cluster properties

// Ticket constraints unpacked from ticket state
GHashTable *tickets;

Expand Down
1 change: 1 addition & 0 deletions include/crm/common/scheduler_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ struct pcmk__scheduler_private {

crm_time_t *now; // Time to use when evaluating rules
pcmk__output_t *out; // Output object for displaying messages
GHashTable *options; // Cluster options
const char *fence_action; // Default fencing action
int fence_timeout_ms; // Value of stonith-timeout property in ms
const char *placement_strategy; // Value of placement-strategy property
Expand Down
4 changes: 2 additions & 2 deletions include/crm/pengine/internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ int pe__node_health(pcmk_node_t *node);
static inline enum pcmk__health_strategy
pe__health_strategy(pcmk_scheduler_t *scheduler)
{
const char *strategy = pcmk__cluster_option(scheduler->config_hash,
const char *strategy = pcmk__cluster_option(scheduler->priv->options,
PCMK_OPT_NODE_HEALTH_STRATEGY);

return pcmk__parse_health_strategy(strategy);
Expand All @@ -413,7 +413,7 @@ pe__health_strategy(pcmk_scheduler_t *scheduler)
static inline int
pe__health_score(const char *option, pcmk_scheduler_t *scheduler)
{
const char *value = pcmk__cluster_option(scheduler->config_hash, option);
const char *value = pcmk__cluster_option(scheduler->priv->options, option);

return char2score(value);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/pacemaker/pcmk_graph_producer.c
Original file line number Diff line number Diff line change
Expand Up @@ -1019,7 +1019,7 @@ pcmk__create_graph(pcmk_scheduler_t *scheduler)
GList *iter = NULL;
const char *value = NULL;
long long limit = 0LL;
GHashTable *config_hash = scheduler->config_hash;
GHashTable *config_hash = scheduler->priv->options;

transition_id++;
crm_trace("Creating transition graph %d", transition_id);
Expand Down
2 changes: 1 addition & 1 deletion lib/pacemaker/pcmk_sched_nodes.c
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ pcmk__apply_node_health(pcmk_scheduler_t *scheduler)
int base_health = 0;
enum pcmk__health_strategy strategy;
const char *strategy_str =
pcmk__cluster_option(scheduler->config_hash,
pcmk__cluster_option(scheduler->priv->options,
PCMK_OPT_NODE_HEALTH_STRATEGY);

strategy = pcmk__parse_health_strategy(strategy_str);
Expand Down
4 changes: 2 additions & 2 deletions lib/pengine/status.c
Original file line number Diff line number Diff line change
Expand Up @@ -324,8 +324,8 @@ cleanup_calculations(pcmk_scheduler_t *scheduler)
}

pcmk__clear_scheduler_flags(scheduler, pcmk__sched_have_status);
if (scheduler->config_hash != NULL) {
g_hash_table_destroy(scheduler->config_hash);
if (scheduler->priv->options != NULL) {
g_hash_table_destroy(scheduler->priv->options);
}

if (scheduler->singletons != NULL) {
Expand Down
6 changes: 3 additions & 3 deletions lib/pengine/unpack.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ struct action_history {
* flag is stringified more readably in log messages.
*/
#define set_config_flag(scheduler, option, flag) do { \
GHashTable *config_hash = (scheduler)->config_hash; \
GHashTable *config_hash = (scheduler)->priv->options; \
const char *scf_value = pcmk__cluster_option(config_hash, (option)); \
\
if (scf_value != NULL) { \
Expand Down Expand Up @@ -228,7 +228,7 @@ unpack_config(xmlNode *config, pcmk_scheduler_t *scheduler)
.op_data = NULL
};

scheduler->config_hash = config_hash;
scheduler->priv->options = config_hash;

pe__unpack_dataset_nvpairs(config, PCMK_XE_CLUSTER_PROPERTY_SET, &rule_data,
config_hash, PCMK_VALUE_CIB_BOOTSTRAP_OPTIONS,
Expand Down Expand Up @@ -4922,7 +4922,7 @@ add_node_attrs(const xmlNode *xml_obj, pcmk_node_t *node, bool overwrite,
CRM_ATTR_IS_DC, PCMK_VALUE_FALSE);
}

cluster_name = g_hash_table_lookup(scheduler->config_hash,
cluster_name = g_hash_table_lookup(scheduler->priv->options,
PCMK_OPT_CLUSTER_NAME);
if (cluster_name) {
pcmk__insert_dup(node->priv->attrs, CRM_ATTR_CLUSTER_NAME,
Expand Down
2 changes: 1 addition & 1 deletion tools/crm_resource_print.c
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,7 @@ resource_check_list_default(pcmk__output_t *out, va_list args) {
"'%s' cannot run on unhealthy nodes due to "
PCMK_OPT_NODE_HEALTH_STRATEGY "='%s'",
parent->id,
pcmk__cluster_option(scheduler->config_hash,
pcmk__cluster_option(scheduler->priv->options,
PCMK_OPT_NODE_HEALTH_STRATEGY));
}

Expand Down
5 changes: 3 additions & 2 deletions tools/crm_resource_runtime.c
Original file line number Diff line number Diff line change
Expand Up @@ -2049,9 +2049,10 @@ wait_till_stable(pcmk__output_t *out, guint timeout_ms, cib_t * cib)
* wait as a new controller operation that would be forwarded to the
* DC. However, that would have potential problems of its own.
*/
const char *dc_version = g_hash_table_lookup(scheduler->config_hash,
PCMK_OPT_DC_VERSION);
const char *dc_version = NULL;

dc_version = g_hash_table_lookup(scheduler->priv->options,
PCMK_OPT_DC_VERSION);
if (!pcmk__str_eq(dc_version, PACEMAKER_VERSION "-" BUILD_VERSION, pcmk__str_casei)) {
out->info(out, "warning: wait option may not work properly in "
"mixed-version cluster");
Expand Down

0 comments on commit 14dabe3

Please sign in to comment.