pacemaker  2.1.8-3980678f03
Scalable High-Availability cluster resource manager
Data Structures | Macros | Typedefs | Enumerations | Functions
lrmd.h File Reference

Resource agent executor. More...

#include <stdbool.h>
#include <glib.h>
#include <crm_config.h>
#include <crm/lrmd_events.h>
#include <crm/services.h>
#include <crm/lrmd_compat.h>
Include dependency graph for lrmd.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  lrmd_key_value_s
 
struct  lrmd_rsc_info_s
 
struct  lrmd_op_info_s
 
struct  lrmd_list_s
 
struct  lrmd_api_operations_s
 
struct  lrmd_s
 

Macros

#define LRMD_PROTOCOL_VERSION   "1.2"
 
#define LRMD_SUPPORTS_SCHEMA_XFER(x)   (compare_version((x), "1.2") >= 0)
 
#define LRMD_COMPATIBLE_PROTOCOL   "1"
 
#define LRMD_MIN_PROTOCOL_VERSION   "1.0"
 
#define DEFAULT_REMOTE_KEY_LOCATION   PACEMAKER_CONFIG_DIR "/authkey"
 
#define ALT_REMOTE_KEY_LOCATION   "/etc/corosync/authkey"
 
#define DEFAULT_REMOTE_PORT   3121
 
#define DEFAULT_REMOTE_USERNAME   "lrmd"
 
#define LRMD_OP_RSC_REG   "lrmd_rsc_register"
 
#define LRMD_OP_RSC_EXEC   "lrmd_rsc_exec"
 
#define LRMD_OP_RSC_CANCEL   "lrmd_rsc_cancel"
 
#define LRMD_OP_RSC_UNREG   "lrmd_rsc_unregister"
 
#define LRMD_OP_RSC_INFO   "lrmd_rsc_info"
 
#define LRMD_OP_RSC_METADATA   "lrmd_rsc_metadata"
 
#define LRMD_OP_POKE   "lrmd_rsc_poke"
 
#define LRMD_OP_NEW_CLIENT   "lrmd_rsc_new_client"
 
#define LRMD_OP_CHECK   "lrmd_check"
 
#define LRMD_OP_ALERT_EXEC   "lrmd_alert_exec"
 
#define LRMD_OP_GET_RECURRING   "lrmd_get_recurring"
 
#define LRMD_IPC_OP_NEW   "new"
 
#define LRMD_IPC_OP_DESTROY   "destroy"
 
#define LRMD_IPC_OP_EVENT   "event"
 
#define LRMD_IPC_OP_REQUEST   "request"
 
#define LRMD_IPC_OP_RESPONSE   "response"
 
#define LRMD_IPC_OP_SHUTDOWN_REQ   "shutdown_req"
 
#define LRMD_IPC_OP_SHUTDOWN_ACK   "shutdown_ack"
 
#define LRMD_IPC_OP_SHUTDOWN_NACK   "shutdown_nack"
 

Typedefs

typedef struct lrmd_s lrmd_t
 
typedef struct lrmd_key_value_s lrmd_key_value_t
 
typedef struct lrmd_rsc_info_s lrmd_rsc_info_t
 
typedef struct lrmd_op_info_s lrmd_op_info_t
 
typedef void(* lrmd_event_callback) (lrmd_event_data_t *event)
 
typedef struct lrmd_list_s lrmd_list_t
 
typedef struct lrmd_api_operations_s lrmd_api_operations_t
 

Enumerations

enum  lrmd_call_options { lrmd_opt_none = 0, lrmd_opt_notify_orig_only = (1 << 1), lrmd_opt_drop_recurring = 0x00000003, lrmd_opt_notify_changes_only = (1 << 2) }
 

Functions

lrmd_tlrmd_api_new (void)
 Create a new connection to the local executor. More...
 
lrmd_tlrmd_remote_api_new (const char *nodename, const char *server, int port)
 Create a new TLS connection to a remote executor. More...
 
bool lrmd_dispatch (lrmd_t *lrmd)
 Use after lrmd_poll returns 1 to read and dispatch a message. More...
 
int lrmd_poll (lrmd_t *lrmd, int timeout)
 Check whether a message is available on an executor connection. More...
 
void lrmd_api_delete (lrmd_t *lrmd)
 Destroy executor connection object. More...
 
lrmd_key_value_tlrmd_key_value_add (lrmd_key_value_t *kvp, const char *key, const char *value)
 
lrmd_rsc_info_tlrmd_new_rsc_info (const char *rsc_id, const char *standard, const char *provider, const char *type)
 
lrmd_rsc_info_tlrmd_copy_rsc_info (lrmd_rsc_info_t *rsc_info)
 
void lrmd_free_rsc_info (lrmd_rsc_info_t *rsc_info)
 
