]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[4216] Eliminated reuse of log message IDs in hosts database related logging
authorThomas Markwalder <tmark@isc.org>
Wed, 9 Dec 2015 19:51:36 +0000 (14:51 -0500)
committerThomas Markwalder <tmark@isc.org>
Wed, 9 Dec 2015 19:51:36 +0000 (14:51 -0500)
src/lib/dhcpsrv/dhcpsrv_messages.mes
    Added hosts database specific messages

src/lib/dhcpsrv/host_data_source_factory.cc
src/lib/dhcpsrv/mysql_host_data_source.cc
    Updated log statements with hosts database messages

src/lib/dhcpsrv/dhcpsrv_messages.mes
src/lib/dhcpsrv/host_data_source_factory.cc
src/lib/dhcpsrv/mysql_host_data_source.cc

index 5678bac1119763ddef6b148a1e616b3b440badcf..1f84728add8f60be18ffbfefebd21097b9dc7ac5 100644 (file)
@@ -238,6 +238,12 @@ 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_HOSTDB_NOTYPE 'type' parameter is missing from hosts database configuration: %1
+This is an error message, logged when an attempt has been made to access
+the configured hosts database, but no 'type' keyword has been included in
+the access string.  The access string (less any passwords) is included
+in the message.
+
 % 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
@@ -532,6 +538,16 @@ and hardware address.
 A debug message issued when the server is about to obtain schema version
 information from the MySQL database.
 
+% DHCPSRV_MYSQL_HOST_DB opening MySQL hosts database: %1
+This informational message is logged when a DHCP server (either V4 or
+V6) is about to open a MySQL hosts database.  The parameters of the
+connection including database name and username needed to access it
+(but not the password if any) are logged.
+
+% DHCPSRV_MYSQL_HOST_DB_GET_VERSION obtaining schema version information
+A debug message issued when the server is about to obtain schema version
+information from the MySQL hosts database.
+
 % DHCPSRV_MYSQL_ROLLBACK rolling back MySQL database
 The code has issued a rollback call.  All outstanding transaction will
 be rolled back and not committed to the database.
@@ -658,6 +674,12 @@ and hardware address.
 A debug message issued when the server is about to obtain schema version
 information from the PostgreSQL database.
 
+% DHCPSRV_PGSQL_HOST_DB opening PostgreSQL hosts database: %1
+This informational message is logged when a DHCP server (either V4 or
+V6) is about to open a PostgreSQL hosts database.  The parameters of the
+connection including database name and username needed to access it
+(but not the password if any) are logged.
+
 % DHCPSRV_PGSQL_ROLLBACK rolling back PostgreSQL database
 The code has issued a rollback call.  All outstanding transaction will
 be rolled back and not committed to the database.
@@ -774,3 +796,7 @@ indicate an error in the source code, please submit a bug report.
 % DHCPSRV_UNKNOWN_DB unknown database type: %1
 The database access string specified a database type (given in the
 message) that is unknown to the software.  This is a configuration error.
+
+% DHCPSRV_UNKNOWN_HOST_DB unknown hosts database type: %1
+The hosts database access string specified a database type (given in the
+message) that is unknown to the software.  This is a configuration error.
index 3865c8184c1d927896ccff0820dc7e9cb9f3d30d..518455421316296dfa21374e19b15dd19c23376e 100644 (file)
@@ -57,8 +57,8 @@ HostDataSourceFactory::create(const std::string& dbaccess) {
 
     // Is "type" present?
     if (parameters.find(type) == parameters.end()) {
-        LOG_ERROR(dhcpsrv_logger, DHCPSRV_NOTYPE_DB).arg(dbaccess);
-        isc_throw(InvalidParameter, "Database configuration parameters do not "
+        LOG_ERROR(dhcpsrv_logger, DHCPSRV_HOSTDB_NOTYPE).arg(dbaccess);
+        isc_throw(InvalidParameter, "Host database configuration does not "
                   "contain the 'type' keyword");
     }
 
@@ -66,7 +66,7 @@ HostDataSourceFactory::create(const std::string& dbaccess) {
     // Yes, check what it is.
 #ifdef HAVE_MYSQL
     if (parameters[type] == string("mysql")) {
-        LOG_INFO(dhcpsrv_logger, DHCPSRV_MYSQL_DB).arg(redacted);
+        LOG_INFO(dhcpsrv_logger, DHCPSRV_MYSQL_HOST_DB).arg(redacted);
         getHostDataSourcePtr().reset(new MySqlHostDataSource(parameters));
         return;
     }
@@ -74,7 +74,7 @@ HostDataSourceFactory::create(const std::string& dbaccess) {
 
 #ifdef HAVE_PGSQL
     if (parameters[type] == string("postgresql")) {
-        LOG_INFO(dhcpsrv_logger, DHCPSRV_PGSQL_DB).arg(redacted);
+        LOG_INFO(dhcpsrv_logger, DHCPSRV_PGSQL_HOST_DB).arg(redacted);
         isc_throw(NotImplemented, "Sorry, Postgres backend for host reservations "
                   "is not implemented yet.");
         // Set pgsql data source here, when it will be implemented.
@@ -83,7 +83,7 @@ HostDataSourceFactory::create(const std::string& dbaccess) {
 #endif
 
     // Get here on no match.
-    LOG_ERROR(dhcpsrv_logger, DHCPSRV_UNKNOWN_DB).arg(parameters[type]);
+    LOG_ERROR(dhcpsrv_logger, DHCPSRV_UNKNOWN_HOST_DB).arg(parameters[type]);
     isc_throw(InvalidType, "Database access parameter 'type' does "
               "not specify a supported database backend");
 }
index 593fbe9d8f088fc8968bb61295e16fb3a8ddbf30..c754769c5b0709fb1f7e0a951fb4269b6b166f6b 100644 (file)
@@ -976,7 +976,7 @@ std::pair<uint32_t, uint32_t> MySqlHostDataSource::getVersion() const {
     const StatementIndex stindex = GET_VERSION;
 
     LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL,
-              DHCPSRV_MYSQL_GET_VERSION);
+              DHCPSRV_MYSQL_HOST_DB_GET_VERSION);
 
     uint32_t major;      // Major version number
     uint32_t minor;      // Minor version number