Commit 68bfa902 authored by Marcin Siodelski's avatar Marcin Siodelski
Browse files

[3744] Parse lease db after subnets configuration

This patch runs the database parser last (after subnets have been parsed).
This allows, for example, to access the subnets staging configuration
when leases are being loaded from disk.
parent 989d1f55
......@@ -414,12 +414,13 @@ configureDhcp4Server(Dhcpv4Srv&, isc::data::ConstElementPtr config_set) {
// depend on the global values. Also, option values configuration
// must be performed after the option definitions configurations.
// Thus we group parsers and will fire them in the right order:
// all parsers other than subnet4 and option-data parser,
// option-data parser, subnet4 parser.
// all parsers other than: lease-database, subnet4 and option-data parser,
// then: option-data parser, subnet4 parser, lease-database parser.
ParserCollection independent_parsers;
ParserPtr subnet_parser;
ParserPtr option_parser;
ParserPtr iface_parser;
ParserPtr leases_parser;
// Some of the parsers alter the state of the system in a way that can't
// easily be undone. (Or alter it in a way such that undoing the change has
......@@ -455,6 +456,8 @@ configureDhcp4Server(Dhcpv4Srv&, isc::data::ConstElementPtr config_set) {
if (config_pair.first == "subnet4") {
subnet_parser = parser;
} else if (config_pair.first == "lease-database") {
leases_parser = parser;
} else if (config_pair.first == "option-data") {
option_parser = parser;
} else if (config_pair.first == "interfaces-config") {
......@@ -489,7 +492,7 @@ configureDhcp4Server(Dhcpv4Srv&, isc::data::ConstElementPtr config_set) {
// The subnet parser is the last one to be run.
// The subnet parser is the next one to be run.
std::map<std::string, ConstElementPtr>::const_iterator subnet_config =
if (subnet_config != values_map.end()) {
......@@ -497,6 +500,15 @@ configureDhcp4Server(Dhcpv4Srv&, isc::data::ConstElementPtr config_set) {
// the leases database parser is the last to be run.
std::map<std::string, ConstElementPtr>::const_iterator leases_config =
if (leases_config != values_map.end()) {
config_pair.first = "lease-database";
} catch (const isc::Exception& ex) {
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment