Kea 2.7.5
isc::ha::HAConfig Class Reference

Storage for High Availability configuration. More...

#include <ha_config.h>

Classes

class  PeerConfig
 HA peer configuration. More...
 
class  StateConfig
 Configuration specific to a single HA state. More...
 
class  StateMachineConfig
 State machine configuration information. More...
 

Public Types

enum  HAMode { LOAD_BALANCING , HOT_STANDBY , PASSIVE_BACKUP }
 Mode of operation. More...
 
typedef std::map< std::string, PeerConfigPtrPeerConfigMap
 Map of the servers' configurations.
 
typedef boost::shared_ptr< PeerConfigPeerConfigPtr
 Pointer to the server's configuration.
 
typedef boost::shared_ptr< StateConfigStateConfigPtr
 Pointer to the state configuration.
 
typedef boost::shared_ptr< StateMachineConfigStateMachineConfigPtr
 Pointer to a state machine configuration.
 

Public Member Functions

 HAConfig ()
 Constructor.
 
bool amAllowingCommRecovery () const
 Convenience function checking if communication recovery is allowed.
 
bool amSendingLeaseUpdates () const
 Returns boolean flag indicating whether lease updates should be sent to the partner.
 
bool amSyncingLeases () const
 Returns boolean flag indicating whether the active servers should synchronize their lease databases upon startup.
 
bool amWaitingBackupAck () const
 Checks if the server is configured to wait for the acknowledgments to the lease updates from the backup server or not.
 
PeerConfigMap getAllServersConfig () const
 Returns configurations of all servers.
 
util::Optional< std::string > getCertFile () const
 Returns global cert-file.
 
uint32_t getDelayedUpdatesLimit () const
 Returns the maximum number of lease updates which can be held unsent in the communication-recovery state.
 
bool getEnableMultiThreading ()
 Checks if the server is configured for multi-threaded operation.
 
PeerConfigPtr getFailoverPeerConfig () const
 Returns configuration of the partner which takes part in failover.
 
HAMode getHAMode () const
 Returns mode of operation.
 
uint32_t getHeartbeatDelay () const
 Returns heartbeat delay in milliseconds.
 
uint32_t getHttpClientThreads ()
 Fetches the number of threads the HTTP client should use.
 
bool getHttpDedicatedListener ()
 Checks if the server is configured to use its own HTTP listener.
 
uint32_t getHttpListenerThreads ()
 Fetches the number of threads the HTTP listener should use.
 
util::Optional< std::string > getKeyFile () const
 Returns global key-file.
 
uint32_t getMaxAckDelay () const
 Returns maximum time for a client trying to communicate with DHCP server to complete the transaction.
 
uint32_t getMaxRejectedLeaseUpdates () const
 Returns a maximum number of clients for whom lease updates failed due to other than general error.
 
uint32_t getMaxResponseDelay () const
 Returns max response delay.
 
uint32_t getMaxUnackedClients () const
 Returns maximum number of clients which may fail to communicate with the DHCP server before entering partner down state.
 
PeerConfigMap getOtherServersConfig () const
 Returns configuration of other servers.
 
PeerConfigPtr getPeerConfig (const std::string &name) const
 Returns configuration of the specified server.
 
bool getRequireClientCerts () const
 Returns require-client-certs.
 
bool getRestrictCommands () const
 Returns restrict-commands.
 
StateMachineConfigPtr getStateMachineConfig () const
 Returns state machine configuration.
 
uint32_t getSyncPageLimit () const
 Returns maximum number of leases per page to be fetched during database synchronization.
 
uint32_t getSyncTimeout () const
 Returns timeout for lease database synchronization.
 
PeerConfigPtr getThisServerConfig () const
 Returns configuration of this server.
 
std::string getThisServerName () const
 Returns name of this server.
 
util::Optional< std::string > getTrustAnchor () const
 Returns global trust-anchor.
 
PeerConfigPtr selectNextPeerConfig (const std::string &name)
 Creates and returns pointer to the new peer's configuration.
 
void setCertFile (const util::Optional< std::string > &cert)
 Sets global cert-file.
 
void setDelayedUpdatesLimit (const uint32_t delayed_updates_limit)
 Sets new limit for the number of lease updates to be held unsent in the communication-recovery state.
 
void setEnableMultiThreading (bool enable_multi_threading)
 Sets whether or not server is configured for multi-threaded operation.
 
void setHAMode (const std::string &ha_mode)
 Sets new mode of operation.
 
void setHeartbeatDelay (const uint32_t heartbeat_delay)
 Sets new heartbeat delay in milliseconds.
 
void setHttpClientThreads (uint32_t http_client_threads)
 Sets the number of threads the HTTP client should use.
 
void setHttpDedicatedListener (bool http_dedicated_listener)
 Sets whether or not the server is configured to use its own HTTP listener.
 
void setHttpListenerThreads (uint32_t http_listener_threads)
 Sets the number of threads the HTTP listener should use.
 
void setKeyFile (const util::Optional< std::string > &key)
 Sets global key-file.
 
void setMaxAckDelay (const uint32_t max_ack_delay)
 Sets maximum time for a client trying to communicate with DHCP server to completed the transaction.
 
void setMaxRejectedLeaseUpdates (const uint32_t max_rejected_lease_updates)
 Sets the maximum number of clients for whom the lease updates can fail due to other than general error.
 
void setMaxResponseDelay (const uint32_t max_response_delay)
 Sets new max response delay.
 
void setMaxUnackedClients (const uint32_t max_unacked_clients)
 Set maximum number of clients which may fail to communicate with the DHCP server before entering partner down state.
 
void setRequireClientCerts (bool flag)
 Sets require-client-certs.
 
void setRestrictCommands (bool flag)
 Sets restrict-commands.
 
void setSendLeaseUpdates (const bool send_lease_updates)
 Sets boolean flag indicating whether lease updates should be sent to the partner.
 
void setSyncLeases (const bool sync_leases)
 Sets boolean flag indicating whether the active servers should synchronize their lease databases upon startup.
 
void setSyncPageLimit (const uint32_t sync_page_limit)
 Sets new page limit size for leases fetched from the partner during database synchronization.
 
void setSyncTimeout (const uint32_t sync_timeout)
 Sets new lease database syncing timeout in milliseconds.
 
void setThisServerName (const std::string &this_server_name)
 Sets name of this server.
 
void setTrustAnchor (const util::Optional< std::string > &ca)
 Sets global trust-anchor.
 
void setWaitBackupAck (const bool wait_backup_ack)
 Configures the server to wait/not wait for the lease update acknowledgments from the backup servers.
 
void validate ()
 Validates configuration.
 

Static Public Member Functions

static HAConfigPtr create ()
 Instantiates a HAConfig.
 
static std::string getSubnetServerName (const dhcp::ConstSubnetPtr &subnet)
 Convenience function extracting a value of the ha-server-name parameter from a subnet context.
 
static std::string HAModeToString (const HAMode &ha_mode)
 Returns HA mode name.
 
static HAMode stringToHAMode (const std::string &ha_mode)
 Decodes HA mode provided as string.
 

Public Attributes

util::Optional< std::string > cert_file_
 Certificate file.
 
uint32_t delayed_updates_limit_
 Maximum number of lease updates held for later send in communication-recovery.
 
bool enable_multi_threading_
 Enable multi-threading.
 
HAMode ha_mode_
 Mode of operation.
 
uint32_t heartbeat_delay_
 Heartbeat delay in milliseconds.
 
uint32_t http_client_threads_
 Number of HTTP client threads.
 
bool http_dedicated_listener_
 Enable use of own HTTP listener.
 
uint32_t http_listener_threads_
 Number of HTTP listener threads.
 
util::Optional< std::string > key_file_
 Private key file.
 
uint32_t max_ack_delay_
 Maximum DHCP message ack delay.
 
uint32_t max_rejected_lease_updates_
 Limit of rejected lease updates before termination.
 
uint32_t max_response_delay_
 Max delay in response to heartbeats.
 
uint32_t max_unacked_clients_
 Maximum number of unacked clients.
 
PeerConfigMap peers_
 Map of peers' configurations.
 
bool require_client_certs_
 Require client certs flag.
 
bool restrict_commands_
 Restrict commands to HA flag.
 
bool send_lease_updates_
 Send lease updates to partner?
 
StateMachineConfigPtr state_machine_
 State machine configuration.
 
bool sync_leases_
 Synchronize databases on startup?
 
uint32_t sync_page_limit_
 Page size limit while synchronizing leases.
 
uint32_t sync_timeout_
 Timeout for syncing lease database (ms)
 
std::string this_server_name_
 This server name.
 
util::Optional< std::string > trust_anchor_
 Trust anchor.
 
bool wait_backup_ack_
 Wait for lease update ack from backup?
 

Detailed Description

Storage for High Availability configuration.

Definition at line 46 of file ha_config.h.

Member Typedef Documentation

◆ PeerConfigMap

typedef std::map<std::string, PeerConfigPtr> isc::ha::HAConfig::PeerConfigMap

Map of the servers' configurations.

Definition at line 245 of file ha_config.h.

◆ PeerConfigPtr

typedef boost::shared_ptr<PeerConfig> isc::ha::HAConfig::PeerConfigPtr

Pointer to the server's configuration.

Definition at line 242 of file ha_config.h.

◆ StateConfigPtr

typedef boost::shared_ptr<StateConfig> isc::ha::HAConfig::StateConfigPtr

Pointer to the state configuration.

Definition at line 293 of file ha_config.h.

◆ StateMachineConfigPtr

Pointer to a state machine configuration.

Definition at line 325 of file ha_config.h.

Member Enumeration Documentation

◆ HAMode

Mode of operation.

Currently supported modes are:

  • load-balancing
  • hot-standby
  • passive-backup
Enumerator
LOAD_BALANCING 
HOT_STANDBY 
PASSIVE_BACKUP 

Definition at line 55 of file ha_config.h.

Constructor & Destructor Documentation

◆ HAConfig()

isc::ha::HAConfig::HAConfig ( )

Constructor.

Definition at line 165 of file ha_config.cc.

Member Function Documentation

◆ amAllowingCommRecovery()

bool isc::ha::HAConfig::amAllowingCommRecovery ( ) const
inline

Convenience function checking if communication recovery is allowed.

Communication recovery is only allowed in load-balancing configurations. It is enabled by setting delayed-updates-limit to a value greater than 0.

Returns
true if communication recovery is enabled, false otherwise.

Definition at line 491 of file ha_config.h.

References delayed_updates_limit_.

◆ amSendingLeaseUpdates()

bool isc::ha::HAConfig::amSendingLeaseUpdates ( ) const
inline

Returns boolean flag indicating whether lease updates should be sent to the partner.

Definition at line 386 of file ha_config.h.

References send_lease_updates_.

◆ amSyncingLeases()

bool isc::ha::HAConfig::amSyncingLeases ( ) const
inline

Returns boolean flag indicating whether the active servers should synchronize their lease databases upon startup.

Definition at line 405 of file ha_config.h.

References sync_leases_.

◆ amWaitingBackupAck()

bool isc::ha::HAConfig::amWaitingBackupAck ( ) const
inline

Checks if the server is configured to wait for the acknowledgments to the lease updates from the backup server or not.

Returns
true if the server is configured to wait for the acknowledgments or false otherwise.

Definition at line 617 of file ha_config.h.

References wait_backup_ack_.

◆ create()

HAConfigPtr isc::ha::HAConfig::create ( )
static

Instantiates a HAConfig.

Definition at line 178 of file ha_config.cc.

◆ getAllServersConfig()

PeerConfigMap isc::ha::HAConfig::getAllServersConfig ( ) const
inline

Returns configurations of all servers.

Returns
Map of pointers to the servers' configurations.

Definition at line 780 of file ha_config.h.

References peers_.

◆ getCertFile()

util::Optional< std::string > isc::ha::HAConfig::getCertFile ( ) const
inline

Returns global cert-file.

Definition at line 697 of file ha_config.h.

References cert_file_.

◆ getDelayedUpdatesLimit()

uint32_t isc::ha::HAConfig::getDelayedUpdatesLimit ( ) const
inline

Returns the maximum number of lease updates which can be held unsent in the communication-recovery state.

If the server is in the communication-recovery state it is unable to send lease updates to the partner. Instead it keeps lease updates, hoping to send them when the communication is resumed. This value designates a limit of how many such updates can be held. If this number is exceeded the server continues to respond to the clients but will have to go through regular lease database synchronization when the communication is resumed.

Returns
Limit of the lease backlog size in communication-recovery.

Definition at line 464 of file ha_config.h.

References delayed_updates_limit_.

◆ getEnableMultiThreading()

bool isc::ha::HAConfig::getEnableMultiThreading ( )
inline

Checks if the server is configured for multi-threaded operation.

Returns
true if the server is configured for multi-threaded operation

Definition at line 624 of file ha_config.h.

References enable_multi_threading_.

◆ getFailoverPeerConfig()

HAConfig::PeerConfigPtr isc::ha::HAConfig::getFailoverPeerConfig ( ) const

Returns configuration of the partner which takes part in failover.

The server for which the configuration is returned is a "primary", "secondary" or "standby". This method is typically used to locate the configuration of the server to which heartbeat command is to be sent.

Returns
Pointer to the partner's configuration.
Exceptions
InvalidOperationif there is no suitable configuration found.

Definition at line 258 of file ha_config.cc.

References isc::ha::HAConfig::PeerConfig::BACKUP, getOtherServersConfig(), getThisServerName(), and isc_throw.

+ Here is the call graph for this function:

◆ getHAMode()

HAMode isc::ha::HAConfig::getHAMode ( ) const
inline

Returns mode of operation.

Definition at line 357 of file ha_config.h.

References ha_mode_.

◆ getHeartbeatDelay()

uint32_t isc::ha::HAConfig::getHeartbeatDelay ( ) const
inline

Returns heartbeat delay in milliseconds.

This value indicates the delay in sending a heartbeat command after last heartbeat or some other command to the partner. A value of zero disables the heartbeat.

Returns
Heartbeat delay in milliseconds.

Definition at line 502 of file ha_config.h.

References heartbeat_delay_.

◆ getHttpClientThreads()

uint32_t isc::ha::HAConfig::getHttpClientThreads ( )
inline

Fetches the number of threads the HTTP client should use.

