From 7332b914bff2786ff70ccace103fc9ebdfb61a23 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Mon, 3 Jun 2024 15:39:28 +0200 Subject: Merging upstream version 2.1.8~rc1. Signed-off-by: Daniel Baumann --- lib/common/cib.c | 100 ++++++++++++++++++++++++++++++++----------------------- 1 file changed, 58 insertions(+), 42 deletions(-) (limited to 'lib/common/cib.c') diff --git a/lib/common/cib.c b/lib/common/cib.c index fee7881..fee962b 100644 --- a/lib/common/cib.c +++ b/lib/common/cib.c @@ -1,6 +1,6 @@ /* * Original copyright 2004 International Business Machines - * Later changes copyright 2008-2023 the Pacemaker project contributors + * Later changes copyright 2008-2024 the Pacemaker project contributors * * The version control history for this file may have further details. * @@ -13,7 +13,7 @@ #include #include // xmlNode -#include +#include #include #include @@ -29,74 +29,74 @@ static struct { } cib_sections[] = { { // This first entry is also the default if a NULL is compared - XML_TAG_CIB, + PCMK_XE_CIB, NULL, - "//" XML_TAG_CIB + "//" PCMK_XE_CIB }, { - XML_CIB_TAG_STATUS, - "/" XML_TAG_CIB, - "//" XML_TAG_CIB "/" XML_CIB_TAG_STATUS + PCMK_XE_STATUS, + "/" PCMK_XE_CIB, + "//" PCMK_XE_CIB "/" PCMK_XE_STATUS }, { - XML_CIB_TAG_CONFIGURATION, - "/" XML_TAG_CIB, - "//" XML_TAG_CIB "/" XML_CIB_TAG_CONFIGURATION + PCMK_XE_CONFIGURATION, + "/" PCMK_XE_CIB, + "//" PCMK_XE_CIB "/" PCMK_XE_CONFIGURATION }, { - XML_CIB_TAG_CRMCONFIG, - "/" XML_TAG_CIB "/" XML_CIB_TAG_CONFIGURATION, - "//" XML_TAG_CIB "/" XML_CIB_TAG_CONFIGURATION "/" XML_CIB_TAG_CRMCONFIG + PCMK_XE_CRM_CONFIG, + "/" PCMK_XE_CIB "/" PCMK_XE_CONFIGURATION, + "//" PCMK_XE_CIB "/" PCMK_XE_CONFIGURATION "/" PCMK_XE_CRM_CONFIG }, { - XML_CIB_TAG_NODES, - "/" XML_TAG_CIB "/" XML_CIB_TAG_CONFIGURATION, - "//" XML_TAG_CIB "/" XML_CIB_TAG_CONFIGURATION "/" XML_CIB_TAG_NODES + PCMK_XE_NODES, + "/" PCMK_XE_CIB "/" PCMK_XE_CONFIGURATION, + "//" PCMK_XE_CIB "/" PCMK_XE_CONFIGURATION "/" PCMK_XE_NODES }, { - XML_CIB_TAG_RESOURCES, - "/" XML_TAG_CIB "/" XML_CIB_TAG_CONFIGURATION, - "//" XML_TAG_CIB "/" XML_CIB_TAG_CONFIGURATION "/" XML_CIB_TAG_RESOURCES + PCMK_XE_RESOURCES, + "/" PCMK_XE_CIB "/" PCMK_XE_CONFIGURATION, + "//" PCMK_XE_CIB "/" PCMK_XE_CONFIGURATION "/" PCMK_XE_RESOURCES }, { - XML_CIB_TAG_CONSTRAINTS, - "/" XML_TAG_CIB "/" XML_CIB_TAG_CONFIGURATION, - "//" XML_TAG_CIB "/" XML_CIB_TAG_CONFIGURATION "/" XML_CIB_TAG_CONSTRAINTS + PCMK_XE_CONSTRAINTS, + "/" PCMK_XE_CIB "/" PCMK_XE_CONFIGURATION, + "//" PCMK_XE_CIB "/" PCMK_XE_CONFIGURATION "/" PCMK_XE_CONSTRAINTS }, { - XML_CIB_TAG_OPCONFIG, - "/" XML_TAG_CIB "/" XML_CIB_TAG_CONFIGURATION, - "//" XML_TAG_CIB "/" XML_CIB_TAG_CONFIGURATION "/" XML_CIB_TAG_OPCONFIG + PCMK_XE_OP_DEFAULTS, + "/" PCMK_XE_CIB "/" PCMK_XE_CONFIGURATION, + "//" PCMK_XE_CIB "/" PCMK_XE_CONFIGURATION "/" PCMK_XE_OP_DEFAULTS }, { - XML_CIB_TAG_RSCCONFIG, - "/" XML_TAG_CIB "/" XML_CIB_TAG_CONFIGURATION, - "//" XML_TAG_CIB "/" XML_CIB_TAG_CONFIGURATION "/" XML_CIB_TAG_RSCCONFIG + PCMK_XE_RSC_DEFAULTS, + "/" PCMK_XE_CIB "/" PCMK_XE_CONFIGURATION, + "//" PCMK_XE_CIB "/" PCMK_XE_CONFIGURATION "/" PCMK_XE_RSC_DEFAULTS }, { - XML_CIB_TAG_ACLS, - "/" XML_TAG_CIB "/" XML_CIB_TAG_CONFIGURATION, - "//" XML_TAG_CIB "/" XML_CIB_TAG_CONFIGURATION "/" XML_CIB_TAG_ACLS + PCMK_XE_ACLS, + "/" PCMK_XE_CIB "/" PCMK_XE_CONFIGURATION, + "//" PCMK_XE_CIB "/" PCMK_XE_CONFIGURATION "/" PCMK_XE_ACLS }, { - XML_TAG_FENCING_TOPOLOGY, - "/" XML_TAG_CIB "/" XML_CIB_TAG_CONFIGURATION, - "//" XML_TAG_CIB "/" XML_CIB_TAG_CONFIGURATION "/" XML_TAG_FENCING_TOPOLOGY + PCMK_XE_FENCING_TOPOLOGY, + "/" PCMK_XE_CIB "/" PCMK_XE_CONFIGURATION, + "//" PCMK_XE_CIB "/" PCMK_XE_CONFIGURATION "/" PCMK_XE_FENCING_TOPOLOGY }, { - XML_CIB_TAG_TAGS, - "/" XML_TAG_CIB "/" XML_CIB_TAG_CONFIGURATION, - "//" XML_TAG_CIB "/" XML_CIB_TAG_CONFIGURATION "/" XML_CIB_TAG_TAGS + PCMK_XE_TAGS, + "/" PCMK_XE_CIB "/" PCMK_XE_CONFIGURATION, + "//" PCMK_XE_CIB "/" PCMK_XE_CONFIGURATION "/" PCMK_XE_TAGS }, { - XML_CIB_TAG_ALERTS, - "/" XML_TAG_CIB "/" XML_CIB_TAG_CONFIGURATION, - "//" XML_TAG_CIB "/" XML_CIB_TAG_CONFIGURATION "/" XML_CIB_TAG_ALERTS + PCMK_XE_ALERTS, + "/" PCMK_XE_CIB "/" PCMK_XE_CONFIGURATION, + "//" PCMK_XE_CIB "/" PCMK_XE_CONFIGURATION "/" PCMK_XE_ALERTS }, { - XML_CIB_TAG_SECTION_ALL, + PCMK__XE_ALL, NULL, - "//" XML_TAG_CIB + "//" PCMK_XE_CIB }, }; @@ -173,3 +173,19 @@ pcmk_find_cib_element(xmlNode *cib, const char *element_name) { return get_xpath_object(pcmk_cib_xpath_for(element_name), cib, LOG_TRACE); } + +/*! + * \internal + * \brief Check that the feature set in the CIB is supported on this node + * + * \param[in] new_version PCMK_XA_CRM_FEATURE_SET attribute from the CIB + */ +int +pcmk__check_feature_set(const char *cib_version) +{ + if (cib_version && compare_version(cib_version, CRM_FEATURE_SET) > 0) { + return EPROTONOSUPPORT; + } + + return pcmk_rc_ok; +} -- cgit v1.2.3