pacemaker  1.1.12-561c4cf
Scalable High-Availability cluster resource manager
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
Data Structures | Macros | Typedefs | Enumerations | Functions
services.h File Reference

Services API. More...

#include <glib.h>
#include <stdio.h>
#include <string.h>
Include dependency graph for services.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  svc_action_s
 

Macros

#define OCF_ROOT_DIR   "/usr/lib/ocf"
 
#define LSB_ROOT_DIR   "/etc/init.d"
 
#define SYSTEMCTL   "/bin/systemctl"
 
#define SERVICE_SCRIPT   "/sbin/service"
 

Typedefs

typedef struct svc_action_private_s svc_action_private_t
 
typedef struct svc_action_s svc_action_t
 

Enumerations

enum  lsb_exitcode {
  PCMK_LSB_OK = 0, PCMK_LSB_UNKNOWN_ERROR = 1, PCMK_LSB_INVALID_PARAM = 2, PCMK_LSB_UNIMPLEMENT_FEATURE = 3,
  PCMK_LSB_INSUFFICIENT_PRIV = 4, PCMK_LSB_NOT_INSTALLED = 5, PCMK_LSB_NOT_CONFIGURED = 6, PCMK_LSB_NOT_RUNNING = 7
}
 
enum  lsb_status_exitcode {
  PCMK_LSB_STATUS_OK = 0, PCMK_LSB_STATUS_VAR_PID = 1, PCMK_LSB_STATUS_VAR_LOCK = 2, PCMK_LSB_STATUS_NOT_RUNNING = 3,
  PCMK_LSB_STATUS_NOT_INSTALLED = 4
}
 
enum  ocf_exitcode {
  PCMK_OCF_OK = 0, PCMK_OCF_UNKNOWN_ERROR = 1, PCMK_OCF_INVALID_PARAM = 2, PCMK_OCF_UNIMPLEMENT_FEATURE = 3,
  PCMK_OCF_INSUFFICIENT_PRIV = 4, PCMK_OCF_NOT_INSTALLED = 5, PCMK_OCF_NOT_CONFIGURED = 6, PCMK_OCF_NOT_RUNNING = 7,
  PCMK_OCF_RUNNING_MASTER = 8, PCMK_OCF_FAILED_MASTER = 9, PCMK_OCF_EXEC_ERROR = 192, PCMK_OCF_UNKNOWN = 193,
  PCMK_OCF_SIGNAL = 194, PCMK_OCF_NOT_SUPPORTED = 195, PCMK_OCF_PENDING = 196, PCMK_OCF_CANCELLED = 197,
  PCMK_OCF_TIMEOUT = 198, PCMK_OCF_OTHER_ERROR = 199
}
 
enum  op_status {
  PCMK_LRM_OP_PENDING = -1, PCMK_LRM_OP_DONE, PCMK_LRM_OP_CANCELLED, PCMK_LRM_OP_TIMEOUT,
  PCMK_LRM_OP_NOTSUPPORTED, PCMK_LRM_OP_ERROR, PCMK_LRM_OP_ERROR_HARD, PCMK_LRM_OP_ERROR_FATAL,
  PCMK_LRM_OP_NOT_INSTALLED
}
 
enum  nagios_exitcode {
  NAGIOS_STATE_OK = 0, NAGIOS_STATE_WARNING = 1, NAGIOS_STATE_CRITICAL = 2, NAGIOS_STATE_UNKNOWN = 3,
  NAGIOS_STATE_DEPENDENT = 4, NAGIOS_INSUFFICIENT_PRIV = 100, NAGIOS_NOT_INSTALLED = 101
}
 

Functions

GList * get_directory_list (const char *root, gboolean files, gboolean executable)
 
GList * services_list (void)
 
GList * resources_list_providers (const char *standard)
 
GList * resources_list_agents (const char *standard, const char *provider)
 
GList * resources_list_standards (void)
 
svc_action_tservices_action_create (const char *name, const char *action, int interval, int timeout)
 
svc_action_tresources_action_create (const char *name, const char *standard, const char *provider, const char *agent, const char *action, int interval, int timeout, GHashTable *params)
 
gboolean services_action_kick (const char *name, const char *action, int interval)
 
const char * resources_find_service_class (const char *agent)
 
svc_action_tservices_action_create_generic (const char *exec, const char *args[])
 
void services_action_free (svc_action_t *op)
 
gboolean services_action_sync (svc_action_t *op)
 
gboolean services_action_async (svc_action_t *op, void(*action_callback)(svc_action_t *))
 
gboolean services_action_cancel (const char *name, const char *action, int interval)
 

Detailed Description

Services API.

Definition in file services.h.

Macro Definition Documentation

#define LSB_ROOT_DIR   "/etc/init.d"

Definition at line 41 of file services.h.

#define OCF_ROOT_DIR   "/usr/lib/ocf"

Definition at line 37 of file services.h.

#define SERVICE_SCRIPT   "/sbin/service"

Definition at line 50 of file services.h.

#define SYSTEMCTL   "/bin/systemctl"

Definition at line 46 of file services.h.

Typedef Documentation

typedef struct svc_action_private_s svc_action_private_t

Definition at line 127 of file services.h.

typedef struct svc_action_s svc_action_t

Enumeration Type Documentation

Enumerator
PCMK_LSB_OK 
PCMK_LSB_UNKNOWN_ERROR 
PCMK_LSB_INVALID_PARAM 
PCMK_LSB_UNIMPLEMENT_FEATURE 
PCMK_LSB_INSUFFICIENT_PRIV 
PCMK_LSB_NOT_INSTALLED 
PCMK_LSB_NOT_CONFIGURED 
PCMK_LSB_NOT_RUNNING 

