Commit d6970919 authored by Francis Dupont's avatar Francis Dupont
Browse files

[master] Merged trac3882a (-V database details)

parents e3f42393 c6727e5b
......@@ -3,6 +3,12 @@ SUBDIRS = . tests
AM_CPPFLAGS = -I$(top_srcdir)/src/lib -I$(top_builddir)/src/lib
AM_CPPFLAGS += -I$(top_srcdir)/src/bin -I$(top_builddir)/src/bin
AM_CPPFLAGS += $(BOOST_INCLUDES)
if HAVE_MYSQL
AM_CPPFLAGS += $(MYSQL_CPPFLAGS)
endif
if HAVE_PGSQL
AM_CPPFLAGS += $(PGSQL_CPPFLAGS)
endif
AM_CXXFLAGS = $(KEA_CXXFLAGS)
if USE_CLANGPP
......
......@@ -23,6 +23,14 @@
#include <log/logger.h>
#include <cfgrpt/config_report.h>
#ifdef HAVE_MYSQL
#include <dhcpsrv/mysql_lease_mgr.h>
#endif
#ifdef HAVE_PGSQL
#include <dhcpsrv/pgsql_lease_mgr.h>
#endif
#include <dhcpsrv/memfile_lease_mgr.h>
#include <sstream>
#include <unistd.h>
......@@ -466,12 +474,12 @@ DControllerBase::getVersion(bool extended) {
tmp << isc::cryptolink::CryptoLink::getVersion() << std::endl;
tmp << "database:" << std::endl;
#ifdef HAVE_MYSQL
tmp << "MySQL backend" << std::endl;
tmp << isc::dhcp::MySqlLeaseMgr::getDBVersion() << std::endl;
#endif
#ifdef HAVE_PGSQL
tmp << "PostgreSQL backend" << std::endl;
tmp << isc::dhcp::PgSqlLeaseMgr::getDBVersion() << std::endl;
#endif
tmp << "Memfile backend";
tmp << isc::dhcp::Memfile_LeaseMgr::getDBVersion();
// @todo: more details about database runtime
}
......
......@@ -3,6 +3,12 @@ SUBDIRS = . tests
AM_CPPFLAGS = -I$(top_srcdir)/src/lib -I$(top_builddir)/src/lib
AM_CPPFLAGS += -I$(top_srcdir)/src/bin -I$(top_builddir)/src/bin
AM_CPPFLAGS += $(BOOST_INCLUDES)
if HAVE_MYSQL
AM_CPPFLAGS += $(MYSQL_CPPFLAGS)
endif
if HAVE_PGSQL
AM_CPPFLAGS += $(PGSQL_CPPFLAGS)
endif
AM_CXXFLAGS = $(KEA_CXXFLAGS)
if USE_CLANGPP
......
......@@ -47,6 +47,14 @@
#include <cryptolink/cryptolink.h>
#include <cfgrpt/config_report.h>
#ifdef HAVE_MYSQL
#include <dhcpsrv/mysql_lease_mgr.h>
#endif
#ifdef HAVE_PGSQL
#include <dhcpsrv/pgsql_lease_mgr.h>
#endif
#include <dhcpsrv/memfile_lease_mgr.h>
#include <asio.hpp>
#include <boost/bind.hpp>
#include <boost/foreach.hpp>
......@@ -2273,15 +2281,15 @@ Dhcpv4Srv::getVersion(bool extended) {
tmp << "linked with:" << endl;
tmp << Logger::getVersion() << endl;
tmp << CryptoLink::getVersion() << endl;
tmp << "database:" << endl;
#ifdef HAVE_MYSQL
tmp << "database: MySQL";
#else
#ifdef HAVE_PGSQL
tmp << "database: PostgreSQL";
#else
tmp << "no database";
tmp << MySqlLeaseMgr::getDBVersion() << endl;
#endif
#ifdef HAVE_PGSQL
tmp << PgSqlLeaseMgr::getDBVersion() << endl;
#endif
tmp << Memfile_LeaseMgr::getDBVersion();
// @todo: more details about database runtime
}
......
......@@ -4,6 +4,12 @@ AM_CPPFLAGS = -I$(top_srcdir)/src/lib -I$(top_builddir)/src/lib
AM_CPPFLAGS += -I$(top_srcdir)/src/bin -I$(top_builddir)/src/bin
AM_CPPFLAGS += -I$(top_srcdir)/src/lib/cc -I$(top_builddir)/src/lib/cc
AM_CPPFLAGS += $(BOOST_INCLUDES)
if HAVE_MYSQL
AM_CPPFLAGS += $(MYSQL_CPPFLAGS)
endif
if HAVE_PGSQL
AM_CPPFLAGS += $(PGSQL_CPPFLAGS)
endif
AM_CXXFLAGS = $(KEA_CXXFLAGS)
if USE_CLANGPP
......
......@@ -54,6 +54,14 @@
#include <cryptolink/cryptolink.h>
#include <cfgrpt/config_report.h>
#ifdef HAVE_MYSQL
#include <dhcpsrv/mysql_lease_mgr.h>
#endif
#ifdef HAVE_PGSQL
#include <dhcpsrv/pgsql_lease_mgr.h>
#endif
#include <dhcpsrv/memfile_lease_mgr.h>
#include <asio.hpp>
#include <boost/bind.hpp>
......@@ -2893,15 +2901,15 @@ Dhcpv6Srv::getVersion(bool extended) {
tmp << "linked with:" << endl;
tmp << Logger::getVersion() << endl;
tmp << CryptoLink::getVersion() << endl;
tmp << "database:" << endl;
#ifdef HAVE_MYSQL
tmp << "database: MySQL";
#else
#ifdef HAVE_PGSQL
tmp << "database: PostgreSQL";
#else
tmp << "no database";
tmp << MySqlLeaseMgr::getDBVersion() << endl;
#endif
#ifdef HAVE_PGSQL
tmp << PgSqlLeaseMgr::getDBVersion() << endl;
#endif
tmp << Memfile_LeaseMgr::getDBVersion();
// @todo: more details about database runtime
}
......
......@@ -20,7 +20,7 @@
<refentry>
<refentryinfo>
<date>Feb 1, 2015</date>
<date>June 20, 2015</date>
</refentryinfo>
<refmeta>
......@@ -53,6 +53,7 @@
<arg><option>-f <replaceable class="parameter">finish-file</replaceable></option></arg>
<arg><option>-v</option></arg>
<arg><option>-V</option></arg>
<arg><option>-W</option></arg>
<arg><option>-d</option></arg>
<arg><option>-h</option></arg>
</cmdsynopsis>
......@@ -99,6 +100,13 @@
</para></listitem>
</varlistentry>
<varlistentry>
<term><option>-W</option></term>
<listitem><para>
Display the configuration report.
</para></listitem>
</varlistentry>
<varlistentry>
<term><option>-h</option></term>
<listitem><para>
......
......@@ -20,6 +20,7 @@
#include <exceptions/exceptions.h>
#include <dhcpsrv/csv_lease_file4.h>
#include <dhcpsrv/csv_lease_file6.h>
#include <dhcpsrv/memfile_lease_mgr.h>
#include <dhcpsrv/memfile_lease_storage.h>
#include <dhcpsrv/lease_mgr.h>
#include <dhcpsrv/lease_file_loader.h>
......@@ -157,7 +158,7 @@ LFCController::parseArgs(int argc, char* argv[]) {
opterr = 0;
optind = 1;
while ((ch = getopt(argc, argv, ":46dvVp:x:i:o:c:f:")) != -1) {
while ((ch = getopt(argc, argv, ":46dvVWp:x:i:o:c:f:")) != -1) {
switch (ch) {
case '4':
// Process DHCPv4 lease files.
......@@ -179,6 +180,11 @@ LFCController::parseArgs(int argc, char* argv[]) {
std::cout << getVersion(true) << std::endl;
exit(EXIT_SUCCESS);
case 'W':
// Display the configuration report and exit.
std::cout << isc::detail::getConfigReport() << std::endl;
exit(EXIT_SUCCESS);
case 'd':
// Verbose output.
verbose_ = true;
......@@ -325,7 +331,8 @@ LFCController::getVersion(const bool extended) const{
version_stream << VERSION;
if (extended) {
version_stream << std::endl << EXTENDED_VERSION;
version_stream << std::endl << EXTENDED_VERSION << std::endl
<< "database: " << isc::dhcp::Memfile_LeaseMgr::getDBVersion();
}
return (version_stream.str());
......
......@@ -61,5 +61,10 @@ LeaseMgr::getLease6(Lease::Type type, const DUID& duid,
return (*col.begin());
}
std::string
LeaseMgr::getDBVersion() {
isc_throw(NotImplemented, "LeaseMgr::getDBVersion() called");
}
} // namespace isc::dhcp
} // namespace isc
......@@ -152,6 +152,10 @@ public:
virtual ~LeaseMgr()
{}
/// @brief Class method to return extended version info
/// This class method must be redeclared and redefined in derived classes
static std::string getDBVersion();
/// @brief Adds an IPv4 lease.
///
/// @param lease lease to be added
......
......@@ -265,6 +265,14 @@ Memfile_LeaseMgr::~Memfile_LeaseMgr() {
}
}
std::string
Memfile_LeaseMgr::getDBVersion() {
std::stringstream tmp;
tmp << "Memfile backend " << MAJOR_VERSION;
tmp << "." << MINOR_VERSION;
return (tmp.str());
}
bool
Memfile_LeaseMgr::addLease(const Lease4Ptr& lease) {
LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL,
......
......@@ -134,6 +134,9 @@ public:
/// @brief Destructor (closes file)
virtual ~Memfile_LeaseMgr();
/// @brief Local version of getDBVersion() class method
static std::string getDBVersion();
/// @brief Adds an IPv4 lease.
///
/// @param lease lease to be added
......
......@@ -1265,6 +1265,15 @@ MySqlLeaseMgr::~MySqlLeaseMgr() {
// closed in the destructor of the mysql_ member variable.
}
std::string
MySqlLeaseMgr::getDBVersion() {
std::stringstream tmp;
tmp << "MySQL backend " << CURRENT_VERSION_VERSION;
tmp << "." << CURRENT_VERSION_MINOR;
tmp << ", library " << mysql_get_client_info();
return (tmp.str());
}
// Time conversion methods.
//
......
......@@ -122,6 +122,9 @@ public:
/// @brief Destructor (closes database)
virtual ~MySqlLeaseMgr();
/// @brief Local version of getDBVersion() class method
static std::string getDBVersion();
/// @brief Adds an IPv4 lease
///
/// @param lease lease to be added
......
......@@ -965,6 +965,15 @@ PgSqlLeaseMgr::~PgSqlLeaseMgr() {
}
}
std::string
PgSqlLeaseMgr::getDBVersion() {
std::stringstream tmp;
tmp << "PostgreSQL backend " << PG_CURRENT_VERSION;
tmp << "." << PG_CURRENT_MINOR;
tmp << ", library " << PQlibVersion();
return (tmp.str());
}
void
PgSqlLeaseMgr::prepareStatements() {
for(int i = 0; tagged_statements[i].text != NULL; ++ i) {
......
......@@ -151,6 +151,9 @@ public:
/// @brief Destructor (closes database)
virtual ~PgSqlLeaseMgr();
/// @brief Local version of getDBVersion() class method
static std::string getDBVersion();
/// @brief Adds an IPv4 lease
///
/// @param lease lease to be added
......
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