pacemaker  2.1.3-ea053b43a
Scalable High-Availability cluster resource manager
Data Structures | Macros | Typedefs | Functions
st_client.c File Reference
#include <crm_internal.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdbool.h>
#include <string.h>
#include <ctype.h>
#include <inttypes.h>
#include <sys/types.h>
#include <glib.h>
#include <crm/crm.h>
#include <crm/stonith-ng.h>
#include <crm/fencing/internal.h>
#include <crm/msg_xml.h>
#include <crm/common/mainloop.h>
#include "fencing_private.h"
Include dependency graph for st_client.c:

Go to the source code of this file.

Data Structures

struct  timer_rec_s
 

Macros

#define api_log_open()   openlog("stonith-api", LOG_CONS | LOG_NDELAY | LOG_PID, LOG_DAEMON)
 
#define api_log(level, fmt, args...)   syslog(level, "%s: "fmt, __func__, args)
 

Typedefs

typedef struct stonith_private_s stonith_private_t
 
typedef struct stonith_notify_client_s stonith_notify_client_t
 
typedef struct stonith_callback_client_s stonith_callback_client_t
 
typedef int(* stonith_op_t) (const char *, int, const char *, xmlNode *, xmlNode *, xmlNode *, xmlNode **, xmlNode **)
 

Functions

 CRM_TRACE_INIT_DATA (stonith)
 
bool stonith_dispatch (stonith_t *st)
 
xmlNode * stonith_create_op (int call_id, const char *token, const char *op, xmlNode *data, int call_options)
 
enum stonith_namespace stonith_text2namespace (const char *namespace_s)
 Get agent namespace by name. More...
 
const char * stonith_namespace2text (enum stonith_namespace st_namespace)
 Get agent namespace name. More...
 
enum stonith_namespace stonith_get_namespace (const char *agent, const char *namespace_s)
 Determine namespace of a fence agent. More...
 
gboolean stonith__watchdog_fencing_enabled_for_node_api (stonith_t *st, const char *node)
 
gboolean stonith__watchdog_fencing_enabled_for_node (const char *node)
 
xmlNode * create_device_registration_xml (const char *id, enum stonith_namespace namespace, const char *agent, stonith_key_value_t *params, const char *rsc_provides)
 
xmlNode * create_level_registration_xml (const char *node, const char *pattern, const char *attr, const char *value, int level, stonith_key_value_t *device_list)
 
void stonith_history_free (stonith_history_t *history)
 
void stonith_dump_pending_callbacks (stonith_t *stonith)
 
void stonith_api_delete (stonith_t *stonith)
 
stonith_tstonith_api_new (void)
 
int stonith_api_connect_retry (stonith_t *st, const char *name, int max_attempts)
 Make a blocking connection attempt to the fencer. More...
 
stonith_key_value_tstonith_key_value_add (stonith_key_value_t *head, const char *key, const char *value)
 
void stonith_key_value_freeall (stonith_key_value_t *head, int keys, int values)
 
int stonith_api_kick (uint32_t nodeid, const char *uname, int timeout, bool off)
 
time_t stonith_api_time (uint32_t nodeid, const char *uname, bool in_progress)
 
bool stonith_agent_exists (const char *agent, int timeout)
 
const char * stonith_action_str (const char *action)
 Turn stonith action into a more readable string. More...
 
GList * stonith__parse_targets (const char *target_spec)
 
gboolean stonith__later_succeeded (stonith_history_t *event, stonith_history_t *top_history)
 
stonith_history_tstonith__sort_history (stonith_history_t *history)
 
const char * stonith_op_state_str (enum op_state state)
 Return string equivalent of an operation state value. More...
 
stonith_history_tstonith__first_matching_event (stonith_history_t *history, bool(*matching_fn)(stonith_history_t *, void *), void *user_data)
 
bool stonith__event_state_pending (stonith_history_t *history, void *user_data)
 
bool stonith__event_state_eq (stonith_history_t *history, void *user_data)
 
bool stonith__event_state_neq (stonith_history_t *history, void *user_data)
 
void stonith__device_parameter_flags (uint32_t *device_flags, const char *device_name, xmlNode *metadata)
 
int stonith__exit_status (stonith_callback_data_t *data)
 
int stonith__execution_status (stonith_callback_data_t *data)
 
const char * stonith__exit_reason (stonith_callback_data_t *data)
 
