 |
Kea
1.5.0
|
Go to the documentation of this file.
18 HAConfig::PeerConfig::PeerConfig()
19 :
name_(), url_(
""), role_(STANDBY), auto_failover_(false) {
35 role_ = stringToRole(role);
40 std::ostringstream label;
41 label << getName() <<
" (" << getUrl().toText() <<
")";
47 if (role ==
"primary") {
50 }
else if (role ==
"secondary") {
53 }
else if (role ==
"standby") {
56 }
else if (role ==
"backup") {
88 pausing_ = stringToPausing(pausing);
93 if (pausing ==
"always") {
96 }
else if (pausing ==
"never") {
99 }
else if (pausing ==
"once") {
122 isc_throw(
BadValue,
"unsupported pause enumeration " <<
static_cast<int>(pausing));
128 auto state_config = states_.find(state);
129 if (state_config != states_.end()) {
130 return (state_config->second);
135 states_[state] = new_state_config;
137 return (new_state_config);
151 if (
peers_.count(name) > 0) {
184 if (ha_mode ==
"load-balancing") {
187 }
else if (ha_mode ==
"hot-standby") {
198 return (
"load-balancing");
200 return (
"hot-standby");
209 auto peer =
peers_.find(name);
210 if (peer ==
peers_.end()) {
214 return (peer->second);
220 for (
auto peer = servers.begin(); peer != servers.end(); ++peer) {
222 return (peer->second);
251 std::map<PeerConfig::Role, unsigned> peers_cnt;
253 if (!p->second->getUrl().isValid()) {
255 << p->second->getUrl().getErrorMessage()
256 <<
" for server " << p->second->getName());
259 ++peers_cnt[p->second->getRole()];
281 "balancing configuration");
287 " balancing configuration");
293 " balancing configuration");
302 " standby configuration");
308 " standby configuration");
314 " standby configuration");
StatePausing
State machine pausing modes.
ElementPtr copy(ConstElementPtr from, int level)
Copy the data up to a nesting level.
StateConfig(const int state)
Constructor.
PeerConfigPtr getThisServerConfig() const
Returns configuration of this server.
bool send_lease_updates_
Send lease updates to partner?
void validate() const
Validates configuration.
void setThisServerName(const std::string &this_server_name)
Sets name of this server.
string trim(const string &instring)
Trim Leading and Trailing Spaces.
PeerConfigMap getOtherServersConfig() const
Returns configuration of other servers.
static std::string HAModeToString(const HAMode &ha_mode)
Returns HA mode name.
void setName(const std::string &name)
Sets server name.
uint32_t sync_page_limit_
Page size limit while synchronizing leases.
uint32_t heartbeat_delay_
Heartbeat delay in milliseconds.
uint32_t max_unacked_clients_
Maximum number of unacked clients.
std::string getLogLabel() const
Returns a string identifying a server used in logging.
PeerConfigMap peers_
Map of peers' configurations.
Defines the logger used by the top-level component of kea-dhcp-ddns.
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
std::string this_server_name_
This server name.
A generic exception that is thrown if a function is called in a prohibited way.
A generic exception that is thrown if a parameter given to a method is considered invalid in that con...
static HAMode stringToHAMode(const std::string &ha_mode)
Decodes HA mode provided as string.
boost::shared_ptr< StateConfig > StateConfigPtr
Pointer to the state configuration.
HAMode ha_mode_
Mode of operation.
uint32_t sync_timeout_
Timeout for syncing lease database (ms)
std::string getThisServerName() const
Returns name of this server.
Exception thrown when configuration validation fails.
static util::StatePausing stringToPausing(const std::string &pausing)
Converts pausing mode from the textual form.
StateMachineConfigPtr state_machine_
State machine configuration.
bool sync_leases_
Synchronize databases on startup?
static std::string pausingToString(const util::StatePausing &pausing)
Returns pausing mode in the textual form.
std::map< std::string, PeerConfigPtr > PeerConfigMap
Map of the servers' configurations.
void setRole(const std::string &role)
Sets servers role.
uint32_t max_ack_delay_
Maximum DHCP message ack delay.
PeerConfigPtr getPeerConfig(const std::string &name) const
Returns configuration of the specified server.
boost::shared_ptr< PeerConfig > PeerConfigPtr
Pointer to the server's configuration.
StateConfigPtr getStateConfig(const int state)
Returns pointer to the state specific configuration.
State machine configuration information.
Configuration specific to a single HA state.
void setPausing(const std::string &pausing)
Sets pausing mode for the gievn state.
void setHAMode(const std::string &ha_mode)
Sets new mode of operation.
PeerConfigPtr getFailoverPeerConfig() const
Returns configuration of the partner which takes part in failover.
PeerConfigPtr selectNextPeerConfig(const std::string &name)
Creates and returns pointer to the new peer's configuration.
uint32_t max_response_delay_
Max delay in response to heartbeats.
Role
Server's role in the High Availability setup.
static std::string roleToString(const HAConfig::PeerConfig::Role &role)
Returns role name.
static Role stringToRole(const std::string &role)
Decodes role provided as a string.