Page Menu
Home
ClusterLabs Projects
Search
Configure Global Search
Log In
Files
F2822461
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
17 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/include/crm/common/nodes.h b/include/crm/common/nodes.h
index 8f62d14151..fbc375819a 100644
--- a/include/crm/common/nodes.h
+++ b/include/crm/common/nodes.h
@@ -1,133 +1,144 @@
/*
* Copyright 2004-2023 the Pacemaker project contributors
*
* The version control history for this file may have further details.
*
* This source code is licensed under the GNU Lesser General Public License
* version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY.
*/
#ifndef PCMK__CRM_COMMON_NODES__H
# define PCMK__CRM_COMMON_NODES__H
#include <glib.h> // gboolean, GList, GHashTable
#include <crm/common/scheduler_types.h> // pcmk_resource_t, pcmk_scheduler_t
#ifdef __cplusplus
extern "C" {
#endif
/*!
* \file
* \brief Scheduler API for nodes
* \ingroup core
*/
// Special node attributes
#define PCMK_NODE_ATTR_TERMINATE "terminate"
//! Possible node types
enum node_type {
pcmk_node_variant_cluster = 1, //!< Cluster layer node
pcmk_node_variant_remote = 2, //!< Pacemaker Remote node
node_ping = 0, //!< \deprecated Do not use
#if !defined(PCMK_ALLOW_DEPRECATED) || (PCMK_ALLOW_DEPRECATED == 1)
//! \deprecated Use pcmk_node_variant_cluster instead
node_member = pcmk_node_variant_cluster,
//! \deprecated Use pcmk_node_variant_remote instead
node_remote = pcmk_node_variant_remote,
#endif
};
//! When to probe a resource on a node (as specified in location constraints)
enum pe_discover_e {
pcmk_probe_always = 0, //! Always probe resource on node
pcmk_probe_never = 1, //! Never probe resource on node
pcmk_probe_exclusive = 2, //! Probe only on designated nodes
#if !defined(PCMK_ALLOW_DEPRECATED) || (PCMK_ALLOW_DEPRECATED == 1)
//! \deprecated Use pcmk_probe_always instead
pe_discover_always = pcmk_probe_always,
//! \deprecated Use pcmk_probe_never instead
pe_discover_never = pcmk_probe_never,
//! \deprecated Use pcmk_probe_exclusive instead
pe_discover_exclusive = pcmk_probe_exclusive,
#endif
};
//! Basic node information (all node objects for the same node share this)
struct pe_node_shared_s {
const char *id; //!< Node ID at the cluster layer
const char *uname; //!< Node name in cluster
enum node_type type; //!< Node variant
// @TODO Convert these into a flag group
gboolean online; //!< Whether online
gboolean standby; //!< Whether in standby mode
gboolean standby_onfail; //!< Whether in standby mode due to on-fail
gboolean pending; //!< Whether controller membership is pending
gboolean unclean; //!< Whether node requires fencing
gboolean unseen; //!< Whether node has never joined cluster
gboolean shutdown; //!< Whether shutting down
gboolean expected_up; //!< Whether expected join state is member
gboolean is_dc; //!< Whether node is cluster's DC
gboolean maintenance; //!< Whether in maintenance mode
gboolean rsc_discovery_enabled; //!< Whether probes are allowed on node
/*!
* Whether this is a guest node whose guest resource must be recovered or a
* remote node that must be fenced
*/
gboolean remote_requires_reset;
/*!
* Whether this is a Pacemaker Remote node that was fenced since it was last
* connected by the cluster
*/
gboolean remote_was_fenced;
/*!
* Whether this is a Pacemaker Remote node previously marked in its
* node state as being in maintenance mode
*/
gboolean remote_maintenance;
gboolean unpacked; //!< Whether node history has been unpacked
/*!
* Number of resources active on this node (valid after CIB status section
* has been unpacked, as long as pcmk_sched_no_counts was not set)
*/
int num_resources;
//! Remote connection resource for node, if it is a Pacemaker Remote node
pcmk_resource_t *remote_rsc;
GList *running_rsc; //!< List of resources active on node
GList *allocated_rsc; //!< List of resources assigned to node
GHashTable *attrs; //!< Node attributes
GHashTable *utilization; //!< Node utilization attributes
GHashTable *digest_cache; //!< Cache of calculated resource digests
/*!
* Sum of priorities of all resources active on node and on any guest nodes
* connected to this node, with +1 for promoted instances (used to compare
* nodes for priority-fencing-delay)
*/
int priority;
pcmk_scheduler_t *data_set; //!< Cluster that node is part of
};
+//! Implementation of pcmk_node_t
+struct pe_node_s {
+ int weight; //!< Node score for a given resource
+ gboolean fixed; //!< \deprecated Do not use
+ int count; //!< Counter reused by assignment and promotion code
+ struct pe_node_shared_s *details; //!< Basic node information
+
+ // @COMPAT This should be enum pe_discover_e
+ int rsc_discover_mode; //!< Probe mode (enum pe_discover_e)
+};
+
#ifdef __cplusplus
}
#endif
#endif // PCMK__CRM_COMMON_NODES__H
diff --git a/include/crm/pengine/pe_types.h b/include/crm/pengine/pe_types.h
index 2db0dc5d80..7d28b30edf 100644
--- a/include/crm/pengine/pe_types.h
+++ b/include/crm/pengine/pe_types.h
@@ -1,351 +1,343 @@
/*
* Copyright 2004-2023 the Pacemaker project contributors
*
* The version control history for this file may have further details.
*
* This source code is licensed under the GNU Lesser General Public License
* version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY.
*/
#ifndef PCMK__CRM_PENGINE_PE_TYPES__H
# define PCMK__CRM_PENGINE_PE_TYPES__H
# include <stdbool.h> // bool
# include <sys/types.h> // time_t
# include <libxml/tree.h> // xmlNode
# include <glib.h> // gboolean, guint, GList, GHashTable
# include <crm/common/iso8601.h>
# include <crm/common/scheduler.h>
# include <crm/pengine/common.h>
#ifdef __cplusplus
extern "C" {
#endif
/*!
* \file
* \brief Data types for cluster status
* \ingroup pengine
*/
typedef struct resource_object_functions_s {
gboolean (*unpack)(pcmk_resource_t*, pcmk_scheduler_t*);
pcmk_resource_t *(*find_rsc)(pcmk_resource_t *parent, const char *search,
const pcmk_node_t *node, int flags);
/* parameter result must be free'd */
char *(*parameter)(pcmk_resource_t*, pcmk_node_t*, gboolean, const char*,
pcmk_scheduler_t*);
//! \deprecated will be removed in a future release
void (*print)(pcmk_resource_t*, const char*, long, void*);
gboolean (*active)(pcmk_resource_t*, gboolean);
enum rsc_role_e (*state)(const pcmk_resource_t*, gboolean);
pcmk_node_t *(*location)(const pcmk_resource_t*, GList**, int);
void (*free)(pcmk_resource_t*);
void (*count)(pcmk_resource_t*);
gboolean (*is_filtered)(const pcmk_resource_t*, GList *, gboolean);
/*!
* \brief Find a node (and optionally count all) where resource is active
*
* \param[in] rsc Resource to check
* \param[out] count_all If not NULL, set this to count of active nodes
* \param[out] count_clean If not NULL, set this to count of clean nodes
*
* \return A node where the resource is active, preferring the source node
* if the resource is involved in a partial migration or a clean,
* online node if the resource's "requires" is "quorum" or
* "nothing", or NULL if the resource is inactive.
*/
pcmk_node_t *(*active_node)(const pcmk_resource_t *rsc,
unsigned int *count_all,
unsigned int *count_clean);
/*!
* \brief Get maximum resource instances per node
*
* \param[in] rsc Resource to check
*
* \return Maximum number of \p rsc instances that can be active on one node
*/
unsigned int (*max_per_node)(const pcmk_resource_t *rsc);
} resource_object_functions_t;
struct pe_working_set_s {
xmlNode *input;
crm_time_t *now;
/* options extracted from the input */
char *dc_uuid;
pcmk_node_t *dc_node;
const char *stonith_action;
const char *placement_strategy;
unsigned long long flags;
int stonith_timeout;
enum pe_quorum_policy no_quorum_policy;
GHashTable *config_hash;
GHashTable *tickets;
// Actions for which there can be only one (e.g. fence nodeX)
GHashTable *singletons;
GList *nodes;
GList *resources;
GList *placement_constraints;
GList *ordering_constraints;
GList *colocation_constraints;
GList *ticket_constraints;
GList *actions;
xmlNode *failed;
xmlNode *op_defaults;
xmlNode *rsc_defaults;
/* stats */
int num_synapse;
int max_valid_nodes; //! Deprecated (will be removed in a future release)
int order_id;
int action_id;
/* final output */
xmlNode *graph;
GHashTable *template_rsc_sets;
const char *localhost;
GHashTable *tags;
int blocked_resources;
int disabled_resources;
GList *param_check; // History entries that need to be checked
GList *stop_needed; // Containers that need stop actions
time_t recheck_by; // Hint to controller to re-run scheduler by this time
int ninstances; // Total number of resource instances
guint shutdown_lock;// How long (seconds) to lock resources to shutdown node
int priority_fencing_delay; // Priority fencing delay
void *priv;
guint node_pending_timeout; // Node pending timeout
};
-struct pe_node_s {
- int weight;
- gboolean fixed; //!< \deprecated Will be removed in a future release
- int count;
- struct pe_node_shared_s *details;
- int rsc_discover_mode;
-};
-
struct pe_resource_s {
char *id;
char *clone_name;
xmlNode *xml;
xmlNode *orig_xml;
xmlNode *ops_xml;
pcmk_scheduler_t *cluster;
pcmk_resource_t *parent;
enum pe_obj_types variant;
void *variant_opaque;
resource_object_functions_t *fns;
pcmk_assignment_methods_t *cmds;
enum rsc_recovery_type recovery_type;
enum pe_restart restart_type; //!< \deprecated will be removed in future release
int priority;
int stickiness;
int sort_index;
int failure_timeout;
int migration_threshold;
guint remote_reconnect_ms;
char *pending_task;
unsigned long long flags;
// @TODO merge these into flags
gboolean is_remote_node;
gboolean exclusive_discover;
/* Pay special attention to whether you want to use rsc_cons_lhs and
* rsc_cons directly, which include only colocations explicitly involving
* this resource, or call libpacemaker's pcmk__with_this_colocations() and
* pcmk__this_with_colocations() functions, which may return relevant
* colocations involving the resource's ancestors as well.
*/
//!@{
//! This field should be treated as internal to Pacemaker
GList *rsc_cons_lhs; // List of pcmk__colocation_t*
GList *rsc_cons; // List of pcmk__colocation_t*
GList *rsc_location; // List of pe__location_t*
GList *actions; // List of pcmk_action_t*
GList *rsc_tickets; // List of rsc_ticket*
//!@}
pcmk_node_t *allocated_to;
pcmk_node_t *partial_migration_target;
pcmk_node_t *partial_migration_source;
GList *running_on; // pcmk_node_t*
GHashTable *known_on; // pcmk_node_t*
GHashTable *allowed_nodes; // pcmk_node_t*
enum rsc_role_e role;
enum rsc_role_e next_role;
GHashTable *meta;
GHashTable *parameters; //! \deprecated Use pe_rsc_params() instead
GHashTable *utilization;
GList *children; // pcmk_resource_t*
GList *dangling_migrations; // pcmk_node_t*
pcmk_resource_t *container;
GList *fillers;
// @COMPAT These should be made const at next API compatibility break
pcmk_node_t *pending_node; // Node on which pending_task is happening
pcmk_node_t *lock_node; // Resource is shutdown-locked to this node
time_t lock_time; // When shutdown lock started
/* Resource parameters may have node-attribute-based rules, which means the
* values can vary by node. This table is a cache of parameter name/value
* tables for each node (as needed). Use pe_rsc_params() to get the table
* for a given node.
*/
GHashTable *parameter_cache; // Key = node name, value = parameters table
};
struct pe_action_s {
int id;
int priority;
pcmk_resource_t *rsc;
pcmk_node_t *node;
xmlNode *op_entry;
char *task;
char *uuid;
char *cancel_task;
char *reason;
enum pe_action_flags flags;
enum rsc_start_requirement needs;
enum action_fail_response on_fail;
enum rsc_role_e fail_role;
GHashTable *meta;
GHashTable *extra;
/*
* These two varables are associated with the constraint logic
* that involves first having one or more actions runnable before
* then allowing this action to execute.
*
* These varables are used with features such as 'clone-min' which
* requires at minimum X number of cloned instances to be running
* before an order dependency can run. Another option that uses
* this is 'require-all=false' in ordering constrants. This option
* says "only require one instance of a resource to start before
* allowing dependencies to start" -- basically, require-all=false is
* the same as clone-min=1.
*/
/* current number of known runnable actions in the before list. */
int runnable_before;
/* the number of "before" runnable actions required for this action
* to be considered runnable */
int required_runnable_before;
GList *actions_before; /* pe_action_wrapper_t* */
GList *actions_after; /* pe_action_wrapper_t* */
/* Some of the above fields could be moved to the details,
* except for API backward compatibility.
*/
void *action_details; // varies by type of action
};
typedef struct pe_ticket_s {
char *id;
gboolean granted;
time_t last_granted;
gboolean standby;
GHashTable *state;
} pe_ticket_t;
typedef struct pe_tag_s {
char *id;
GList *refs;
} pe_tag_t;
//!@{
//! \deprecated Do not use
enum pe_ordering {
pe_order_none = 0x0, /* deleted */
#if !defined(PCMK_ALLOW_DEPRECATED) || (PCMK_ALLOW_DEPRECATED == 1)
pe_order_optional = 0x1, /* pure ordering, nothing implied */
pe_order_apply_first_non_migratable = 0x2, /* Only apply this constraint's ordering if first is not migratable. */
pe_order_implies_first = 0x10, /* If 'then' is required, ensure 'first' is too */
pe_order_implies_then = 0x20, /* If 'first' is required, ensure 'then' is too */
pe_order_promoted_implies_first = 0x40, /* If 'then' is required and then's rsc is promoted, ensure 'first' becomes required too */
/* first requires then to be both runnable and migrate runnable. */
pe_order_implies_first_migratable = 0x80,
pe_order_runnable_left = 0x100, /* 'then' requires 'first' to be runnable */
pe_order_pseudo_left = 0x200, /* 'then' can only be pseudo if 'first' is runnable */
pe_order_implies_then_on_node = 0x400, /* If 'first' is required on 'nodeX',
* ensure instances of 'then' on 'nodeX' are too.
* Only really useful if 'then' is a clone and 'first' is not
*/
pe_order_probe = 0x800, /* If 'first->rsc' is
* - running but about to stop, ignore the constraint
* - otherwise, behave as runnable_left
*/
pe_order_restart = 0x1000, /* 'then' is runnable if 'first' is optional or runnable */
pe_order_stonith_stop = 0x2000,
pe_order_serialize_only = 0x4000, /* serialize */
pe_order_same_node = 0x8000, /* applies only if 'first' and 'then' are on same node */
pe_order_implies_first_printed = 0x10000, /* Like ..implies_first but only ensures 'first' is printed, not mandatory */
pe_order_implies_then_printed = 0x20000, /* Like ..implies_then but only ensures 'then' is printed, not mandatory */
pe_order_asymmetrical = 0x100000, /* Indicates asymmetrical one way ordering constraint. */
pe_order_load = 0x200000, /* Only relevant if... */
pe_order_one_or_more = 0x400000, /* 'then' is runnable only if one or more of its dependencies are too */
pe_order_anti_colocation = 0x800000,
pe_order_preserve = 0x1000000, /* Hack for breaking user ordering constraints with container resources */
pe_order_then_cancels_first = 0x2000000, // if 'then' becomes required, 'first' becomes optional
pe_order_trace = 0x4000000, /* test marker */
pe_order_implies_first_master = pe_order_promoted_implies_first,
#endif
};
//!@}
typedef struct pe_action_wrapper_s {
enum pe_ordering type;
enum pe_link_state state;
pcmk_action_t *action;
} pe_action_wrapper_t;
#if !defined(PCMK_ALLOW_DEPRECATED) || (PCMK_ALLOW_DEPRECATED == 1)
#include <crm/pengine/pe_types_compat.h>
#endif
#ifdef __cplusplus
}
#endif
#endif // PCMK__CRM_PENGINE_PE_TYPES__H
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Sat, Jan 25, 5:49 AM (14 h, 18 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1321445
Default Alt Text
(17 KB)
Attached To
Mode
rP Pacemaker
Attached
Detach File
Event Timeline
Log In to Comment