int stonith__event_exit_status (stonith_event_t *event)
 
int stonith__event_execution_status (stonith_event_t *event)
 
const char * stonith__event_exit_reason (stonith_event_t *event)
 
char * stonith__event_description (stonith_event_t *event)
 
const char * get_stonith_provider (const char *agent, const char *provider)
 

Macro Definition Documentation

◆ api_log

#define api_log (   level,
  fmt,
  args... 
)    syslog(level, "%s: "fmt, __func__, args)

Definition at line 1906 of file st_client.c.

◆ api_log_open

#define api_log_open ( )    openlog("stonith-api", LOG_CONS | LOG_NDELAY | LOG_PID, LOG_DAEMON)

Definition at line 1905 of file st_client.c.

Typedef Documentation

◆ stonith_callback_client_t

typedef struct stonith_callback_client_s stonith_callback_client_t

◆ stonith_notify_client_t

typedef struct stonith_notify_client_s stonith_notify_client_t

◆ stonith_op_t

typedef int(* stonith_op_t) (const char *, int, const char *, xmlNode *, xmlNode *, xmlNode *, xmlNode **, xmlNode **)

Definition at line 82 of file st_client.c.

◆ stonith_private_t

typedef struct stonith_private_s stonith_private_t

Function Documentation

◆ create_device_registration_xml()

xmlNode* create_device_registration_xml ( const char *  id,
enum stonith_namespace  namespace,
const char *  agent,
stonith_key_value_t params,
const char *  rsc_provides 
)

Definition at line 293 of file st_client.c.

◆ create_level_registration_xml()

xmlNode* create_level_registration_xml ( const char *  node,
const char *  pattern,
const char *  attr,
const char *  value,
int  level,
stonith_key_value_t device_list 
)

Definition at line 413 of file st_client.c.

◆ CRM_TRACE_INIT_DATA()

CRM_TRACE_INIT_DATA ( stonith  )

◆ get_stonith_provider()

const char* get_stonith_provider ( const char *  agent,
const char *  provider 
)
Deprecated:
Use stonith_get_namespace() instead

Definition at line 2528 of file st_client.c.

◆ stonith__device_parameter_flags()

void stonith__device_parameter_flags ( uint32_t *  device_flags,
const char *  device_name,
xmlNode *  metadata 
)

Definition at line 2325 of file st_client.c.

◆ stonith__event_description()

char* stonith__event_description ( stonith_event_t event)

Definition at line 2490 of file st_client.c.

◆ stonith__event_execution_status()

int stonith__event_execution_status ( stonith_event_t event)

Definition at line 2446 of file st_client.c.

◆ stonith__event_exit_reason()

const char* stonith__event_exit_reason ( stonith_event_t event)

Definition at line 2466 of file st_client.c.

◆ stonith__event_exit_status()

int stonith__event_exit_status ( stonith_event_t event)

Definition at line 2426 of file st_client.c.

◆ stonith__event_state_eq()

bool stonith__event_state_eq ( stonith_history_t history,
void *  user_data 
)

Definition at line 2313 of file st_client.c.

◆ stonith__event_state_neq()

bool stonith__event_state_neq ( stonith_history_t history,
void *  user_data 
)

Definition at line 2319 of file st_client.c.

◆ stonith__event_state_pending()

bool stonith__event_state_pending ( stonith_history_t history,
void *  user_data 
)

Definition at line 2307 of file st_client.c.

◆ stonith__execution_status()

int stonith__execution_status ( stonith_callback_data_t data)

Definition at line 2392 of file st_client.c.

◆ stonith__exit_reason()

const char* stonith__exit_reason ( stonith_callback_data_t data)

Definition at line 2409 of file st_client.c.

◆ stonith__exit_status()

int stonith__exit_status ( stonith_callback_data_t data)

Definition at line 2375 of file st_client.c.

◆ stonith__first_matching_event()

stonith_history_t* stonith__first_matching_event ( stonith_history_t history,
bool(*)(stonith_history_t *, void *)  matching_fn,
void *  user_data 
)

Definition at line 2293 of file st_client.c.

◆ stonith__later_succeeded()

gboolean stonith__later_succeeded ( stonith_history_t event,
stonith_history_t top_history 
)

Definition at line 2194 of file st_client.c.

◆ stonith__parse_targets()

GList* stonith__parse_targets ( const char *  target_spec)

