25 #define RH_STONITH_PREFIX "fence_"    41     struct dirent **namelist;
    44 #if _POSIX_C_SOURCE < 200809L && !(defined(O_SEARCH) || defined(O_PATH))    45     char buffer[FILENAME_MAX + 1];
    46 #elif defined(O_SEARCH)    52     for (i = 0; i < file_num; i++) {
    56 #if _POSIX_C_SOURCE < 200809L && !(defined(O_SEARCH) || defined(O_PATH))    59             if (stat(buffer, &prop) == 0 && S_ISREG(prop.st_mode)) {
    63                     crm_notice(
"Problem with listing %s directory "    72             if (fstatat(dirfd, namelist[i]->d_name, &prop, 0) == 0
    73                     && S_ISREG(prop.st_mode)) {
    85 #if _POSIX_C_SOURCE >= 200809L || defined(O_SEARCH) || defined(O_PATH)    94 stonith_rhcs_parameter_not_required(xmlNode *metadata, 
const char *parameter)
    97     xmlXPathObject *xpathObj = NULL;
   107     if (numXpathResults(xpathObj) > 0) {
   124 stonith__rhcs_get_metadata(
const char *agent, 
int timeout_sec,
   128     xmlNode *actions = NULL;
   129     xmlXPathObject *xpathObj = NULL;
   132                                                       NULL, 0, timeout_sec,
   139             crm_warn(
"Could not execute metadata action for %s: %s "   147         crm_warn(
"Could not execute metadata action for %s: %s",
   154     if (!pcmk__result_ok(
result)) {
   155         crm_warn(
"Metadata action for %s returned error code %d",
   163         crm_warn(
"Metadata action for %s returned no data", agent);
   172         crm_warn(
"Metadata for %s is invalid", agent);
   177     if (numXpathResults(xpathObj) > 0) {
   186     if (numXpathResults(xpathObj) <= 0) {
   188         const char *timeout_str = NULL;
   203     stonith_rhcs_parameter_not_required(xml, 
"action");
   204     stonith_rhcs_parameter_not_required(xml, 
"plug");
   205     stonith_rhcs_parameter_not_required(xml, 
"port");
   227     GString *buffer = NULL;
   230     int rc = stonith__rhcs_get_metadata(agent, timeout_sec, &xml);
   236     buffer = g_string_sized_new(1024);
   239     if (pcmk__str_empty(buffer->str)) {
   244     if (output != NULL) {
   249     if (buffer != NULL) {
   250         g_string_free(buffer, TRUE);
   261     int rc = stat(buffer, &prop);
   264     return (rc >= 0) && S_ISREG(prop.st_mode);
   269                        const char *agent, GHashTable *params,
   270                        const char * host_arg, 
int timeout,
   271                        char **output, 
char **error_output)
   274     int remaining_timeout = 
timeout;
   275     xmlNode *metadata = NULL;
   279     if (host_arg == NULL) {
   280         time_t start_time = time(NULL);
   282         rc = stonith__rhcs_get_metadata(agent, remaining_timeout, &metadata);
   285             uint32_t device_flags = 0;
   299         remaining_timeout -= time(NULL) - start_time;
   301         if (rc == -
ETIME || remaining_timeout <= 0 ) {
   310                                     remaining_timeout, params, NULL, host_arg);
   319         if (output != NULL) {
   323         if (error_output != NULL) {
 void stonith__destroy_action(stonith_action_t *action)
 
#define CRM_CHECK(expr, failure_action)
 
struct stonith_action_s stonith_action_t
 
#define pcmk_err_schema_validation
 
#define crm_notice(fmt, args...)
 
bool stonith__agent_is_rhcs(const char *agent)
 
const char * pcmk_strerror(int rc)
 
#define PCMK__FENCE_BINDIR
 
int pcmk_rc2legacy(int rc)
 
void pcmk__xml_string(const xmlNode *data, uint32_t options, GString *buffer, int depth)
 
int stonith__result2rc(const pcmk__action_result_t *result)
 
enum pcmk_exec_status execution_status
 
const char * crm_xml_add(xmlNode *node, const char *name, const char *value)
Create an XML attribute with specified name and value. 
 
int stonith__rhcs_validate(stonith_t *st, int call_options, const char *target, const char *agent, GHashTable *params, const char *host_arg, int timeout, char **output, char **error_output)
 
Include indentation and newlines. 
 
stonith_key_value_t * stonith_key_value_add(stonith_key_value_t *kvp, const char *key, const char *value)
 
#define PCMK_DEFAULT_ACTION_TIMEOUT_MS
Default timeout (in milliseconds) for non-metadata actions. 
 
#define crm_warn(fmt, args...)
 
void stonith__device_parameter_flags(uint32_t *device_flags, const char *device_name, xmlNode *metadata)
 
pcmk__action_result_t * stonith__action_result(stonith_action_t *action)
 
#define PCMK_XE_PARAMETER
 
char * crm_strdup_printf(char const *format,...) G_GNUC_PRINTF(1
 
#define pcmk_is_set(g, f)
Convenience alias for pcmk_all_flags_set(), to check single flag. 
 
#define PCMK_ACTION_START
 
void pcmk__str_update(char **str, const char *value)
 
Wrappers for and extensions to libxml2. 
 
Action completed, result is known. 
 
void free_xml(xmlNode *child)
 
xmlNode * pcmk__xml_parse(const char *input)
 
#define PCMK_META_TIMEOUT
 
xmlXPathObjectPtr xpath_search(const xmlNode *xml_top, const char *path)
 
#define RH_STONITH_PREFIX
 
pcmk__action_result_t result
 
int stonith__list_rhcs_agents(stonith_key_value_t **devices)
 
xmlNode * getXpathResult(xmlXPathObjectPtr xpathObj, int index)
 
#define PCMK_ACTION_METADATA
 
stonith_action_t * stonith__action_create(const char *agent, const char *action_name, const char *target, uint32_t target_nodeid, int timeout_sec, GHashTable *device_args, GHashTable *port_map, const char *host_arg)
 
int stonith__rhcs_metadata(const char *agent, int timeout_sec, char **output)
Retrieve metadata for RHCS-compatible fence agent. 
 
#define PCMK_ACTION_VALIDATE_ALL
 
const char * pcmk__readable_interval(guint interval_ms)
 
bool pcmk__starts_with(const char *str, const char *prefix)
Check whether a string starts with a certain sequence. 
 
xmlNode * pcmk__xe_create(xmlNode *parent, const char *name)
 
void freeXpathObject(xmlXPathObjectPtr xpathObj)
 
G_GNUC_INTERNAL int stonith__execute(stonith_action_t *action)