Definition at line 54 of file services.h.

Enumerator
PCMK_LSB_STATUS_OK 
PCMK_LSB_STATUS_VAR_PID 
PCMK_LSB_STATUS_VAR_LOCK 
PCMK_LSB_STATUS_NOT_RUNNING 
PCMK_LSB_STATUS_NOT_INSTALLED 

Definition at line 68 of file services.h.

Enumerator
NAGIOS_STATE_OK 
NAGIOS_STATE_WARNING 
NAGIOS_STATE_CRITICAL 
NAGIOS_STATE_UNKNOWN 
NAGIOS_STATE_DEPENDENT 
NAGIOS_INSUFFICIENT_PRIV 
NAGIOS_NOT_INSTALLED 

Definition at line 115 of file services.h.

Enumerator
PCMK_OCF_OK 
PCMK_OCF_UNKNOWN_ERROR 
PCMK_OCF_INVALID_PARAM 
PCMK_OCF_UNIMPLEMENT_FEATURE 
PCMK_OCF_INSUFFICIENT_PRIV 
PCMK_OCF_NOT_INSTALLED 
PCMK_OCF_NOT_CONFIGURED 
PCMK_OCF_NOT_RUNNING 
PCMK_OCF_RUNNING_MASTER 
PCMK_OCF_FAILED_MASTER 
PCMK_OCF_EXEC_ERROR 
PCMK_OCF_UNKNOWN 
PCMK_OCF_SIGNAL 
PCMK_OCF_NOT_SUPPORTED 
PCMK_OCF_PENDING 
PCMK_OCF_CANCELLED 
PCMK_OCF_TIMEOUT 
PCMK_OCF_OTHER_ERROR 

Definition at line 79 of file services.h.

enum op_status
Enumerator
PCMK_LRM_OP_PENDING 
PCMK_LRM_OP_DONE 
PCMK_LRM_OP_CANCELLED 
PCMK_LRM_OP_TIMEOUT 
PCMK_LRM_OP_NOTSUPPORTED 
PCMK_LRM_OP_ERROR 
PCMK_LRM_OP_ERROR_HARD 
PCMK_LRM_OP_ERROR_FATAL 
PCMK_LRM_OP_NOT_INSTALLED 

Definition at line 103 of file services.h.

Function Documentation

GList* get_directory_list ( const char *  root,
gboolean  files,
gboolean  executable 
)

Get a list of files or directories in a given path

Parameters
[in]rootfull path to a directory to read
[in]filestrue to get a list of files, false for a list of directories
Returns
a list of what was found. The list items are gchar *. This list must be destroyed using g_list_free_full(list, free).
svc_action_t* resources_action_create ( const char *  name,
const char *  standard,
const char *  provider,
const char *  agent,
const char *  action,
int  interval,
int  timeout,
GHashTable *  params 
)

Create a resources action.

Parameters
[in]timeoutthe timeout in milliseconds
[in]intervalhow often to repeat this action, in milliseconds. If this value is 0, only execute this action one time.
Postcondition
After the call, 'params' is owned, and later free'd by the svc_action_t result
const char* resources_find_service_class ( const char *  agent)

Find the first class that can provide service::${agent}

Parameters
[in]agentwhich agent to search for
Returns
NULL, or the first class that provides the named agent
GList* resources_list_agents ( const char *  standard,
const char *  provider 
)

Get a list of resource agents

Parameters
[in]thestandard for research agents to check for (such as "ocf", "lsb", or "windows")
Returns
a list of resource agents. The list items are gchar *. This list must be destroyed using g_list_free_full(list, free).
GList* resources_list_providers ( const char *  standard)

Get a list of providers

Parameters
[in]thestandard for providers to check for (such as "ocf")
Returns
a list of providers. The list items are gchar *. This list must be destroyed using g_list_free_full(list, free).
GList* resources_list_standards ( void  )

Get list of available standards

Returns
a list of resource standards. The list items are char *. This list must be destroyed using g_list_free_full(list, free).
gboolean services_action_async ( svc_action_t op,
void(*)(svc_action_t *)  action_callback 
)

Run an action asynchronously.

Parameters
[in]opservices action data
[in]action_callbackcallback for when the action completes
Return values
TRUEsuccesfully started execution
FALSEfailed to start execution, no callback will be received
gboolean services_action_cancel ( const char *  name,
const char *  action,
int  interval 
)
svc_action_t* services_action_create ( const char *  name,
const char *  action,
int  interval,
int  timeout 
)
svc_action_t* services_action_create_generic ( const char *  exec,
const char *  args[] 
)

Utilize services API to execute an arbitrary command.

This API has useful infrastructure in place to be able to run a command in the background and get notified via a callback when the command finishes.

Parameters
[in]execcommand to execute
[in]argsarguments to the command, NULL terminated
Returns
a svc_action_t object, used to pass to the execute function (services_action_sync() or services_action_async()) and is provided to the callback.
void services_action_free ( svc_action_t op)
gboolean services_action_kick ( const char *  name,
const char *  action,
int  interval 
)

Kick a recurring action so it is scheduled immediately for re-execution

gboolean services_action_sync ( svc_action_t op)
GList* services_list ( void  )

Get a list of services

Returns
a list of services. The list items are gchar *. This list must be destroyed using g_list_free_full(list, free).