Returns
number of threads the client is configured to use.

Definition at line 673 of file ha_config.h.

References http_client_threads_.

◆ getHttpDedicatedListener()

bool isc::ha::HAConfig::getHttpDedicatedListener ( )
inline

Checks if the server is configured to use its own HTTP listener.

When this is true, the server should instantiate an HTTP listener instance which listens on this server's URL. If false, this server will rely on a kea-control-agent.

Returns
true if the server is configured to use its own HTTP listener.

Definition at line 643 of file ha_config.h.

References http_dedicated_listener_.

◆ getHttpListenerThreads()

uint32_t isc::ha::HAConfig::getHttpListenerThreads ( )
inline

Fetches the number of threads the HTTP listener should use.

Returns
number of threads the listener is configured to use.

Definition at line 659 of file ha_config.h.

References http_listener_threads_.

◆ getKeyFile()

util::Optional< std::string > isc::ha::HAConfig::getKeyFile ( ) const
inline

Returns global key-file.

Definition at line 709 of file ha_config.h.

References key_file_.

◆ getMaxAckDelay()

uint32_t isc::ha::HAConfig::getMaxAckDelay ( ) const
inline

Returns maximum time for a client trying to communicate with DHCP server to complete the transaction.

Returns
Maximum delay in milliseconds.

Definition at line 541 of file ha_config.h.

References max_ack_delay_.

◆ getMaxRejectedLeaseUpdates()

uint32_t isc::ha::HAConfig::getMaxRejectedLeaseUpdates ( ) const
inline

Returns a maximum number of clients for whom lease updates failed due to other than general error.

A lease update may fail due to a conflict with the partner's configuration. The server distinguishes such errors from general errors (e.g., related to communication issues) to avoid transitioning to the partner-down state when there is in fact a problem with a lease or the configuration. On the other hand, if such problematic leases accumulate, the server can no longer provide the HA service and should transition to the terminated state. Consequently, an administrator must fix the configuration problem. This function returns the maximum number of clients with conflicting leases before the server transitions to the terminated state.

Returns
Maximum number of rejected lease updates before the server terminates the HA service.

Definition at line 584 of file ha_config.h.

References max_rejected_lease_updates_.

◆ getMaxResponseDelay()

uint32_t isc::ha::HAConfig::getMaxResponseDelay ( ) const
inline

Returns max response delay.

Max response delay is the maximum time that the server is waiting for its partner to respond to the heartbeats (and lease updates) before it assumes the communications interrupted state.

Definition at line 522 of file ha_config.h.

References max_response_delay_.

◆ getMaxUnackedClients()

uint32_t isc::ha::HAConfig::getMaxUnackedClients ( ) const
inline

Returns maximum number of clients which may fail to communicate with the DHCP server before entering partner down state.

Returns
Maximum number of clients.

Definition at line 557 of file ha_config.h.

References max_unacked_clients_.

◆ getOtherServersConfig()

HAConfig::PeerConfigMap isc::ha::HAConfig::getOtherServersConfig ( ) const

Returns configuration of other servers.

Returns a map of pointers to the configuration of all servers except this.

Returns
Map of pointers to the servers' configurations.

Definition at line 276 of file ha_config.cc.

References isc::data::copy(), getThisServerName(), and peers_.

Referenced by getFailoverPeerConfig().

+ Here is the call graph for this function:

◆ getPeerConfig()

HAConfig::PeerConfigPtr isc::ha::HAConfig::getPeerConfig ( const std::string & name) const

Returns configuration of the specified server.

Parameters
nameServer name.
Returns
Pointer to the partner's configuration.
Exceptions
InvalidOperationif there is no suitable configuration found.

Definition at line 248 of file ha_config.cc.

References isc_throw, and peers_.

Referenced by getThisServerConfig().

◆ getRequireClientCerts()

bool isc::ha::HAConfig::getRequireClientCerts ( ) const
inline

Returns require-client-certs.

Definition at line 721 of file ha_config.h.

References require_client_certs_.

Referenced by validate().

◆ getRestrictCommands()

bool isc::ha::HAConfig::getRestrictCommands ( ) const
inline

Returns restrict-commands.

Definition at line 733 of file ha_config.h.

References restrict_commands_.

◆ getStateMachineConfig()

StateMachineConfigPtr isc::ha::HAConfig::getStateMachineConfig ( ) const
inline

Returns state machine configuration.

Returns
Pointer to the state machine configuration.

Definition at line 787 of file ha_config.h.

References state_machine_.

◆ getSubnetServerName()

std::string isc::ha::HAConfig::getSubnetServerName ( const dhcp::ConstSubnetPtr & subnet)
static

Convenience function extracting a value of the ha-server-name parameter from a subnet context.

If the subnet does not contain this parameter it tries to find this parameter in the shared network.

Parameters
subnetpointer to the subnet.
Returns
ha-server-name parameter value or an empty string if it was not found.
Exceptions
BadValueif the parameter is not a string or is empty.

Definition at line 524 of file ha_config.cc.

References isc_throw, isc::data::Element::map, and isc::data::Element::string.

Referenced by isc::ha::HAImpl::subnet4Select(), and isc::ha::HAImpl::subnet6Select().

◆ getSyncPageLimit()

uint32_t isc::ha::HAConfig::getSyncPageLimit ( ) const
inline

Returns maximum number of leases per page to be fetched during database synchronization.

Returns
Maximum number of leases per page.

Definition at line 440 of file ha_config.h.

References sync_page_limit_.

◆ getSyncTimeout()

uint32_t isc::ha::HAConfig::getSyncTimeout ( ) const
inline

Returns timeout for lease database synchronization.

Returns
Timeout in milliseconds.

Definition at line 425 of file ha_config.h.

References sync_timeout_.

◆ getThisServerConfig()

HAConfig::PeerConfigPtr isc::ha::HAConfig::getThisServerConfig ( ) const

Returns configuration of this server.

Returns
Pointer to the configuration of this server.

Definition at line 271 of file ha_config.cc.

References getPeerConfig(), and getThisServerName().

+ Here is the call graph for this function:

◆ getThisServerName()

std::string isc::ha::HAConfig::getThisServerName ( ) const
inline

Returns name of this server.

Definition at line 346 of file ha_config.h.

References this_server_name_.

Referenced by getFailoverPeerConfig(), getOtherServersConfig(), getThisServerConfig(), and validate().

◆ getTrustAnchor()

util::Optional< std::string > isc::ha::HAConfig::getTrustAnchor ( ) const
inline

Returns global trust-anchor.

Definition at line 685 of file ha_config.h.

References trust_anchor_.

◆ HAModeToString()

std::string isc::ha::HAConfig::HAModeToString ( const HAMode & ha_mode)
static

Returns HA mode name.

Parameters
ha_modeHA mode which name should be returned.
Returns
HA mode name.

Definition at line 233 of file ha_config.cc.

References HOT_STANDBY, LOAD_BALANCING, and PASSIVE_BACKUP.

Referenced by isc::ha::HAService::HAService(), and isc::ha::HAImpl::commandProcessed().

◆ selectNextPeerConfig()

HAConfig::PeerConfigPtr isc::ha::HAConfig::selectNextPeerConfig ( const std::string & name)

Creates and returns pointer to the new peer's configuration.

This method is called during peers configuration parsing, when the parser starts reading configuration of the next peer on the list. It will store parsed values into this object.

Parameters
nameName of the server for which new configuration should be created.
Exceptions
BadValueif there is already a configuration for the given server name.

Definition at line 183 of file ha_config.cc.

References isc_throw, and peers_.

◆ setCertFile()

void isc::ha::HAConfig::setCertFile ( const util::Optional< std::string > & cert)
inline

Sets global cert-file.

Parameters
certCertificate file name.

Definition at line 704 of file ha_config.h.

References cert_file_.

◆ setDelayedUpdatesLimit()

void isc::ha::HAConfig::setDelayedUpdatesLimit ( const uint32_t delayed_updates_limit)
inline

Sets new limit for the number of lease updates to be held unsent in the communication-recovery state.

If the server is in the communication-recovery state it is unable to send lease updates to the partner. Instead it keeps lease updates, hoping to send them when the communication is resumed. This value designates a limit of how many such updates can be held. If this number is exceeded the server continues to respond to the clients but will have to go through regular lease database synchronization when the communication is resumed.

Parameters
delayed_updates_limitnew limit.

Definition at line 480 of file ha_config.h.

References delayed_updates_limit_.

◆ setEnableMultiThreading()

void isc::ha::HAConfig::setEnableMultiThreading ( bool enable_multi_threading)
inline

Sets whether or not server is configured for multi-threaded operation.

Parameters
enable_multi_threadingboolean flag that enables multi-threaded operation when true.

Definition at line 632 of file ha_config.h.

References enable_multi_threading_.

◆ setHAMode()

void isc::ha::HAConfig::setHAMode ( const std::string & ha_mode)

Sets new mode of operation.

The following modes of operation are supported:

  • load-balancing
  • hot-standby
Parameters
ha_modeHigh Availability mode operation in textual form.
Exceptions
BadValueif non-supported mode of operation has been specified.

Definition at line 213 of file ha_config.cc.

References ha_mode_, and stringToHAMode().

+ Here is the call graph for this function:

◆ setHeartbeatDelay()

void isc::ha::HAConfig::setHeartbeatDelay ( const uint32_t heartbeat_delay)
inline

Sets new heartbeat delay in milliseconds.

This value indicates the delay in sending a heartbeat command after last heartbeat or some other command to the partner. A value of zero disables the heartbeat.

Parameters
heartbeat_delaynew heartbeat delay value.

