Browse Source

[3769] Addressed review comments

Removed Daemon::init() method, improved server log message
descpriptions, and minor typos.
Thomas Markwalder 10 years ago
parent
commit
a6d898ec4b

+ 4 - 2
src/bin/d2/d2_messages.mes

@@ -107,7 +107,8 @@ indicates an attempt to start a second instance of DHCP_DDNS using the
 same configuration file.  It is possible, though unlikely, that the PID file
 same configuration file.  It is possible, though unlikely, that the PID file
 is a remnant left behind by a server crash or power failure and the PID
 is a remnant left behind by a server crash or power failure and the PID
 it contains refers to a process other than DHCP_DDNS.  In such an event,
 it contains refers to a process other than DHCP_DDNS.  In such an event,
-it would be necessary to manually remove the PID file.
+it would be necessary to manually remove the PID file.  The first argument is
+the DHCP_DDNS process name, the second contains the PID and and PID file.
 
 
 % DHCP_DDNS_AT_MAX_TRANSACTIONS application has %1 queued requests but has reached maximum number of %2 concurrent transactions
 % DHCP_DDNS_AT_MAX_TRANSACTIONS application has %1 queued requests but has reached maximum number of %2 concurrent transactions
 This is a debug message that indicates that the application has DHCP_DDNS
 This is a debug message that indicates that the application has DHCP_DDNS
@@ -292,7 +293,8 @@ its PID file.  The log message should contain details sufficient to
 determine the underlying cause.  The most likely culprits are that
 determine the underlying cause.  The most likely culprits are that
 some portion of the pathname does not exist or a permissions issue. The
 some portion of the pathname does not exist or a permissions issue. The
 default path is determined by --localstatedir configure paramter but
 default path is determined by --localstatedir configure paramter but
-may be overridden by setting environment variable, KEA_PIDFILE_DIR.
+may be overridden by setting environment variable, KEA_PIDFILE_DIR.  The
+first argument is the DHCP_DDNS process name.
 
 
 % DHCP_DDNS_PROCESS_INIT application init invoked
 % DHCP_DDNS_PROCESS_INIT application init invoked
 This is a debug message issued when the DHCP-DDNS application enters
 This is a debug message issued when the DHCP-DDNS application enters

+ 2 - 1
src/bin/dhcp4/dhcp4_messages.mes

@@ -27,7 +27,8 @@ the server using the same configuration file.  It is possible, though
 unlikely that the PID file is a remnant left behind by a server crash or
 unlikely that the PID file is a remnant left behind by a server crash or
 power failure and the PID it contains refers to a process other than
 power failure and the PID it contains refers to a process other than
 the server.  In such an event, it would be necessary to manually remove
 the server.  In such an event, it would be necessary to manually remove
-the PID file.
+the PID file.  The first argument is the DHCPv4 process name, the
+second contains the PID and and PID file.
 
 
 % DHCP4_BUFFER_RECEIVED received buffer from %1:%2 to %3:%4 over interface %5
 % DHCP4_BUFFER_RECEIVED received buffer from %1:%2 to %3:%4 over interface %5
 This debug message is logged when the server has received a packet
 This debug message is logged when the server has received a packet

+ 2 - 1
src/bin/dhcp6/dhcp6_messages.mes

@@ -27,7 +27,8 @@ the server using the same configuration file.  It is possible, though
 unlikely that the PID file is a remnant left behind by a server crash or
 unlikely that the PID file is a remnant left behind by a server crash or
 power failure and the PID it contains refers to a process other than
 power failure and the PID it contains refers to a process other than
 the server.  In such an event, it would be necessary to manually remove
 the server.  In such an event, it would be necessary to manually remove
-the PID file.
+the PID file.  The first argument is the DHCPv6 process name, the second
+contains the PID and and PID file.
 
 
 % DHCP6_ADD_GLOBAL_STATUS_CODE %1: adding Status Code to DHCPv6 packet: %2
 % DHCP6_ADD_GLOBAL_STATUS_CODE %1: adding Status Code to DHCPv6 packet: %2
 This message is logged when the server is adding the top-level
 This message is logged when the server is adding the top-level

