214f9b65bf
Signed-off-by: Lon Hohberger <lhh@redhat.com>
93 lines
2.4 KiB
C
93 lines
2.4 KiB
C
|
|
/* */
|
|
|
|
#include <uuid/uuid.h>
|
|
|
|
typedef void * srv_context_t;
|
|
|
|
/* These callbacks hand requests off to the
|
|
appropriate backend. */
|
|
|
|
/* Do nothing. Returns 1 (failure) to caller */
|
|
typedef int (*fence_null_callback)(const char *vm_name,
|
|
void *priv);
|
|
|
|
/* Turn the VM 'off'. Returns 0 to caller if successful or
|
|
nonzero if unsuccessful. */
|
|
typedef int (*fence_off_callback)(const char *vm_name,
|
|
void *priv);
|
|
|
|
/* Turn the VM 'on'. Returns 0 to caller if successful or
|
|
nonzero if unsuccessful. */
|
|
typedef int (*fence_on_callback)(const char *vm_name,
|
|
void *priv);
|
|
|
|
/* Reboot a VM. Returns 0 to caller if successful or
|
|
nonzero if unsuccessful. */
|
|
typedef int (*fence_reboot_callback)(const char *vm_name,
|
|
void *priv);
|
|
|
|
/* Get status of a VM. Returns 0 to caller if VM is alive or
|
|
nonzero if VM is not alive. */
|
|
typedef int (*fence_status_callback)(const char *vm_name,
|
|
void *priv);
|
|
|
|
/* Get status of backend. Returns 0 to caller if backend
|
|
is responding to requests. */
|
|
typedef int (*fence_devstatus_callback)(void *priv);
|
|
|
|
typedef int (*fence_init_callback)(srv_context_t *c);
|
|
typedef int (*fence_cleanup_callback)(srv_context_t c);
|
|
|
|
typedef struct _fence_callbacks {
|
|
fence_null_callback null;
|
|
fence_off_callback off;
|
|
fence_on_callback on;
|
|
fence_reboot_callback reboot;
|
|
fence_status_callback status;
|
|
fence_devstatus_callback devstatus;
|
|
} fence_callbacks_t;
|
|
|
|
typedef struct _backend_plugin {
|
|
const char *name;
|
|
const char *version;
|
|
const fence_callbacks_t *callbacks;
|
|
fence_init_callback init;
|
|
fence_cleanup_callback cleanup;
|
|
} plugin_t;
|
|
|
|
#ifndef _USE_MODULES
|
|
void plugin_register(const plugin_t *plugin);
|
|
const plugin_t *plugin_find(const char *name);
|
|
void plugin_dump(void);
|
|
#endif
|
|
|
|
|
|
/* TODO: make these 'plugins' instead of static uses */
|
|
typedef void serial_options;
|
|
/* Directory path / hypervisor uri if using libvirt...
|
|
.. whatever you think you need... */
|
|
|
|
int serial_init(srv_context_t *, fence_callbacks_t *,
|
|
serial_options *, void *priv);
|
|
|
|
/* NULL = no timeout; wait forever */
|
|
int serial_dispatch(srv_context_t, struct timeval *timeout);
|
|
int serial_shutdown(srv_context_t);
|
|
|
|
typedef struct {
|
|
char *addr;
|
|
char *key_file;
|
|
int ifindex;
|
|
int family;
|
|
unsigned int port;
|
|
unsigned int hash;
|
|
unsigned int auth;
|
|
} mcast_options;
|
|
|
|
int mcast_init(srv_context_t *, const fence_callbacks_t *,
|
|
mcast_options *, void *priv);
|
|
int mcast_dispatch(srv_context_t, struct timeval *timeout);
|
|
int mcast_shutdown(srv_context_t);
|
|
|