Check if for some reason we handle a HA segment on both nodes

This commit is contained in:
Martin Willi
2013-03-19 16:50:39 +01:00
parent 21f40fe891
commit 33524f02f9
+15 -1
View File
@@ -289,12 +289,13 @@ static void start_watchdog(private_ha_segments_t *this)
METHOD(ha_segments_t, handle_status, void,
private_ha_segments_t *this, segment_mask_t mask)
{
segment_mask_t missing;
segment_mask_t missing, twice;
int i;
this->mutex->lock(this->mutex);
missing = ~(this->active | mask);
twice = this->active & mask;
for (i = 1; i <= this->count; i++)
{
@@ -311,6 +312,19 @@ METHOD(ha_segments_t, handle_status, void,
enable_disable(this, i, FALSE, TRUE);
}
}
if (twice & SEGMENTS_BIT(i))
{
if (this->node == i % 2)
{
DBG1(DBG_CFG, "HA segment %d was handled twice, taking", i);
enable_disable(this, i, TRUE, TRUE);
}
else
{
DBG1(DBG_CFG, "HA segment %d was handled twice, dropping", i);
enable_disable(this, i, FALSE, TRUE);
}
}
}
this->condvar->signal(this->condvar);