Commit 834010d4 authored by Marcin Siodelski's avatar Marcin Siodelski

[#717,!417] Use ANY server selector when fetching subnets for shared net.

parent 78395238
......@@ -2114,7 +2114,7 @@ TaggedStatementArray tagged_statements = { {
// Select subnets belonging to a shared network.
{ MySqlConfigBackendDHCPv4Impl::GET_SHARED_NETWORK_SUBNETS4,
MYSQL_GET_SUBNET4_NO_TAG(WHERE s.shared_network_name = ?)
MYSQL_GET_SUBNET4_ANY(WHERE s.shared_network_name = ?)
},
// Select pool by address range.
......@@ -2643,12 +2643,12 @@ MySqlConfigBackendDHCPv4::getModifiedSubnets4(const ServerSelector& server_selec
}
Subnet4Collection
MySqlConfigBackendDHCPv4::getSharedNetworkSubnets4(const ServerSelector& server_selector,
MySqlConfigBackendDHCPv4::getSharedNetworkSubnets4(const ServerSelector& /* server_selector */,
const std::string& shared_network_name) const {
LOG_DEBUG(mysql_cb_logger, DBGLVL_TRACE_BASIC, MYSQL_CB_GET_SHARED_NETWORK_SUBNETS4)
.arg(shared_network_name);
Subnet4Collection subnets;
impl_->getSharedNetworkSubnets4(server_selector, shared_network_name, subnets);
impl_->getSharedNetworkSubnets4(ServerSelector::ANY(), shared_network_name, subnets);
LOG_DEBUG(mysql_cb_logger, DBGLVL_TRACE_BASIC, MYSQL_CB_GET_SHARED_NETWORK_SUBNETS4_RESULT)
.arg(subnets.size());
return (subnets);
......
......@@ -71,6 +71,10 @@ public:
/// @brief Retrieves all subnets belonging to a specified shared network.
///
/// The server selector is currently ignored by this method. All subnets
/// for the given shared network are returned regardless of their
/// associations with the servers.
///
/// @param server_selector Server selector.
/// @param shared_network_name Name of the shared network for which the
/// subnets should be retrieved.
......
......@@ -2439,7 +2439,7 @@ TaggedStatementArray tagged_statements = { {
// Select subnets belonging to a shared network.
{ MySqlConfigBackendDHCPv6Impl::GET_SHARED_NETWORK_SUBNETS6,
MYSQL_GET_SUBNET6_NO_TAG(WHERE s.shared_network_name = ?)
MYSQL_GET_SUBNET6_ANY(WHERE s.shared_network_name = ?)
},
// Select pool by address range.
......@@ -3011,12 +3011,12 @@ MySqlConfigBackendDHCPv6::getModifiedSubnets6(const ServerSelector& server_selec
}
Subnet6Collection
MySqlConfigBackendDHCPv6::getSharedNetworkSubnets6(const ServerSelector& server_selector,
MySqlConfigBackendDHCPv6::getSharedNetworkSubnets6(const ServerSelector& /* server_selector */,
const std::string& shared_network_name) const {
LOG_DEBUG(mysql_cb_logger, DBGLVL_TRACE_BASIC, MYSQL_CB_GET_SHARED_NETWORK_SUBNETS6)
.arg(shared_network_name);
Subnet6Collection subnets;
impl_->getSharedNetworkSubnets6(server_selector, shared_network_name, subnets);
impl_->getSharedNetworkSubnets6(ServerSelector::ANY(), shared_network_name, subnets);
LOG_DEBUG(mysql_cb_logger, DBGLVL_TRACE_BASIC, MYSQL_CB_GET_SHARED_NETWORK_SUBNETS6_RESULT)
.arg(subnets.size());
return (subnets);
......
......@@ -71,6 +71,10 @@ public:
/// @brief Retrieves all subnets belonging to a specified shared network.
///
/// The server selector is currently ignored by this method. All subnets
/// for the given shared network are returned regardless of their
/// associations with the servers.
///
/// @param server_selector Server selector.
/// @param shared_network_name Name of the shared network for which the
/// subnets should be retrieved.
......
......@@ -1868,8 +1868,8 @@ TEST_F(MySqlConfigBackendDHCPv4Test, getSharedNetworkSubnets4) {
EXPECT_TRUE(isEquivalent(test_subnets_[1]->toElement(),
subnets[0]->toElement()));
// All subnets should also be returned for explicitly specified server tag.
subnets = cbptr_->getSharedNetworkSubnets4(ServerSelector::ONE("server1"), "level1");
// All subnets should also be returned for ANY server.
subnets = cbptr_->getSharedNetworkSubnets4(ServerSelector::ANY(), "level1");
ASSERT_EQ(1, subnets.size());
// Returned subnet should match test subnet #1.
......
......@@ -1887,8 +1887,8 @@ TEST_F(MySqlConfigBackendDHCPv6Test, getSharedNetworkSubnets6) {
EXPECT_TRUE(isEquivalent(test_subnets_[1]->toElement(),
subnets[0]->toElement()));
// All subnets should also be returned for explicitly specified server tag.
subnets = cbptr_->getSharedNetworkSubnets6(ServerSelector::ONE("server1"), "level1");
// All subnets should also be returned for ANY server.
subnets = cbptr_->getSharedNetworkSubnets6(ServerSelector::ANY(), "level1");
ASSERT_EQ(1, subnets.size());
// Returned subnet should match test subnet #1.
......
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