Automatically segment cluster using periodically sent status messages
This commit is contained in:
committed by
Martin Willi
parent
b7f15be136
commit
3912fdb1ec
@@ -97,29 +97,6 @@ static void destroy(private_ha_sync_plugin_t *this)
|
||||
free(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert segment string to mask
|
||||
*/
|
||||
static segment_mask_t parse_active(char *active)
|
||||
{
|
||||
enumerator_t *enumerator;
|
||||
u_int segment;
|
||||
segment_mask_t mask = 0;
|
||||
|
||||
enumerator = enumerator_create_token(active, ",", " ");
|
||||
while (enumerator->enumerate(enumerator, &active))
|
||||
{
|
||||
segment = atoi(active);
|
||||
if (segment > 0 && segment < SEGMENTS_MAX)
|
||||
{
|
||||
mask |= SEGMENTS_BIT(segment);
|
||||
}
|
||||
}
|
||||
enumerator->destroy(enumerator);
|
||||
|
||||
return mask;
|
||||
}
|
||||
|
||||
/*
|
||||
* see header file
|
||||
*/
|
||||
@@ -127,7 +104,6 @@ plugin_t *plugin_create()
|
||||
{
|
||||
private_ha_sync_plugin_t *this;
|
||||
char *local, *remote, *secret, *virtuals;
|
||||
segment_mask_t active;
|
||||
u_int count;
|
||||
bool fifo;
|
||||
|
||||
@@ -143,8 +119,6 @@ plugin_t *plugin_create()
|
||||
"charon.plugins.ha_sync.fifo_interface", FALSE);
|
||||
count = min(SEGMENTS_MAX, lib->settings->get_int(lib->settings,
|
||||
"charon.plugins.ha_sync.segment_count", 1));
|
||||
active = parse_active(lib->settings->get_str(lib->settings,
|
||||
"charon.plugins.ha_sync.active_segments", "1"));
|
||||
if (!local || !remote)
|
||||
{
|
||||
DBG1(DBG_CFG, "HA sync config misses local/remote address");
|
||||
@@ -163,7 +137,7 @@ plugin_t *plugin_create()
|
||||
free(this);
|
||||
return NULL;
|
||||
}
|
||||
this->kernel = ha_sync_kernel_create(count, active, virtuals);
|
||||
this->kernel = ha_sync_kernel_create(count, virtuals);
|
||||
if (!this->kernel)
|
||||
{
|
||||
this->socket->destroy(this->socket);
|
||||
@@ -176,7 +150,7 @@ plugin_t *plugin_create()
|
||||
this->tunnel = ha_sync_tunnel_create(local, remote, secret);
|
||||
}
|
||||
this->segments = ha_sync_segments_create(this->socket, this->kernel,
|
||||
this->tunnel, count, active);
|
||||
this->tunnel, local, remote, count);
|
||||
if (fifo)
|
||||
{
|
||||
this->ctl = ha_sync_ctl_create(this->segments);
|
||||
|
||||
Reference in New Issue
Block a user