Commit eae67190 authored by Marcin Siodelski's avatar Marcin Siodelski

[3852] Created new logger for allocation engine.

Also, moved alloc-engine specific messages to separate files.
parent af2522bf
......@@ -160,6 +160,13 @@
the settings from this logger if there is no specialized logger
provided.</simpara>
</listitem>
<listitem>
<simpara><command>kea-dhcp4.alloc-engine</command> - this is the
logger used by the lease allocation engine, which is responsible
for managing leases in the lease database, i.e. create, modify
and remove DHCPv4 leases as a result of processing messages from
the clients.</simpara>
</listitem>
<listitem>
<simpara><command>kea-dhcp4.bad-packets</command> - this is the
logger used by the DHCPv4 server deamon for logging inbound client
......@@ -253,6 +260,13 @@
<simpara><command>kea-dhcp6.dhcp6</command> - this is the logger
used DHCPv6 server deamon to log basic operations.</simpara>
</listitem>
<listitem>
<simpara><command>kea-dhcp6.alloc-engine</command> - this is the
logger used by the lease allocation engine, which is responsible
for managing leases in the lease database, i.e. create, modify
and remove DHCPv6 leases as a result of processing messages from
the clients.</simpara>
</listitem>
<listitem>
<simpara><command>kea-dhcp6.dhcpsrv</command> - this is a base
logger for the libdhcpsrv library.</simpara>
......
/alloc_engine_messages.cc
/alloc_engine_messages.h
/dhcpsrv_messages.cc
/dhcpsrv_messages.h
/hosts_messages.cc
......
......@@ -35,21 +35,26 @@ EXTRA_DIST += parsers/host_reservation_parser.h
EXTRA_DIST += parsers/host_reservations_list_parser.h
# Define rule to build logging source files from message file
dhcpsrv_messages.h dhcpsrv_messages.cc hosts_messages.h hosts_messages.cc: s-messages
alloc_engine_messages.h alloc_engine_messages.cc dhcpsrv_messages.h \
dhcpsrv_messages.cc hosts_messages.h hosts_messages.cc: s-messages
s-messages: dhcpsrv_messages.mes hosts_messages.mes
s-messages: alloc_engine_messages.mes dhcpsrv_messages.mes hosts_messages.mes
$(top_builddir)/src/lib/log/compiler/message $(top_srcdir)/src/lib/dhcpsrv/alloc_engine_messages.mes
touch $@
$(top_builddir)/src/lib/log/compiler/message $(top_srcdir)/src/lib/dhcpsrv/dhcpsrv_messages.mes
touch $@
$(top_builddir)/src/lib/log/compiler/message $(top_srcdir)/src/lib/dhcpsrv/hosts_messages.mes
touch $@
# Tell Automake that the {dhcpsrv,hosts}_messages.{cc,h} source files are created
# in the build process, so it must create these before doing anything else.
# Although they are a dependency of the library (so will be created from the message
# file anyway), there is no guarantee as to exactly _when_ in the build they will be
# created. As the .h file is included in other sources file (so must be
# present when they are compiled), the safest option is to create it first.
BUILT_SOURCES = dhcpsrv_messages.h dhcpsrv_messages.cc
# Tell Automake that the {alloc_engine,dhcpsrv,hosts}_messages.{cc,h} source files
# are created in the build process, so it must create these before doing anything
# else. Although they are a dependency of the library (so will be created from the
# message file anyway), there is no guarantee as to exactly _when_ in the build
# they will be created. As the .h file is included in other sources file (so
# must be present when they are compiled), the safest option is to create it
# first.
BUILT_SOURCES = alloc_engine_messages.h alloc_engine_messages.cc
BUILT_SOURCES += dhcpsrv_messages.h dhcpsrv_messages.cc
BUILT_SOURCES += hosts_messages.h hosts_messages.cc
# Some versions of GCC warn about some versions of Boost regarding
......@@ -59,7 +64,9 @@ BUILT_SOURCES += hosts_messages.h hosts_messages.cc
AM_CXXFLAGS += $(WARNING_NO_MISSING_FIELD_INITIALIZERS_CFLAG)
# Make sure the generated files are deleted in a "clean" operation
CLEANFILES = *.gcno *.gcda dhcpsrv_messages.h dhcpsrv_messages.cc
CLEANFILES = *.gcno *.gcda
CLEANFILES += alloc_engine_messages.h alloc_engine_messages.cc
CLEANFILES += dhcpsrv_messages.h dhcpsrv_messages.cc
CLEANFILES += hosts_messages.h hosts_messages.cc s-messages
# Remove CSV files created by the CSVLeaseFile6 and CSVLeaseFile4 unit tests.
CLEANFILES += *.csv
......@@ -68,6 +75,7 @@ lib_LTLIBRARIES = libkea-dhcpsrv.la
libkea_dhcpsrv_la_SOURCES =
libkea_dhcpsrv_la_SOURCES += addr_utilities.cc addr_utilities.h
libkea_dhcpsrv_la_SOURCES += alloc_engine.cc alloc_engine.h
libkea_dhcpsrv_la_SOURCES += alloc_engine_log.cc alloc_engine_log.h
libkea_dhcpsrv_la_SOURCES += base_host_data_source.h
libkea_dhcpsrv_la_SOURCES += callout_handle_store.h
libkea_dhcpsrv_la_SOURCES += cfg_hosts.cc cfg_hosts.h
......@@ -128,8 +136,9 @@ libkea_dhcpsrv_la_SOURCES += parsers/host_reservations_list_parser.h
libkea_dhcpsrv_la_SOURCES += parsers/ifaces_config_parser.cc
libkea_dhcpsrv_la_SOURCES += parsers/ifaces_config_parser.h
nodist_libkea_dhcpsrv_la_SOURCES = dhcpsrv_messages.h dhcpsrv_messages.cc
nodist_libkea_dhcpsrv_la_SOURCES = alloc_engine__messages.h
nodist_libkea_dhcpsrv_la_SOURCES += alloc_engine_messages.cc
nodist_libkea_dhcpsrv_la_SOURCES += dhcpsrv_messages.h dhcpsrv_messages.cc
nodist_libkea_dhcpsrv_la_SOURCES += hosts_messages.h hosts_messages.cc
libkea_dhcpsrv_la_CXXFLAGS = $(AM_CXXFLAGS)
......@@ -159,6 +168,7 @@ libkea_dhcpsrv_la_CXXFLAGS += -Wno-unused-parameter
endif
# The message file should be in the distribution
EXTRA_DIST += alloc_engine_messages.mes
EXTRA_DIST += dhcpsrv_messages.mes
EXTRA_DIST += hosts_messages.mes
......
......@@ -15,6 +15,7 @@
#include <config.h>
#include <dhcpsrv/alloc_engine.h>
#include <dhcpsrv/alloc_engine_log.h>
#include <dhcpsrv/dhcpsrv_log.h>
#include <dhcpsrv/host_mgr.h>
#include <dhcpsrv/host.h>
......@@ -484,12 +485,12 @@ AllocEngine::allocateLeases6(ClientContext6& ctx) {
}
// Unable to allocate an address, return an empty lease.
LOG_WARN(dhcpsrv_logger, DHCPSRV_ADDRESS6_ALLOC_FAIL).arg(attempts_);
LOG_WARN(alloc_engine_logger, ALLOC_ENGINE_ADDRESS6_ALLOC_FAIL).arg(attempts_);
} catch (const isc::Exception& e) {
// Some other error, return an empty lease.
LOG_ERROR(dhcpsrv_logger, DHCPSRV_ADDRESS6_ALLOC_ERROR).arg(e.what());
LOG_ERROR(alloc_engine_logger, ALLOC_ENGINE_ADDRESS6_ALLOC_ERROR).arg(e.what());
}
return (Lease6Collection());
......@@ -706,10 +707,10 @@ AllocEngine::allocateReservedLeases6(ClientContext6& ctx, Lease6Collection& exis
existing_leases.push_back(lease);
if (ctx.type_ == Lease::TYPE_NA) {
LOG_INFO(dhcpsrv_logger, DHCPSRV_HR_RESERVED_ADDR_GRANTED)
LOG_INFO(alloc_engine_logger, ALLOC_ENGINE_HR_RESERVED_ADDR_GRANTED)
.arg(addr.toText()).arg(ctx.duid_->toText());
} else {
LOG_INFO(dhcpsrv_logger, DHCPSRV_HR_RESERVED_PREFIX_GRANTED)
LOG_INFO(alloc_engine_logger, ALLOC_ENGINE_HR_RESERVED_PREFIX_GRANTED)
.arg(addr.toText()).arg(static_cast<int>(prefix_len))
.arg(ctx.duid_->toText());
}
......@@ -759,11 +760,11 @@ AllocEngine::removeNonmatchingReservedLeases6(ClientContext6& ctx,
// Ok, we have a problem. This host has a lease that is reserved
// for someone else. We need to recover from this.
if (ctx.type_ == Lease::TYPE_NA) {
LOG_INFO(dhcpsrv_logger, DHCPSRV_HR_REVOKED_ADDR6_LEASE)
LOG_INFO(alloc_engine_logger, ALLOC_ENGINE_HR_REVOKED_ADDR6_LEASE)
.arg((*candidate)->addr_.toText()).arg(ctx.duid_->toText())
.arg(host->getIdentifierAsText());
} else {
LOG_INFO(dhcpsrv_logger, DHCPSRV_HR_REVOKED_PREFIX6_LEASE)
LOG_INFO(alloc_engine_logger, ALLOC_ENGINE_HR_REVOKED_PREFIX6_LEASE)
.arg((*candidate)->addr_.toText())
.arg(static_cast<int>((*candidate)->prefixlen_))
.arg(ctx.duid_->toText())
......@@ -1316,12 +1317,12 @@ AllocEngine::allocateLease4(ClientContext4& ctx) {
new_lease = ctx.fake_allocation_ ? discoverLease4(ctx) : requestLease4(ctx);
if (!new_lease) {
// Unable to allocate an address, return an empty lease.
LOG_WARN(dhcpsrv_logger, DHCPSRV_ADDRESS4_ALLOC_FAIL).arg(attempts_);
LOG_WARN(alloc_engine_logger, ALLOC_ENGINE_ADDRESS4_ALLOC_FAIL).arg(attempts_);
}
} catch (const isc::Exception& e) {
// Some other error, return an empty lease.
LOG_ERROR(dhcpsrv_logger, DHCPSRV_ADDRESS4_ALLOC_ERROR).arg(e.what());
LOG_ERROR(alloc_engine_logger, ALLOC_ENGINE_ADDRESS4_ALLOC_ERROR).arg(e.what());
}
return (new_lease);
......@@ -1375,7 +1376,7 @@ AllocEngine::discoverLease4(AllocEngine::ClientContext4& ctx) {
// allocate in the DHCPREQUEST time.
new_lease = allocateOrReuseLease4(ctx.host_->getIPv4Reservation(), ctx);
if (!new_lease) {
LOG_WARN(dhcpsrv_logger, DHCPSRV_DISCOVER_ADDRESS_CONFLICT)
LOG_WARN(alloc_engine_logger, ALLOC_ENGINE_DISCOVER_ADDRESS_CONFLICT)
.arg(ctx.host_->getIPv4Reservation().toText())
.arg(ctx.conflicting_lease_ ? ctx.conflicting_lease_->toText() :
"(no lease info)");
......
// Copyright (C) 2015 Internet Systems Consortium, Inc. ("ISC")
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice appear in all copies.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
// AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
// PERFORMANCE OF THIS SOFTWARE.
/// @file Defines the logger used by the @c isc::dhcp::HostMgr
#include "dhcpsrv/alloc_engine_log.h"
namespace isc {
namespace dhcp {
isc::log::Logger alloc_engine_logger("alloc-engine");
} // namespace dhcp
} // namespace isc
// Copyright (C) 2015 Internet Systems Consortium, Inc. ("ISC")
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice appear in all copies.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
// AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
// PERFORMANCE OF THIS SOFTWARE.
#ifndef ALLOC_ENGINE_LOG_H
#define ALLOC_ENGINE_LOG_H
#include <dhcpsrv/alloc_engine_messages.h>
#include <log/macros.h>
namespace isc {
namespace dhcp {
///@{
/// \brief Logging levels for the @c AllocEngine.
///
/// Defines the levels used to output debug messages from the @c AllocEngine.
/// @brief Traces normal operations
const int ALLOC_ENGINE_DBG_TRACE = DBGLVL_TRACE_BASIC;
/// @brief Records the results of various operations.
///
/// Messages logged at this level will typically contain summary of the
/// data retrieved.
const int ALLOC_ENGINE_DBG_RESULTS = DBGLVL_TRACE_BASIC_DATA;
/// @brief Record detailed traces
///
/// Messages logged at this level will log detailed tracing information.
const int ALLOC_ENGINE_DBG_TRACE_DETAIL = DBGLVL_TRACE_DETAIL;
/// @brief Records detailed results of various operations.
///
/// Messages logged at this level will contain detailed results.
const int ALLOC_ENGINE_DBG_TRACE_DETAIL_DATA = DBGLVL_TRACE_DETAIL_DATA;
///@}
/// @brief Logger for the @c AllocEngine..
///
/// Define the logger used to log messages in @c AllocEngine.
extern isc::log::Logger alloc_engine_logger;
} // namespace dhcp
} // namespace isc
#endif // ALLOC_ENGINE_LOG_H
# Copyright (C) 2015 Internet Systems Consortium, Inc. ("ISC")
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
# PERFORMANCE OF THIS SOFTWARE.
$NAMESPACE isc::dhcp
% ALLOC_ENGINE_ADDRESS4_ALLOC_ERROR error during attempt to allocate an IPv4 address: %1
An error occurred during an attempt to allocate an IPv4 address, the
reason for the failure being contained in the message. The server will
return a message to the client refusing a lease.
% ALLOC_ENGINE_ADDRESS4_ALLOC_FAIL failed to allocate an IPv4 address after %1 attempt(s)
The DHCP allocation engine gave up trying to allocate an IPv4 address
after the specified number of attempts. This probably means that the
address pool from which the allocation is being attempted is either
empty, or very nearly empty. As a result, the client will have been
refused a lease.
This message may indicate that your address pool is too small for the
number of clients you are trying to service and should be expanded.
Alternatively, if the you know that the number of concurrently active
clients is less than the addresses you have available, you may want to
consider reducing the lease lifetime. In this way, addresses allocated
to clients that are no longer active on the network will become available
available sooner.
% ALLOC_ENGINE_ADDRESS6_ALLOC_ERROR error during attempt to allocate an IPv6 address: %1
An error occurred during an attempt to allocate an IPv6 address, the
reason for the failure being contained in the message. The server will
return a message to the client refusing a lease.
% ALLOC_ENGINE_ADDRESS6_ALLOC_FAIL failed to allocate an IPv6 address after %1 attempt(s)
The DHCP allocation engine gave up trying to allocate an IPv6 address
after the specified number of attempts. This probably means that the
address pool from which the allocation is being attempted is either
empty, or very nearly empty. As a result, the client will have been
refused a lease.
This message may indicate that your address pool is too small for the
number of clients you are trying to service and should be expanded.
Alternatively, if the you know that the number of concurrently active
clients is less than the addresses you have available, you may want to
consider reducing the lease lifetime. In this way, addresses allocated
to clients that are no longer active on the network will become available
available sooner.
% ALLOC_ENGINE_DISCOVER_ADDRESS_CONFLICT conflicting reservation for address %1 with existing lease %2
This warning message is issued when the DHCP server finds that the
address reserved for the client can't be offered because this address
is currently allocated to another client. The server will try to allocate
a different address to the client to use until the conflict is resolved.
% ALLOC_ENGINE_HR_RESERVED_ADDR_GRANTED reserved address %1 was was assigned to client (duid=%2)
This informational message signals that the specified client was assigned the address
reserved for it.
% ALLOC_ENGINE_HR_RESERVED_PREFIX_GRANTED reserved prefix %1/%2 was was assigned to client (duid=%3)
This informational message signals that the specified client was assigned the prefix
reserved for it.
% ALLOC_ENGINE_HR_REVOKED_ADDR6_LEASE address %1 was revoked from client %2 as it is reserved for client %3
This informational message is an indication that the specified IPv6
address was used by client A but it is now reserved for client B. Client
A has been told to stop using it so that it can be leased to client B.
This is a normal occurrence during conflict resolution, which can occur
in cases such as the system administrator adding a reservation for an
address that is currently in use by another client. The server will fully
recover from this situation, but clients will change their addresses.
% ALLOC_ENGINE_HR_REVOKED_PREFIX6_LEASE Prefix %1/%2 was revoked from client %3 as it is reserved for client %4
This informational message is an indication that the specified IPv6
prefix was used by client A but it is now reserved for client B. Client
A has been told to stop using it so that it can be leased to client B.
This is a normal occurrence during conflict resolution, which can occur
in cases such as the system administrator adding a reservation for an
address that is currently in use by another client. The server will fully
recover from this situation, but clients will change their prefixes.
\ No newline at end of file
......@@ -14,46 +14,6 @@
$NAMESPACE isc::dhcp
% DHCPSRV_ADDRESS4_ALLOC_ERROR error during attempt to allocate an IPv4 address: %1
An error occurred during an attempt to allocate an IPv4 address, the
reason for the failure being contained in the message. The server will
return a message to the client refusing a lease.
% DHCPSRV_ADDRESS4_ALLOC_FAIL failed to allocate an IPv4 address after %1 attempt(s)
The DHCP allocation engine gave up trying to allocate an IPv4 address
after the specified number of attempts. This probably means that the
address pool from which the allocation is being attempted is either
empty, or very nearly empty. As a result, the client will have been
refused a lease.
This message may indicate that your address pool is too small for the
number of clients you are trying to service and should be expanded.
Alternatively, if the you know that the number of concurrently active
clients is less than the addresses you have available, you may want to
consider reducing the lease lifetime. In this way, addresses allocated
to clients that are no longer active on the network will become available
available sooner.
% DHCPSRV_ADDRESS6_ALLOC_ERROR error during attempt to allocate an IPv6 address: %1
An error occurred during an attempt to allocate an IPv6 address, the
reason for the failure being contained in the message. The server will
return a message to the client refusing a lease.
% DHCPSRV_ADDRESS6_ALLOC_FAIL failed to allocate an IPv6 address after %1 attempt(s)
The DHCP allocation engine gave up trying to allocate an IPv6 address
after the specified number of attempts. This probably means that the
address pool from which the allocation is being attempted is either
empty, or very nearly empty. As a result, the client will have been
refused a lease.
This message may indicate that your address pool is too small for the
number of clients you are trying to service and should be expanded.
Alternatively, if the you know that the number of concurrently active
clients is less than the addresses you have available, you may want to
consider reducing the lease lifetime. In this way, addresses allocated
to clients that are no longer active on the network will become available
available sooner.
% DHCPSRV_CFGMGR_ADD_IFACE listening on interface %1
An info message issued when a new interface is being added to the collection of
interfaces on which the server listens to DHCP messages.
......@@ -216,12 +176,6 @@ have been experienced. Any such errors should have preceding entries in the
log with details. No further attempts to communicate with kea-dhcp-ddns will
be made without intervention.
% DHCPSRV_DISCOVER_ADDRESS_CONFLICT conflicting reservation for address %1 with existing lease %2
This warning message is issued when the DHCP server finds that the
address reserved for the client can't be offered because this address
is currently allocated to another client. The server will try to allocate
a different address to the client to use until the conflict is resolved.
% DHCPSRV_HOOK_LEASE4_RENEW_SKIP DHCPv4 lease was not renewed because a callout set the skip flag.
This debug message is printed when a callout installed on lease4_renew
hook point set the skip flag. For this particular hook point, the setting
......@@ -248,32 +202,6 @@ hook point sets the skip flag. It means that the server was told that
no lease6 should be assigned. The server will not put that lease in its
database and the client will get a NoAddrsAvail for that IA_NA option.
% DHCPSRV_HR_RESERVED_ADDR_GRANTED reserved address %1 was was assigned to client (duid=%2)
This informational message signals that the specified client was assigned the address
reserved for it.
% DHCPSRV_HR_RESERVED_PREFIX_GRANTED reserved prefix %1/%2 was was assigned to client (duid=%3)
This informational message signals that the specified client was assigned the prefix
reserved for it.
% DHCPSRV_HR_REVOKED_ADDR6_LEASE address %1 was revoked from client %2 as it is reserved for client %3
This informational message is an indication that the specified IPv6
address was used by client A but it is now reserved for client B. Client
A has been told to stop using it so that it can be leased to client B.
This is a normal occurrence during conflict resolution, which can occur
in cases such as the system administrator adding a reservation for an
address that is currently in use by another client. The server will fully
recover from this situation, but clients will change their addresses.
% DHCPSRV_HR_REVOKED_PREFIX6_LEASE Prefix %1/%2 was revoked from client %3 as it is reserved for client %4
This informational message is an indication that the specified IPv6
prefix was used by client A but it is now reserved for client B. Client
A has been told to stop using it so that it can be leased to client B.
This is a normal occurrence during conflict resolution, which can occur
in cases such as the system administrator adding a reservation for an
address that is currently in use by another client. The server will fully
recover from this situation, but clients will change their prefixes.
% DHCPSRV_INVALID_ACCESS invalid database access string: %1
This is logged when an attempt has been made to parse a database access string
and the attempt ended in error. The access string in question - which
......
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