Definition at line 513 of file ha_config.h.

References heartbeat_delay_.

◆ setHttpClientThreads()

void isc::ha::HAConfig::setHttpClientThreads ( uint32_t http_client_threads)
inline

Sets the number of threads the HTTP client should use.

Parameters
http_client_threadsnumber of threads the client should use.

Definition at line 680 of file ha_config.h.

References http_client_threads_.

◆ setHttpDedicatedListener()

void isc::ha::HAConfig::setHttpDedicatedListener ( bool http_dedicated_listener)
inline

Sets whether or not the server is configured to use its own HTTP listener.

Parameters
http_dedicated_listenerflag that enables the use of a dedicated listener when true.

Definition at line 652 of file ha_config.h.

References http_dedicated_listener_.

◆ setHttpListenerThreads()

void isc::ha::HAConfig::setHttpListenerThreads ( uint32_t http_listener_threads)
inline

Sets the number of threads the HTTP listener should use.

Parameters
http_listener_threadsnumber of threads the listener should use.

Definition at line 666 of file ha_config.h.

References http_listener_threads_.

◆ setKeyFile()

void isc::ha::HAConfig::setKeyFile ( const util::Optional< std::string > & key)
inline

Sets global key-file.

Parameters
keyPrivate key file name.

Definition at line 716 of file ha_config.h.

References key_file_.

◆ setMaxAckDelay()

void isc::ha::HAConfig::setMaxAckDelay ( const uint32_t max_ack_delay)
inline

Sets maximum time for a client trying to communicate with DHCP server to completed the transaction.

Parameters
max_ack_delaymaximum time in milliseconds.

Definition at line 549 of file ha_config.h.

References max_ack_delay_.

◆ setMaxRejectedLeaseUpdates()

void isc::ha::HAConfig::setMaxRejectedLeaseUpdates ( const uint32_t max_rejected_lease_updates)
inline

Sets the maximum number of clients for whom the lease updates can fail due to other than general error.

The service is terminated when the actual number of rejected clients is equal or greater that number.

Parameters
max_rejected_lease_updatesmaximum number of distinct clients for which the lease updates can fail before the server terminates the HA service. A special value of 0 configures the server to never transition to the terminated state as a result of the lease updates issues.

Definition at line 598 of file ha_config.h.

References max_rejected_lease_updates_.

◆ setMaxResponseDelay()

void isc::ha::HAConfig::setMaxResponseDelay ( const uint32_t max_response_delay)
inline

Sets new max response delay.

Max response delay is the maximum time that the server is waiting for its partner to respond to the heartbeats (and lease updates) before it assumes the communications interrupted state.

Parameters
max_response_delay

Definition at line 533 of file ha_config.h.

References max_response_delay_.

◆ setMaxUnackedClients()

void isc::ha::HAConfig::setMaxUnackedClients ( const uint32_t max_unacked_clients)
inline

Set maximum number of clients which may fail to communicate with the DHCP server before entering partner down state.

Parameters
max_unacked_clientsmaximum number of clients.

Definition at line 565 of file ha_config.h.

References max_unacked_clients_.

◆ setRequireClientCerts()

void isc::ha::HAConfig::setRequireClientCerts ( bool flag)
inline

Sets require-client-certs.

Parameters
flagRequire client certs flag value.

Definition at line 728 of file ha_config.h.

References require_client_certs_.

◆ setRestrictCommands()

void isc::ha::HAConfig::setRestrictCommands ( bool flag)
inline

Sets restrict-commands.

Parameters
flagRestrict commands to HA flag value.

Definition at line 740 of file ha_config.h.

References restrict_commands_.

◆ setSendLeaseUpdates()

void isc::ha::HAConfig::setSendLeaseUpdates ( const bool send_lease_updates)
inline

Sets boolean flag indicating whether lease updates should be sent to the partner.

Disabling lease updates is useful in cases when lease database replication is enabled, e.g. MySQL database replication. The database itself takes care of updating the backup database with new data. Sending lease updates is enabled by default.

Parameters
send_lease_updatesnew value for the flag.

Definition at line 399 of file ha_config.h.

References send_lease_updates_.

◆ setSyncLeases()

void isc::ha::HAConfig::setSyncLeases ( const bool sync_leases)
inline

Sets boolean flag indicating whether the active servers should synchronize their lease databases upon startup.

Disabling lease database synchronization is useful in cases when lease database replication is enabled. See the description of the setSendLeaseUpdates. Lease database synchronization is enabled by default on active HA servers.

Parameters
sync_leasesnew value for the flag.

Definition at line 418 of file ha_config.h.

References sync_leases_.

◆ setSyncPageLimit()

void isc::ha::HAConfig::setSyncPageLimit ( const uint32_t sync_page_limit)
inline

Sets new page limit size for leases fetched from the partner during database synchronization.

Parameters
sync_page_limitNew page limit value.