void lrmd_free_op_info (lrmd_op_info_t *op_info)
 
void lrmd_list_freeall (lrmd_list_t *head)
 
void lrmd_key_value_freeall (lrmd_key_value_t *head)
 

Detailed Description

Resource agent executor.

Definition in file lrmd.h.

Macro Definition Documentation

◆ ALT_REMOTE_KEY_LOCATION

#define ALT_REMOTE_KEY_LOCATION   "/etc/corosync/authkey"

Definition at line 66 of file lrmd.h.

◆ DEFAULT_REMOTE_KEY_LOCATION

#define DEFAULT_REMOTE_KEY_LOCATION   PACEMAKER_CONFIG_DIR "/authkey"

Definition at line 65 of file lrmd.h.

◆ DEFAULT_REMOTE_PORT

#define DEFAULT_REMOTE_PORT   3121

Definition at line 67 of file lrmd.h.

◆ DEFAULT_REMOTE_USERNAME

#define DEFAULT_REMOTE_USERNAME   "lrmd"

Definition at line 68 of file lrmd.h.

◆ LRMD_COMPATIBLE_PROTOCOL

#define LRMD_COMPATIBLE_PROTOCOL   "1"

Definition at line 52 of file lrmd.h.

◆ LRMD_IPC_OP_DESTROY

#define LRMD_IPC_OP_DESTROY   "destroy"

Definition at line 83 of file lrmd.h.

◆ LRMD_IPC_OP_EVENT

#define LRMD_IPC_OP_EVENT   "event"

Definition at line 84 of file lrmd.h.

◆ LRMD_IPC_OP_NEW

#define LRMD_IPC_OP_NEW   "new"

Definition at line 82 of file lrmd.h.

◆ LRMD_IPC_OP_REQUEST

#define LRMD_IPC_OP_REQUEST   "request"

Definition at line 85 of file lrmd.h.

◆ LRMD_IPC_OP_RESPONSE

#define LRMD_IPC_OP_RESPONSE   "response"

Definition at line 86 of file lrmd.h.

◆ LRMD_IPC_OP_SHUTDOWN_ACK

#define LRMD_IPC_OP_SHUTDOWN_ACK   "shutdown_ack"

Definition at line 88 of file lrmd.h.

◆ LRMD_IPC_OP_SHUTDOWN_NACK

#define LRMD_IPC_OP_SHUTDOWN_NACK   "shutdown_nack"

Definition at line 89 of file lrmd.h.

◆ LRMD_IPC_OP_SHUTDOWN_REQ

#define LRMD_IPC_OP_SHUTDOWN_REQ   "shutdown_req"

Definition at line 87 of file lrmd.h.

◆ LRMD_MIN_PROTOCOL_VERSION

#define LRMD_MIN_PROTOCOL_VERSION   "1.0"

Definition at line 62 of file lrmd.h.

◆ LRMD_OP_ALERT_EXEC

#define LRMD_OP_ALERT_EXEC   "lrmd_alert_exec"

Definition at line 79 of file lrmd.h.

◆ LRMD_OP_CHECK

#define LRMD_OP_CHECK   "lrmd_check"

Definition at line 78 of file lrmd.h.

◆ LRMD_OP_GET_RECURRING

#define LRMD_OP_GET_RECURRING   "lrmd_get_recurring"

Definition at line 80 of file lrmd.h.

◆ LRMD_OP_NEW_CLIENT

#define LRMD_OP_NEW_CLIENT   "lrmd_rsc_new_client"

Definition at line 77 of file lrmd.h.

◆ LRMD_OP_POKE

#define LRMD_OP_POKE   "lrmd_rsc_poke"

Definition at line 76 of file lrmd.h.

◆ LRMD_OP_RSC_CANCEL

#define LRMD_OP_RSC_CANCEL   "lrmd_rsc_cancel"

Definition at line 72 of file lrmd.h.

◆ LRMD_OP_RSC_EXEC

#define LRMD_OP_RSC_EXEC   "lrmd_rsc_exec"

Definition at line 71 of file lrmd.h.

◆ LRMD_OP_RSC_INFO

#define LRMD_OP_RSC_INFO   "lrmd_rsc_info"

Definition at line 74 of file lrmd.h.

◆ LRMD_OP_RSC_METADATA

#define LRMD_OP_RSC_METADATA   "lrmd_rsc_metadata"

Definition at line 75 of file lrmd.h.

◆ LRMD_OP_RSC_REG

#define LRMD_OP_RSC_REG   "lrmd_rsc_register"

Definition at line 70 of file lrmd.h.

◆ LRMD_OP_RSC_UNREG

#define LRMD_OP_RSC_UNREG   "lrmd_rsc_unregister"

Definition at line 73 of file lrmd.h.

◆ LRMD_PROTOCOL_VERSION

