Skip to content

Commit

Permalink
Merge pull request #669 from davidvossel/pcmk-docker-bff
Browse files Browse the repository at this point in the history
pacemaker + docker = best friends forever
  • Loading branch information
beekhof committed Mar 25, 2015
2 parents c0f6394 + 7302cd7 commit c883063
Show file tree
Hide file tree
Showing 28 changed files with 3,558 additions and 91 deletions.
77 changes: 1 addition & 76 deletions crmd/lrm_state.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,10 @@
#include <crmd_lrm.h>

GHashTable *lrm_state_table = NULL;
GHashTable *proxy_table = NULL;
extern GHashTable *proxy_table;
int lrmd_internal_proxy_send(lrmd_t * lrmd, xmlNode *msg);
void lrmd_internal_set_proxy_callback(lrmd_t * lrmd, void *userdata, void (*callback)(lrmd_t *lrmd, void *userdata, xmlNode *msg));

typedef struct remote_proxy_s {
char *node_name;
char *session_id;

gboolean is_local;

crm_ipc_t *ipc;
mainloop_io_t *source;
uint32_t last_request_id;

} remote_proxy_t;

static void
history_cache_destroy(gpointer data)
{
Expand Down Expand Up @@ -218,32 +206,6 @@ lrm_state_reset_tables(lrm_state_t * lrm_state)
}
}

static void
remote_proxy_end_session(const char *session)
{
remote_proxy_t *proxy = g_hash_table_lookup(proxy_table, session);

if (proxy == NULL) {
return;
}
crm_trace("ending session ID %s", proxy->session_id);

if (proxy->source) {
mainloop_del_ipc_client(proxy->source);
}
}

static void
remote_proxy_free(gpointer data)
{
remote_proxy_t *proxy = data;

crm_trace("freed proxy session ID %s", proxy->session_id);
free(proxy->node_name);
free(proxy->session_id);
free(proxy);
}

gboolean
lrm_state_init_local(void)
{
Expand Down Expand Up @@ -359,43 +321,6 @@ lrm_state_ipc_connect(lrm_state_t * lrm_state)
return ret;
}

static void
remote_proxy_notify_destroy(lrmd_t *lrmd, const char *session_id)
{
/* sending to the remote node that an ipc connection has been destroyed */
xmlNode *msg = create_xml_node(NULL, T_LRMD_IPC_PROXY);
crm_xml_add(msg, F_LRMD_IPC_OP, "destroy");
crm_xml_add(msg, F_LRMD_IPC_SESSION, session_id);
lrmd_internal_proxy_send(lrmd, msg);
free_xml(msg);
}

static void
remote_proxy_relay_event(lrmd_t *lrmd, const char *session_id, xmlNode *msg)
{
/* sending to the remote node an event msg. */
xmlNode *event = create_xml_node(NULL, T_LRMD_IPC_PROXY);
crm_xml_add(event, F_LRMD_IPC_OP, "event");
crm_xml_add(event, F_LRMD_IPC_SESSION, session_id);
add_message_xml(event, F_LRMD_IPC_MSG, msg);
crm_log_xml_explicit(event, "EventForProxy");
lrmd_internal_proxy_send(lrmd, event);
free_xml(event);
}

static void
remote_proxy_relay_response(lrmd_t *lrmd, const char *session_id, xmlNode *msg, int msg_id)
{
/* sending to the remote node a response msg. */
xmlNode *response = create_xml_node(NULL, T_LRMD_IPC_PROXY);
crm_xml_add(response, F_LRMD_IPC_OP, "response");
crm_xml_add(response, F_LRMD_IPC_SESSION, session_id);
crm_xml_add_int(response, F_LRMD_IPC_MSG_ID, msg_id);
add_message_xml(response, F_LRMD_IPC_MSG, msg);
lrmd_internal_proxy_send(lrmd, response);
free_xml(response);
}

static int
remote_proxy_dispatch_internal(const char *buffer, ssize_t length, gpointer userdata)
{
Expand Down
5 changes: 5 additions & 0 deletions extra/resources/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ include $(top_srcdir)/Makefile.common

EXTRA_DIST = $(ocf_SCRIPTS)


containertechdir = @OCF_RA_DIR@/containers

ocfdir = @OCF_RA_DIR@/pacemaker

ocf_SCRIPTS = ClusterMon \
Expand All @@ -36,6 +39,8 @@ ocf_SCRIPTS = ClusterMon \
SystemHealth \
remote

containertech_SCRIPTS = docker-wrapper

if BUILD_XML_HELP

man7_MANS = $(ocf_SCRIPTS:%=ocf_pacemaker_%.7)
Expand Down
Loading

0 comments on commit c883063

Please sign in to comment.