Definition at line 448 of file ha_config.h.

References sync_page_limit_.

◆ setSyncTimeout()

void isc::ha::HAConfig::setSyncTimeout ( const uint32_t sync_timeout)
inline

Sets new lease database syncing timeout in milliseconds.

Parameters
sync_timeoutnew timeout for lease database synchronization.

Definition at line 432 of file ha_config.h.

References sync_timeout_.

◆ setThisServerName()

void isc::ha::HAConfig::setThisServerName ( const std::string & this_server_name)

Sets name of this server.

Parameters
this_server_nameThis server name.
Exceptions
BadValueIf the provided server name is empty.

Definition at line 201 of file ha_config.cc.

References isc_throw, this_server_name_, and isc::util::str::trim().

+ Here is the call graph for this function:

◆ setTrustAnchor()

void isc::ha::HAConfig::setTrustAnchor ( const util::Optional< std::string > & ca)
inline

Sets global trust-anchor.

Parameters
caTrust anchor aka Certificate Authority.

Definition at line 692 of file ha_config.h.

References trust_anchor_.

◆ setWaitBackupAck()

void isc::ha::HAConfig::setWaitBackupAck ( const bool wait_backup_ack)
inline

Configures the server to wait/not wait for the lease update acknowledgments from the backup servers.

Parameters
wait_backup_ackindicates that the server should wait for the lease update acknowledgments from the backup servers (if true) or that it should not (if false).

Definition at line 608 of file ha_config.h.

References wait_backup_ack_.

◆ stringToHAMode()

HAConfig::HAMode isc::ha::HAConfig::stringToHAMode ( const std::string & ha_mode)
static

Decodes HA mode provided as string.

Parameters
ha_modeHA mode as string.
Returns
HA mode converted from string.
Exceptions
BadValueif specified HA mode name is unsupported.

Definition at line 218 of file ha_config.cc.

References HOT_STANDBY, isc_throw, LOAD_BALANCING, and PASSIVE_BACKUP.

Referenced by setHAMode().

◆ validate()

void isc::ha::HAConfig::validate ( )

Validates configuration.

In addition to sanity checking the configuration, it will check HA+MT configuration against Core multi-threading configuration add adjust HA+MT values as follows:

  1. If DHCP multi-threading is disabled, HA+MT will be disabled.
  2. If http-listener-threads is 0, it will be replaced with the number of DHCP threads
  3. If http-client-threads is 0, it will be replaced with the number of DHCP threads

As a side effect it fills the TLS context of peers when TLS is enabled.

Exceptions
HAConfigValidationErrorif configuration is invalid.

Definition at line 283 of file ha_config.cc.

References cert_file_, delayed_updates_limit_, isc::util::MultiThreadingMgr::detectThreadCount(), enable_multi_threading_, isc::dhcp::CfgMultiThreading::extract(), getRequireClientCerts(), getThisServerName(), isc::ha::HA_CONFIG_DHCP_MT_DISABLED, isc::ha::HA_CONFIG_DHCP_MT_DISABLED_AND_KEA_MT_ENABLED, isc::ha::HA_CONFIG_SYSTEM_MT_UNSUPPORTED, isc::ha::ha_logger, ha_mode_, HOT_STANDBY, http_client_threads_, http_listener_threads_, isc::http::Url::HTTPS, isc::dhcp::CfgMgr::instance(), isc_throw, key_file_, LOAD_BALANCING, LOG_INFO, LOG_WARN, PASSIVE_BACKUP, peers_, isc::ha::HAConfig::PeerConfig::PRIMARY, isc::ha::HAConfig::PeerConfig::SECONDARY, isc::ha::HAConfig::PeerConfig::STANDBY, trust_anchor_, wait_backup_ack_, and isc::Exception::what().

+ Here is the call graph for this function:

Member Data Documentation

◆ cert_file_

util::Optional<std::string> isc::ha::HAConfig::cert_file_

Certificate file.

Definition at line 839 of file ha_config.h.

Referenced by getCertFile(), setCertFile(), and validate().

◆ delayed_updates_limit_

uint32_t isc::ha::HAConfig::delayed_updates_limit_

Maximum number of lease updates held for later send in communication-recovery.

Definition at line 826 of file ha_config.h.

Referenced by amAllowingCommRecovery(), getDelayedUpdatesLimit(), setDelayedUpdatesLimit(), and validate().

◆ enable_multi_threading_

bool isc::ha::HAConfig::enable_multi_threading_

Enable multi-threading.

Definition at line 834 of file ha_config.h.

Referenced by getEnableMultiThreading(), setEnableMultiThreading(), and validate().

◆ ha_mode_

HAMode isc::ha::HAConfig::ha_mode_

Mode of operation.

Definition at line 820 of file ha_config.h.

Referenced by getHAMode(), setHAMode(), and validate().

◆ heartbeat_delay_