+ 0 - 4
src/lib/dhcpsrv/daemon.cc

@@ -52,10 +52,6 @@ Daemon::~Daemon() {
     }
     }
 }
 }
 
 
-void Daemon::init(const std::string& config_file) {
-    config_file_ = config_file;
-}
-
 void Daemon::cleanup() {
 void Daemon::cleanup() {
 
 
 }
 }

+ 0 - 23
src/lib/dhcpsrv/daemon.h

@@ -69,29 +69,6 @@ public:
     /// virtual destructor as well.
     /// virtual destructor as well.
     virtual ~Daemon();
     virtual ~Daemon();
 
 
-    /// @brief Initializes the server.
-    ///
-    /// @todo #3753 - This method should be revisited as its original purpose
-    /// has been lost.  As of #3769, it has been superseded with setConfigFile().
-    /// None of the following is currently accurate.
-    ///
-    /// Depending on the configuration backend, it establishes msgq session,
-    /// or reads the configuration file.
-    ///
-    /// Note: This function may throw to report enountered problems. It may
-    /// also return false if the initialization was skipped. That may seem
-    /// redundant, but the idea here is that in some cases the configuration
-    /// was read, understood and the decision was made to not start. One
-    /// case where such capability could be needed is when we have a single
-    /// config file for Kea4 and D2, but the DNS Update is disabled. It is
-    /// likely that the D2 will be started, it will analyze its config file,
-    /// decide that it is not needed and will shut down.
-    ///
-    /// @note this method may throw
-    ///
-    /// @param config_file Config file name (may be empty if unused).
-    virtual void init(const std::string& config_file);
-
     /// @brief Performs final deconfiguration.
     /// @brief Performs final deconfiguration.
     ///
     ///
     /// Performs configuration backend specific final clean-up. This is called
     /// Performs configuration backend specific final clean-up. This is called

+ 3 - 3
src/lib/dhcpsrv/tests/daemon_unittest.cc

@@ -78,10 +78,10 @@ TEST_F(DaemonTest, constructor) {
     Daemon instance2;
     Daemon instance2;
     EXPECT_FALSE(instance2.getVerbose());
     EXPECT_FALSE(instance2.getVerbose());
 
 
-    EXPECT_EQ("",instance2.getConfigFile());
-    EXPECT_EQ("",instance2.getProcName());
+    EXPECT_TRUE(instance2.getConfigFile().empty());
+    EXPECT_TRUE(instance2.getProcName().empty());
     EXPECT_EQ(CfgMgr::instance().getDataDir(),instance2.getPIDFileDir());
     EXPECT_EQ(CfgMgr::instance().getDataDir(),instance2.getPIDFileDir());
-    EXPECT_EQ("",instance2.getPIDFileName());
+    EXPECT_TRUE(instance2.getPIDFileName().empty());
 }
 }
 
 
 // Verify config file accessors
 // Verify config file accessors

+ 1 - 1
src/lib/testutils/dhcp_test_lib.sh.in

@@ -447,7 +447,7 @@ verify_server_pid() {
         clean_exit 1
         clean_exit 1
     fi
     fi
 
 
-    # Only the file name portio of the config file is used, try and
+    # Only the file name portion of the config file is used, try and
     # extract it. NOTE if this "algorithm" changes this code will need
     # extract it. NOTE if this "algorithm" changes this code will need
     # to be updated.
     # to be updated.
     fname=`basename ${cfg_file}`
     fname=`basename ${cfg_file}`

+ 1 - 1
src/lib/util/pid_file.cc

@@ -51,7 +51,7 @@ PIDFile::check() const {
                   << filename_ << "'");
                   << filename_ << "'");
     }
     }
 
 
-    // If the process is still running return true
+    // If the process is still running return its pid.
     if (kill(pid, 0) == 0) {
     if (kill(pid, 0) == 0) {
         return (pid);
         return (pid);
     }
     }