Page MenuHomeClusterLabs Projects

Update SBD to avoid deprecated Pacemaker APIs
Open, HighPublic

Assigned To
None
Authored By
kgaillot
Mar 27 2024, 6:28 PM
Tags
  • Restricted Project
  • Restricted Project
Referenced Files
None
Subscribers

Description

See subtasks, plus:

  • configure.ac does AC_CHECK_LIB(pe_rules, test_rule, , missing="yes") but test_rule() (and all of libpe_rules) is now deprecated; note that SBD doesn't actually use anything from or link with libpe_rules, so this can just be dropped
  • sbd-cluster.c uses the existence of CRM_SCORE_INFINITY to decide when to use the pacemaker-remote binary name; the constant is deprecated in favor of PCMK_SCORE_INFINITY, so test for either
  • sbd-inquisitor.c depends on transitive inclusion of limits.h (as does sbd.h), libxml/tree.h, and glib.h via Pacemaker headers; include them explicitly
  • sbd-pacemaker.c
    • uses the deprecated GListPtr type; use GList * instead
    • uses the deprecated XML_TAG_CIB constant; use PCMK_XE_CIB instead when available
    • uses the deprecated is_set() macro; use pcmk_is_set() instead when available
    • uses the deprecated copy_xml() function; no replacement will be made available, so redefine it per Pacemaker 2.1.7
  • From crm/cluster.h (see T788), sbd uses:
    • enum cluster_type_e with values pcmk_cluster_unknown and pcmk_cluster_corosync; the enum and values were renamed
    • crm_cluster_t, which was renamed pcmk_cluster_t; direct access to the destroy and cpg.cpg_callbacks_t members has been deprecated in favor of new accessor functions
    • get_cluster_type(), name_for_cluster_type(), and crm_cluster_connect(), which were renamed
    • configure.ac does AC_CHECK_LIB(crmcluster, crm_peer_init, , missing="yes") but doesn't actually use crm_peer_init(), which is deprecated; no name will be present in libcrmcluster in all Pacemaker versions, so check for a new API, and if unavailable, check for an old one (get_cluster_type() would be better since SBD actually uses it)
  • SBD uses a lot of deprecated scheduler APIs
    • configure.ac checks for enum pe_quorum_policy policy with a value of no_quorum_demote, and the code additionally uses other values; all those values are deprecated in favor of names with a pcmk_ prefix, so check for both old and new names
    • The resource struct was refactored (see T790); sbd uses the deprecated resource_t type alias (use pcmk_resource_t instead when available), and directly accesses the id and flags members (use the new accessors instead when available)
    • The node structs were refactored (see T789); sbd uses the deprecated node_t type alias (use pcmk_node_t instead when available), and directly accesses multiple members (use the new accessors instead when available)
    • The main scheduler struct was refactored (see T791); sbd uses the deprecated pe_working_set_t type alias (use pcmk_scheduler_t instead when available), and directly accesses multiple members (use the new accessors instead when available)
    • Replace pe_reset_working_set() with pcmk_reset_scheduler() when available
    • Replace pe_new_working_set() with pcmk_new_scheduler() when available
    • Replace pe_free_working_set() with pcmk_free_scheduler() when available

Existing SBD versions should continue to build with Pacemaker 3.0.0, but the code should be updated as soon as practical to continue to build with future Pacemaker versions.

Once a released version of sbd has these changes, update the deprecated API comments in the pacemaker code base like // NOTE: sbd (as of at least 1.5.2) uses this to something like // NOTE: sbd before version X.Y.Z uses this. After platforms with the older versions are no longer supported, pacemaker can drop those deprecated APIs.

Event Timeline

kgaillot triaged this task as Normal priority.Mar 27 2024, 6:28 PM
kgaillot created this task.
kgaillot created this object with edit policy "Restricted Project (Project)".
kgaillot added a subtask: Restricted Maniphest Task.

From crm/cluster.h, sbd uses send_cluster_text() and crm_msg_ais but only if HAVE_DECL_PCMK_CLUSTER_CLASSIC_AIS

kgaillot changed the status of subtask T790: Deprecate direct access to scheduler resource structs from Merged to Released.
kgaillot changed the status of subtask T789: Deprecate direct access to scheduler node structs from Merged to Released.
kgaillot changed the status of subtask T788: Deprecate public API access to most of libcrmcluster from Merged to Released.
kgaillot updated the task description. (Show Details)
kgaillot raised the priority of this task from Normal to High.Mon, Jan 6, 11:34 AM
kgaillot updated the task description. (Show Details)