#define LRMD_PROTOCOL_VERSION   "1.2"

Definition at line 44 of file lrmd.h.

◆ LRMD_SUPPORTS_SCHEMA_XFER

#define LRMD_SUPPORTS_SCHEMA_XFER (   x)    (compare_version((x), "1.2") >= 0)

Definition at line 46 of file lrmd.h.

Typedef Documentation

◆ lrmd_api_operations_t

◆ lrmd_event_callback

typedef void(* lrmd_event_callback) (lrmd_event_data_t *event)

Definition at line 187 of file lrmd.h.

◆ lrmd_key_value_t

◆ lrmd_list_t

typedef struct lrmd_list_s lrmd_list_t

◆ lrmd_op_info_t

◆ lrmd_rsc_info_t

◆ lrmd_t

typedef struct lrmd_s lrmd_t

Definition at line 29 of file lrmd.h.

Enumeration Type Documentation

◆ lrmd_call_options

Enumerator
lrmd_opt_none 
lrmd_opt_notify_orig_only 

Notify only the client that made the request (rather than all clients)

lrmd_opt_drop_recurring 

Drop recurring operations initiated by a client when the client disconnects. This option is only valid when registering a resource. When used with a connection to a remote executor, recurring operations will be dropped once all remote connections disconnect.

This is broken, because these values should be unique bits, and this value overlaps lrmd_opt_notify_orig_only (0x02). The impact is low since this value is used only with registration requests and the other one is used only with execution requests. Regardless, when we can break API compatibility, this should be changed to (1 << 0) or (1 << 3).

lrmd_opt_notify_changes_only 

Send notifications for recurring operations only when the result changes.

Definition at line 143 of file lrmd.h.

Function Documentation

◆ lrmd_api_delete()

void lrmd_api_delete ( lrmd_t lrmd)

Destroy executor connection object.

Parameters
[in,out]lrmdExecutor connection object to destroy

Definition at line 2409 of file lrmd_client.c.

◆ lrmd_api_new()

lrmd_t* lrmd_api_new ( void  )

Create a new connection to the local executor.

Definition at line 2391 of file lrmd_client.c.

◆ lrmd_copy_rsc_info()

lrmd_rsc_info_t* lrmd_copy_rsc_info ( lrmd_rsc_info_t rsc_info)

Definition at line 1820 of file lrmd_client.c.

◆ lrmd_dispatch()

bool lrmd_dispatch ( lrmd_t lrmd)

Use after lrmd_poll returns 1 to read and dispatch a message.

Parameters
[in,out]lrmdExecutor connection object
Returns
TRUE if connection is still up, FALSE if disconnected

Definition at line 504 of file lrmd_client.c.

◆ lrmd_free_op_info()

void lrmd_free_op_info ( lrmd_op_info_t op_info)

Definition at line 1877 of file lrmd_client.c.

◆ lrmd_free_rsc_info()

void lrmd_free_rsc_info ( lrmd_rsc_info_t rsc_info)

Definition at line 1827 of file lrmd_client.c.

◆ lrmd_key_value_add()

lrmd_key_value_t* lrmd_key_value_add ( lrmd_key_value_t kvp,
const char *  key,
const char *  value 
)

Definition at line 148 of file lrmd_client.c.

◆ lrmd_key_value_freeall()

void lrmd_key_value_freeall ( lrmd_key_value_t head)

Definition at line 171 of file lrmd_client.c.

◆ lrmd_list_freeall()

void lrmd_list_freeall ( lrmd_list_t head)

Definition at line 133 of file lrmd_client.c.

◆ lrmd_new_rsc_info()

lrmd_rsc_info_t* lrmd_new_rsc_info ( const char *  rsc_id,
const char *  standard,
const char *  provider,
const char *  type 
)

Definition at line 1807 of file lrmd_client.c.

◆ lrmd_poll()

int lrmd_poll ( lrmd_t lrmd,
int  timeout 
)

Check whether a message is available on an executor connection.

Parameters
[in,out]lrmdExecutor connection object to check
[in]timeoutCurrently ignored
Return values
1Message is ready
0Timeout occurred
negativeerrno Error occurred
Note
This is intended for callers that do not use a main loop.

Definition at line 470 of file lrmd_client.c.

◆ lrmd_remote_api_new()

lrmd_t* lrmd_remote_api_new ( const char *  nodename,
const char *  server,
int  port 
)

Create a new TLS connection to a remote executor.

Parameters
[in]nodenameName of remote node identified with this connection
[in]serverHostname to connect to
[in]portPort number to connect to (or 0 to use default)
Returns
Newly created executor connection object
Note
If only one of nodename and server is non-NULL, it will be used for both purposes. If both are NULL, a local IPC connection will be created instead.

Definition at line 2400 of file lrmd_client.c.