Definition at line 2154 of file st_client.c.

◆ stonith__sort_history()

stonith_history_t* stonith__sort_history ( stonith_history_t history)

Definition at line 2226 of file st_client.c.

◆ stonith__watchdog_fencing_enabled_for_node()

gboolean stonith__watchdog_fencing_enabled_for_node ( const char *  node)

Definition at line 231 of file st_client.c.

◆ stonith__watchdog_fencing_enabled_for_node_api()

gboolean stonith__watchdog_fencing_enabled_for_node_api ( stonith_t st,
const char *  node 
)

Definition at line 172 of file st_client.c.

◆ stonith_action_str()

const char* stonith_action_str ( const char *  action)

Turn stonith action into a more readable string.

Parameters
actionStonith action

Definition at line 2046 of file st_client.c.

◆ stonith_agent_exists()

bool stonith_agent_exists ( const char *  agent,
int  timeout 
)

Does the given agent describe a stonith resource that can exist?

Parameters
[in]agentWhat is the name of the agent?
[in]timeoutTimeout to use when querying. If 0 is given, use a default of 120.
Returns
A boolean

Definition at line 2015 of file st_client.c.

◆ stonith_api_connect_retry()

int stonith_api_connect_retry ( stonith_t st,
const char *  name,
int  max_attempts 
)

Make a blocking connection attempt to the fencer.

Parameters
[in,out]stFencer API object
[in]nameClient name to use with fencer
[in]max_attemptsReturn error if this many attempts fail
Returns
pcmk_ok on success, result of last attempt otherwise

Definition at line 1844 of file st_client.c.

◆ stonith_api_delete()

void stonith_api_delete ( stonith_t stonith)

Definition at line 1680 of file st_client.c.

◆ stonith_api_kick()

int stonith_api_kick ( uint32_t  nodeid,
const char *  uname,
int  timeout,
bool  off 
)

Definition at line 1909 of file st_client.c.

◆ stonith_api_new()

stonith_t* stonith_api_new ( void  )

Definition at line 1766 of file st_client.c.

◆ stonith_api_time()

time_t stonith_api_time ( uint32_t  nodeid,
const char *  uname,
bool  in_progress 
)

Definition at line 1951 of file st_client.c.

◆ stonith_create_op()

xmlNode * stonith_create_op ( int  call_id,
const char *  token,
const char *  op,
xmlNode *  data,
int  call_options 
)

Definition at line 788 of file st_client.c.

◆ stonith_dispatch()

bool stonith_dispatch ( stonith_t st)

Definition at line 1622 of file st_client.c.

◆ stonith_dump_pending_callbacks()

void stonith_dump_pending_callbacks ( stonith_t stonith)

Definition at line 1339 of file st_client.c.

◆ stonith_get_namespace()

enum stonith_namespace stonith_get_namespace ( const char *  agent,
const char *  namespace_s 
)

Determine namespace of a fence agent.

Parameters
[in]agentFence agent type
[in]namespace_sName of agent namespace as string, if known
Returns
Namespace of specified agent, as enum value

Definition at line 151 of file st_client.c.

◆ stonith_history_free()

void stonith_history_free ( stonith_history_t history)

Definition at line 741 of file st_client.c.

◆ stonith_key_value_add()

stonith_key_value_t* stonith_key_value_add ( stonith_key_value_t head,
const char *  key,
const char *  value 
)

Definition at line 1865 of file st_client.c.

◆ stonith_key_value_freeall()

void stonith_key_value_freeall ( stonith_key_value_t head,
int  keys,
int  values 
)

Definition at line 1888 of file st_client.c.

◆ stonith_namespace2text()

const char* stonith_namespace2text ( enum stonith_namespace  st_namespace)

Get agent namespace name.

Parameters
[in]namespaceNamespace as enum value
Returns
Namespace name as string

Definition at line 130 of file st_client.c.

◆ stonith_op_state_str()

const char* stonith_op_state_str ( enum op_state  state)

Return string equivalent of an operation state value.

Parameters
[in]stateFencing operation state value
Returns
Human-friendly string equivalent of state

Definition at line 2280 of file st_client.c.

◆ stonith_text2namespace()

enum stonith_namespace stonith_text2namespace ( const char *  namespace_s)

Get agent namespace by name.

Parameters
[in]namespace_sName of namespace as string
Returns
Namespace as enum value

Definition at line 104 of file st_client.c.