Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP5:Update
pacemaker.26126
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-1.1.patch of Package pacemaker.26126
From ba237e5cb654019c08beac384da4c0e89f5a2bd5 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/9] 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(-) diff --git a/fencing/internal.h b/fencing/internal.h index 16b0c33dc..f28849ae9 100644 --- a/fencing/internal.h +++ b/fencing/internal.h @@ -12,13 +12,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; diff --git a/include/crm/fencing/internal.h b/include/crm/fencing/internal.h index 264e0d187..599a6bff1 100644 --- a/include/crm/fencing/internal.h +++ b/include/crm/fencing/internal.h @@ -11,6 +11,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; @@ -44,6 +53,8 @@ xmlNode *create_device_registration_xml(const char *id, 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" diff --git a/lib/fencing/st_client.c b/lib/fencing/st_client.c index 3a1824285..2180e9211 100644 --- a/lib/fencing/st_client.c +++ b/lib/fencing/st_client.c @@ -2414,3 +2414,45 @@ stonith_api_time(uint32_t nodeid, const char *uname, bool in_progress) free(name); return when; } + +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; +} -- 2.26.1
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