Page MenuHomeClusterLabs Projects

Pacemaker 2.0 API Changes
Updated 402 Days AgoPublic

This page describes backward-incompatible changes in Pacemaker's public C API made between the Pacemaker 1.x and 2.0 release series.

For most of these, the old symbols can be used by including <crm/compatibility.h>. However, that should be used only to allow a gradual transition to using the newer names. The old symbols will be removed from compatibility.h at the next major version (3.0).

The C API headers are now compatible with being used in C++ programs.

All applications linking against the Pacemaker libraries will need to be recompiled. Some may need code changes, but these should be minimal.

Removed with no replacement

These relate to things for which support was removed entirely, such as the heartbeat and corosync 1 cluster stacks. Any code using these should simply be removed.

Preprocessor symbols
ACTIVESTATUS
APPNAME_LEN
CRM_LEGACY_CONFIG_DIR
CRM_NODE_EVICTED
CRM_OP_DEBUG_UP
CRM_OP_DEBUG_DOWN
CRM_OP_DIE
CRM_OP_RETRIVE_CIB
CRM_OP_HBEAT
CRM_OP_ABORT
CRM_OP_EVENTCC
CRM_OP_TEABORT
CRM_OP_TEABORTED
CRM_OP_TE_HALT
CRM_OP_TECOMPLETE
CRM_OP_TETIMEOUT
CRM_OP_TRANSITION
CRM_OP_NODES_PROBED
CRM_SERVICE
CS_USES_LIBQB
DEADSTATUS
DOT_ALL_FSA_INPUTS
DOT_FSA_ACTIONS
F_LRMD_CANCEL_CALLID
F_LRMD_IPC_PROXY_NODE
F_LRMD_RSC_METADATA
LRMD_OP_RSC_CHK_REG
HA_VARLIBHBDIR
HAVE_CONFDB
JOINSTATUS
LEAVESTATUS
MAX_IPC_FAIL
MSG_LOG
NORMALNODE
PCMK_SERVICE_ID
PE_OBJ_T_GROUP
PE_OBJ_T_INCARNATION
PE_OBJ_T_MASTER
PE_OBJ_T_NATIVE
PINGSTATUS
SERVICE_SCRIPT
SOCKET_LEN
SUPPORT_CMAN
SUPPORT_CS_QUORUM
SUPPORT_PLUGIN
XML_ATTR_DC
XML_ATTR_EXPECTED_VOTES
XML_ATTR_FILTER_TYPE
XML_ATTR_FILTER_ID
XML_ATTR_FILTER_PRIORITY
XML_ATTR_LRM_PROBE
XML_ATTR_RESULT
XML_ATTR_SECTION
XML_ATTR_TE_ALLOWFAIL
XML_CIB_ATTR_CLEAR
XML_CIB_ATTR_HEALTH
XML_CIB_ATTR_WEIGHT
XML_CIB_ATTR_STANDBY
XML_CIB_ATTR_STONITH
XML_CIB_TAG_CONSTRAINT
XML_CIB_TAG_DOMAIN
XML_FAIL_TAG_RESOURCE
XML_FAILRES_ATTR_RESID
XML_FAILRES_ATTR_REASON
XML_FAILRES_ATTR_RESSTATUS
XML_LRM_TAG_AGENT
XML_LRM_TAG_AGENTS
XML_LRM_TAG_ATTRIBUTES
XML_MSG_TAG
XML_MSG_TAG_DATA
XML_NODE_ATTR_STATE
XML_OP_ATTR_DEPENDENT
XML_RSC_ATTR_PRIORITY
XML_RSC_ATTR_STATE
XML_RULE_ATTR_SCORE_MANGLED
XML_RULE_ATTR_RESULT
XML_RSC_ATTR_ISOLATION_INSTANCE
XML_RSC_ATTR_ISOLATION_WRAPPER
XML_RSC_ATTR_ISOLATION_HOST
XML_RSC_ATTR_ISOLATION
enums
timer_reason
enum values and global variables
ais_fd_sync
cib_default_options
crm_class_members
crm_class_notify
crm_class_nodeid
crm_class_rmpeer
crm_class_quorum
crm_remote_baremetal
crm_remote_container
crm_status_rstate
n_object_classes
pcmk_cluster_classic_ais
pcmk_cluster_cman
pcmk_cluster_heartbeat
pe_action_failure_is_fatal
pe_master
pe_rsc_have_unfencing
pe_rsc_migrating
pe_rsc_munging
pe_rsc_shutdown
pe_rsc_try_reload
pe_rsc_unexpectedly_running
timeout_action
timeout_action_warn
timeout_abort
Library functions
get_resource_type()
get_resource_typename()
is_classic_ais_cluster()
is_cman_cluster()
Structure members
crm_action_timer_t: reason
crm_node_t: born, addr, version
pe_action_t a.k.a action_t: pre_notify, pre_notified, post_notify, post_notified, seen_count
resource_t: isolation_wrapper

Simple search-and-replace changes

Legacy usageCurrent usage
#ifdef SUPPORT_CS#if SUPPORT_COROSYNC
AIS_COROSYNC1 /* always true now */
CRM_DTD_DIRECTORYCRM_SCHEMA_DIRECTORY
CRM_NODE_ACTIVECRM_NODE_MEMBER
CS_USES_LIBQB1 /* always true now */
DAEMON_RESPAWN_STOPCRM_EX_FATAL
HAVE_ATOMIC_ATTRD1 /* always true now */
HAVE_CMAP1 /* always true now */
HAVE_CONFDB0 /* always false now */
INSTANCE(x)crm_element_value(x, XML_CIB_ATTR_INSTANCE)
LOG_DEBUG_2LOG_TRACE
LOG_DEBUG_3LOG_TRACE
LOG_DEBUG_4LOG_TRACE
LOG_DEBUG_5LOG_TRACE
LOG_DEBUG_6LOG_TRACE
NAME(x)crm_element_value(x, XML_NVPAIR_ATTR_NAME)
SUPPORT_AIS1 /* always true now */
SUPPORT_CMAN0 /* always false now */
SUPPORT_CS_QUORUM1 /* always true now */
SUPPORT_PLUGIN0 /* always false now */
SUPPORT_STONITH_CONFIG0 /* always false now */
TSTAMP(x)crm_element_value(x, XML_ATTR_TSTAMP)
VALUE(x)crm_element_value(x, XML_NVPAIR_ATTR_VALUE)
XML_ATTR_TAGNAMEF_XML_TAGNAME
action_wrapper_spe_action_wrapper_s
add_cib_op_callback(cib, id, flag, data, fn)cib->cmds->register_callback(cib, id, 120, flag, data, #fn, fn)
crm_remote_peer_cache_add(h)CRM_ASSERT(crm_remote_peer_get(h) != NULL)
crm_element_value_constcrm_element_value
crm_element_value_const_intcrm_element_value_int
x = get_cib_copy(c)c->cmds->query(c, NULL, &x, cib_scope_local&#124;cib_sync_call)
is_openais_cluster()is_corosync_cluster()
is_openais_cluster()is_corosync_cluster()
no_quorum_policy_epe_quorum_policy
node_spe_node_s
node_shared_spe_node_shared_s
pcmk_err_panicCRM_EX_PANIC
resource_spe_resource_s
tag_spe_tag_s
ticket_spe_ticket_s
Structure members
Legacy usageCurrent usage
cib_api_operations_t: delete()remove()
lrmd_rsc_info_t: classstandard
lrmd_t: privatelrmd_private
pe_resource_t: effective_prioritypriority
stonith_t: privatest_private

Changes in function interfaces

  • libcrmcommon
    • The write_xml_fd() and write_xml_file() functions now consistently return -errno on error, and the number of bytes written (whether compressed or uncompressed) on success.
    • guin is now consistently used as the type for representing a milliseconds interval. The return value of crm_parse_interval_spec() (formerly crm_get_interval()) and the interval arguments of crm_action_str(), generate_op_key(), parse_op_key(), resources_action_create(), services_action_create()>, services_action_cancel(), services_action_kick(), and the lrmd_api_operations_t exec() and cancel() members now use guint instead of int or unsigned long long.
  • libcrmcluster
    • The first argument of send_cluster_text() is now enum crm_ais_msg_class rather than int (no change in usage)

Changes in structs

  • crm_client_t: event_queue member is now a GQueue* instead of GList*
  • crm_node_t: int votes member is now time_t when_lost
  • lrmd_event_data_t, svc_action_t, and crm_action_t: int interval member is now guint interval_ms
  • pe_resource_t: int remote_reconnect_interval member (in seconds) is now guint remote_reconnect_ms (in milliseconds)
  • stonith_history_t: completed member is now time_t instead of int

Exit status codes

Pacemaker daemons and command-line tools now return a well-defined set of exit status codes at the end of execution. These are defined via the crm_exit_t type (an enumeration) in crm/crm.h, with all values beginning with CRM_EX_. Related new API functions:

  • crm_errno2exit() maps a function return value to a similar exit code
  • crm_exit_name() returns a string representation of the CRM_EX_ constant name
  • crm_exit_str() returns a human-readable string describing the exit condition

The existing API functions crm_exit() and crm_help() now have arguments and/or return values of crm_exit_t, but are backward-compatible.

New deprecations

The following are deprecated in 2.0.0. They are still available in the usual headers, but will be moved to compatibility.h in a future release.

Deprecated usageNew usage
INFINITY (API symbol, not string used in user configurations)CRM_SCORE_INFINITY
INFINITY_SCRM_INFINITY_S
MINUS_INFINITY_SCRM_MINUS_INFINITY_S
crm_get_interval()crm_parse_interval_spec()
node_score_infinityCRM_SCORE_INFINITY
Last Author
kgaillot
Last Edited
Oct 31 2023, 5:51 PM