1
0
mirror of https://github.com/fwbuilder/fwbuilder synced 2026-03-20 10:17:16 +01:00

see #2077 Setting correct state sync group type

This commit is contained in:
Vadim Kurland 2011-02-11 14:13:23 -08:00
parent 19b9b2482b
commit bc81cad569
4 changed files with 32 additions and 2 deletions

View File

@ -168,6 +168,7 @@ QString ObjectManipulator::getTreeLabel(FWObject *obj, int col)
case 1:
return FWObjectPropertiesFactory::getObjectPropertiesBrief(obj);
}
return "";
}
ObjectTreeViewItem* ObjectManipulator::insertObject(ObjectTreeViewItem *itm,

View File

@ -200,7 +200,13 @@ void newClusterDialog::createNewCluster()
setDefaultFailoverGroupAttributes(failover_grp);
}
if (fwbdebug) qDebug() << "newClusterDialog::createNewCluster() checkpoint 3";
// Set correct type of the state sync group (the StateSyncGroup object is
// created in Cluster::init()
FWObject *state_sync_members =
ncl->getFirstByType(StateSyncClusterGroup::TYPENAME);
setDefaultStateSyncGroupAttributes(
StateSyncClusterGroup::cast(state_sync_members));
// Copy rule sets if requested
Firewall *source = NULL;

View File

@ -44,6 +44,8 @@
#include "fwbuilder/Resources.h"
#include "fwbuilder/Rule.h"
#include "fwbuilder/Policy.h"
#include <fwbuilder/FailoverClusterGroup.h>
#include <fwbuilder/StateSyncClusterGroup.h>
#include <algorithm>
#include <iostream>
@ -1003,6 +1005,25 @@ void _repackStringList(list<string> &list1, list<QStringPair> &list2)
}
}
void setDefaultStateSyncGroupAttributes(StateSyncClusterGroup *grp)
{
FWObject *p = grp;
while (p && Cluster::cast(p)==NULL) p = p->getParent();
assert(p != NULL);
Cluster *cluster = Cluster::cast(p);
Resources *os_res = Resources::os_res[cluster->getStr("host_OS")];
assert(os_res != NULL);
list<string> protocols;
os_res->getResourceStrList("/FWBuilderResources/Target/protocols/state_sync",
protocols);
QStringList protocol_names = QString(protocols.front().c_str()).split(",");
grp->setName(protocol_names[1].toStdString());
grp->setStr("type", protocol_names[0].toStdString());
}
void setDefaultFailoverGroupAttributes(FailoverClusterGroup *grp)
{
FWObject *p = grp;

View File

@ -38,7 +38,6 @@
#include <utility>
#include <fwbuilder/Rule.h>
#include <fwbuilder/FailoverClusterGroup.h>
namespace libfwbuilder
@ -46,6 +45,8 @@ namespace libfwbuilder
class FWOptions;
class Firewall;
class PolicyRule;
class FailoverClusterGroup;
class StateSyncClusterGroup;
};
void init_platforms();
@ -57,6 +58,7 @@ bool isDefaultNATRuleOptions(libfwbuilder::FWOptions *opt);
bool isDefaultRoutingRuleOptions(libfwbuilder::FWOptions *opt);
void setDefaultFailoverGroupAttributes(libfwbuilder::FailoverClusterGroup *grp);
void setDefaultStateSyncGroupAttributes(libfwbuilder::StateSyncClusterGroup *grp);
// using list of pairs instead of a map or QMap because maps are dictionaries
// and do not preserve order of elements