uint32_t isc::ha::HAConfig::heartbeat_delay_

Heartbeat delay in milliseconds.

Definition at line 828 of file ha_config.h.

Referenced by getHeartbeatDelay(), and setHeartbeatDelay().

◆ http_client_threads_

uint32_t isc::ha::HAConfig::http_client_threads_

Number of HTTP client threads.

Definition at line 837 of file ha_config.h.

Referenced by getHttpClientThreads(), setHttpClientThreads(), and validate().

◆ http_dedicated_listener_

bool isc::ha::HAConfig::http_dedicated_listener_

Enable use of own HTTP listener.

Definition at line 835 of file ha_config.h.

Referenced by getHttpDedicatedListener(), and setHttpDedicatedListener().

◆ http_listener_threads_

uint32_t isc::ha::HAConfig::http_listener_threads_

Number of HTTP listener threads.

Definition at line 836 of file ha_config.h.

Referenced by getHttpListenerThreads(), setHttpListenerThreads(), and validate().

◆ key_file_

util::Optional<std::string> isc::ha::HAConfig::key_file_

Private key file.

Definition at line 840 of file ha_config.h.

Referenced by getKeyFile(), setKeyFile(), and validate().

◆ max_ack_delay_

uint32_t isc::ha::HAConfig::max_ack_delay_

Maximum DHCP message ack delay.

Definition at line 830 of file ha_config.h.

Referenced by getMaxAckDelay(), and setMaxAckDelay().

◆ max_rejected_lease_updates_

uint32_t isc::ha::HAConfig::max_rejected_lease_updates_

Limit of rejected lease updates before termination.

Definition at line 832 of file ha_config.h.

Referenced by getMaxRejectedLeaseUpdates(), and setMaxRejectedLeaseUpdates().

◆ max_response_delay_

uint32_t isc::ha::HAConfig::max_response_delay_

Max delay in response to heartbeats.

Definition at line 829 of file ha_config.h.

Referenced by getMaxResponseDelay(), and setMaxResponseDelay().

◆ max_unacked_clients_

uint32_t isc::ha::HAConfig::max_unacked_clients_

Maximum number of unacked clients.

Definition at line 831 of file ha_config.h.

Referenced by getMaxUnackedClients(), and setMaxUnackedClients().

◆ peers_

PeerConfigMap isc::ha::HAConfig::peers_

Map of peers' configurations.

Definition at line 843 of file ha_config.h.

Referenced by getAllServersConfig(), getOtherServersConfig(), getPeerConfig(), selectNextPeerConfig(), and validate().

◆ require_client_certs_

bool isc::ha::HAConfig::require_client_certs_

Require client certs flag.

Definition at line 841 of file ha_config.h.

Referenced by getRequireClientCerts(), and setRequireClientCerts().

◆ restrict_commands_

bool isc::ha::HAConfig::restrict_commands_

Restrict commands to HA flag.

Definition at line 842 of file ha_config.h.

Referenced by getRestrictCommands(), and setRestrictCommands().

◆ send_lease_updates_

bool isc::ha::HAConfig::send_lease_updates_

Send lease updates to partner?

Definition at line 821 of file ha_config.h.

Referenced by amSendingLeaseUpdates(), and setSendLeaseUpdates().

◆ state_machine_

StateMachineConfigPtr isc::ha::HAConfig::state_machine_

State machine configuration.

Definition at line 844 of file ha_config.h.

Referenced by getStateMachineConfig().

◆ sync_leases_

bool isc::ha::HAConfig::sync_leases_

Synchronize databases on startup?

Definition at line 822 of file ha_config.h.

Referenced by amSyncingLeases(), and setSyncLeases().

◆ sync_page_limit_

uint32_t isc::ha::HAConfig::sync_page_limit_

Page size limit while synchronizing leases.

Definition at line 824 of file ha_config.h.

Referenced by getSyncPageLimit(), and setSyncPageLimit().

◆ sync_timeout_

uint32_t isc::ha::HAConfig::sync_timeout_

Timeout for syncing lease database (ms)

Definition at line 823 of file ha_config.h.

Referenced by getSyncTimeout(), and setSyncTimeout().

◆ this_server_name_

std::string isc::ha::HAConfig::this_server_name_

This server name.

Definition at line 819 of file ha_config.h.

Referenced by getThisServerName(), and setThisServerName().

◆ trust_anchor_

util::Optional<std::string> isc::ha::HAConfig::trust_anchor_

Trust anchor.

Definition at line 838 of file ha_config.h.

Referenced by getTrustAnchor(), setTrustAnchor(), and validate().

◆ wait_backup_ack_

bool isc::ha::HAConfig::wait_backup_ack_

Wait for lease update ack from backup?

Definition at line 833 of file ha_config.h.

Referenced by amWaitingBackupAck(), setWaitBackupAck(), and validate().


The documentation for this class was generated from the following files: