Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-15-SP1:GA
pacemaker.16898
bsc#1171372-0005-Refactor-libstonithd-add-funct...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File bsc#1171372-0005-Refactor-libstonithd-add-function-to-check-supported.patch of Package pacemaker.16898
From 13c73cd447b39f5eb6deef9aa46b08a6f035729a Mon Sep 17 00:00:00 2001 From: "Gao,Yan" <ygao@suse.com> Date: Wed, 6 May 2020 19:17:28 +0200 Subject: [PATCH 5/6] Refactor: libstonithd: add function to check supported parameters according to the metadata of a fence agent --- fencing/internal.h | 7 ------ include/crm/fencing/internal.h | 11 ++++++++ lib/fencing/st_client.c | 42 +++++++++++++++++++++++++++++++ 3 files changed, 53 insertions(+), 7 deletions(-) Index: pacemaker-1.1.18+20180430.b12c320f5/fencing/internal.h =================================================================== --- pacemaker-1.1.18+20180430.b12c320f5.orig/fencing/internal.h +++ pacemaker-1.1.18+20180430.b12c320f5/fencing/internal.h @@ -19,13 +19,6 @@ */ gboolean stonith_check_fence_tolerance(int tolerance, const char *target, const char *action); -enum st_device_flags -{ - st_device_supports_list = 0x0001, - st_device_supports_status = 0x0002, - st_device_supports_reboot = 0x0004, -}; - typedef struct stonith_device_s { char *id; char *agent; Index: pacemaker-1.1.18+20180430.b12c320f5/include/crm/fencing/internal.h =================================================================== --- pacemaker-1.1.18+20180430.b12c320f5.orig/include/crm/fencing/internal.h +++ pacemaker-1.1.18+20180430.b12c320f5/include/crm/fencing/internal.h @@ -21,6 +21,15 @@ # include <crm/common/ipc.h> # include <crm/common/xml.h> +enum st_device_flags +{ + st_device_supports_list = 0x0001, + st_device_supports_status = 0x0002, + st_device_supports_reboot = 0x0004, + st_device_supports_parameter_plug = 0x0008, + st_device_supports_parameter_port = 0x0010, +}; + struct stonith_action_s; typedef struct stonith_action_s stonith_action_t; @@ -50,6 +59,8 @@ xmlNode *create_level_registration_xml(c xmlNode *create_device_registration_xml(const char *id, const char *namespace, const char *agent, stonith_key_value_t * params, const char *rsc_provides); +long long stonith__device_parameter_flags(xmlNode *metadata); + # define ST_LEVEL_MAX 10 # define F_STONITH_CLIENTID "st_clientid" Index: pacemaker-1.1.18+20180430.b12c320f5/lib/fencing/st_client.c =================================================================== --- pacemaker-1.1.18+20180430.b12c320f5.orig/lib/fencing/st_client.c +++ pacemaker-1.1.18+20180430.b12c320f5/lib/fencing/st_client.c @@ -2616,3 +2616,45 @@ i_hate_pils(int rc) return PIL_strerror(rc); } #endif + +long long +stonith__device_parameter_flags(xmlNode *metadata) +{ + xmlXPathObjectPtr xpath = NULL; + int max = 0; + int lpc = 0; + long long flags = 0; + + CRM_CHECK(metadata, return 0); + + xpath = xpath_search(metadata, "//parameter"); + max = numXpathResults(xpath); + + if (max <= 0) { + freeXpathObject(xpath); + return 0; + } + + for (lpc = 0; lpc < max; lpc++) { + const char *parameter = NULL; + xmlNode *match = getXpathResult(xpath, lpc); + + CRM_LOG_ASSERT(match != NULL); + if (match == NULL) { + continue; + } + + parameter = crm_element_value(match, "name"); + + if (safe_str_eq(parameter, "plug")) { + set_bit(flags, st_device_supports_parameter_plug); + + } else if (safe_str_eq(parameter, "port")) { + set_bit(flags, st_device_supports_parameter_port); + } + } + + freeXpathObject(xpath); + + return flags; +}
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor