2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-09-05 16:35:23 +00:00
Commit Graph

33 Commits

Author SHA1 Message Date
Thomas Markwalder
249219f1fc [5477] dhcpsrv/postgres and kea-dhcp4 now support db reconnect
kea-dhcp4
    added support for max-reconnect-tries and reconnect-wait-time
    to lease and host db parsers

    Added a callback for when DB backends detect loss of connectivity

    Added a self-rescheduling method to attempt to reconnect to the
    backends if retries are enabled

dhcpsrv
    Added a callback that DatabaseConnection derivations should invoke
    when they lose connectivity.

    Added an optional callback parameter from CfgDbAccess::createManagers()
    all the way down to DatabaseConnection ctor.

    pgsql_connection.cc
        PgSqlConnection::~PgSqlConnection() - Added logic to close the
        connection only when the connect state is still OK.
        Otherwise it likes to core dump.

        PgSqlConnection::checkStatementError() - Modified to invoke the
        connectivity lost callback on "fatal" errors

    pgsql_lease_mgr_unittest.cc
    pgsql_host_data_source_unittest.cc
        Added tests to verify that the lost callback is NOT invoked on an
        open failure
2018-02-28 15:29:23 -05:00
Tomek Mrugalski
5d57d4e387 [5351] Several changes after review 2017-12-16 15:27:31 +01:00
Francis Dupont
f898544564 [5351] Checkpoint: todo host DB tests 2017-12-03 19:23:00 +01:00
Francis Dupont
869ab1ed57 [5351] Checkpoint: added user context in options stored in DBs, todo add tests 2017-12-01 09:35:18 +01:00
Thomas Markwalder
fd38dc84f3 [5416] Minor wordsmithing. 2017-11-27 10:12:23 -05:00
Marcin Siodelski
19aaa0e0cc [5416] Allow null or 0 values in unique indexes within hosts table.
Also, updated MySQL backend to convert 0 values to null to make sure that
multiple reservations are possible when IPv4 address is unspecified.
2017-11-07 10:27:05 +01:00
Josh Soref
185a9147be spelling: overridden 2017-07-23 15:19:44 -04:00
Tomek Mrugalski
8b561ef854 [5208a] delete methods implemented in host data sources 2017-04-22 21:56:33 +02:00
Marcin Siodelski
a24cd8be97 [5102] Allow retrieving host reservations by 'client-id' from SQL dbs. 2017-04-15 15:19:00 +02:00
Wlodek Wencel
9e3ca83d07 [v_1_2_0] copy right dates updated 2017-04-12 15:47:26 +02:00
Andrei Pavel
9082500187 Corrected typos 2016-12-14 16:57:44 +02:00
Marcin Siodelski
3e7fa856b7 [5016] Update server code and tests to properly use exclude option. 2016-10-27 20:20:25 +02:00
Marcin Siodelski
07fbb6e142 [5009] Addressed review comments. 2016-09-20 15:37:11 +02:00
Marcin Siodelski
3b64a72905 [5009] Check columns for NULL values in PostgreSQL host data source. 2016-09-20 10:53:40 +02:00
Marcin Siodelski
8cce1aa713 [5009] Implemented get6(subnet_id, address) function for SQL backends.
Also removed uint32_t cast operator from IOAddress to remove
ambiguity when calling this new function.
2016-09-20 09:29:06 +02:00
Marcin Siodelski
c15ca8dbc4 [master] Merge branch 'trac3161' 2016-09-16 16:25:20 +02:00
Marcin Siodelski
97ae6373fb [3161] Explicitly initialize uninitialized variables.
Reported by cpp-check.
2016-09-13 15:07:57 +02:00
Andreas Rammhold
482663a3c9 Fix compilation with GCC 6.0 std::make_pair changes
With C++14, std::make_pair<T,U>(t,u) expects rvalue. If trying
to pass an lvalue, either std::make_pair(t,u) and type is
deduced, or std::pair<T,U>(t,y).
2016-09-06 14:37:05 +02:00
Marcin Siodelski
9b79fe005d [master] Merge branch 'trac4552' 2016-08-25 18:18:07 +02:00
Marcin Siodelski
0e1da5a732 [4552] Storing siaddr, sname and file in PostgreSQL database. 2016-08-23 18:37:20 +02:00
Marcin Siodelski
4a8efcb45a [4489] Addressed review comments.
The only review item not addressed with this commit is the
implementation of unit test that operates on the read only
database, i.e. the database containing tables on which the
given user only has SELECT privileges.
2016-08-17 11:22:24 +02:00
Marcin Siodelski
d9a2d3637a [4489] Added log statements when host database is read-only. 2016-07-29 09:55:40 +02:00
Marcin Siodelski
bfb36f3d0c [4489] Removed RestrictedConstPtr class. 2016-07-28 21:13:01 +02:00
Marcin Siodelski
4e0e41f060 [4489] Added support for read only mode in PostgreSQL HR backend. 2016-07-28 16:21:42 +02:00
Tomek Mrugalski
7e2d2f21c6 [4277] Added several @todos and fixed formatting. 2016-07-25 20:04:20 +02:00
Thomas Markwalder
cac472f52a [4277] Fixed tagged_statements name collision
Wrapped declaration of tagged_statements[] in pgsql_host_data_source.cc
and mysql_host_data_source.cc in anonymous namespace.  They collide
otherwise.
2016-07-14 16:35:12 -04:00
Thomas Markwalder
15b51b6229 [4277] Addressed bulk of review comments
src/lib/dhcpsrv/tests/pgsql_exchange_unittest.cc
    - Added PgSqlBasicsTest test fixture class and tests which exercise all of
    the PostgreSQL data types we currently use with round-trip database writes
    and reads

src/lib/dhcpsrv/pgsql_connection.cc
src/lib/dhcpsrv/pgsql_connection.h
    - Moved PgSqlResult function impls from .h
    - Added exception safe implementation of getColumnLabel() to PgSqlResult

src/lib/dhcpsrv/pgsql_exchange.cc
src/lib/dhcpsrv/pgsql_exchange.h
    - PsqlBindArray::add() variants which accept raw pointers now throw
    if the pointer is NULL
    - PgSqlExchange::getColumnLabel() is now a wrapper around PgSqlResult method

src/lib/dhcpsrv/pgsql_host_data_source.h
src/lib/dhcpsrv/pgsql_host_data_source.cc
     - Commentary clean up

src/lib/dhcpsrv/pgsql_lease_mgr.cc
     - Commentary clean up
2016-07-14 07:34:06 -04:00
Thomas Markwalder
3d40522867 [4277] Cleanup and commentary 2016-06-27 16:00:38 -04:00
Thomas Markwalder
3c22198304 [4277] Rollback test passes
tests/pgsql_host_data_source_unittest.cc
    TEST_F(PgSqlHostDataSourceTest, testAddRollback) now
    functions and passes
2016-06-24 13:22:20 -04:00
Thomas Markwalder
8f21305bd3 [4277] IPv6 Reservations now functional
src/lib/dhcpsrv/pgsql_exchange.h
src/lib/dhcpsrv/pgsql_exchange.cc
src/lib/dhcpsrv/pgsql_lease_mgr.cc
    Moved getIPv6Value() from PgSqlLease6Exchange to
    PgSqlExchange and made it static

    PgSqlExchange::dumpRow() gets number of columns
    from result set, not parameter

src/lib/dhcpsrv/pgsql_host_data_source.cc
     PgSqlIPv6ReservationExchange
     PgSqlHostIPv6Exchange - now functional

src/lib/dhcpsrv/tests/pgsql_host_data_source_unittest.cc
    TEST_F(PgSqlHostDataSourceTest, get6AddrWithDuid)
    TEST_F(PgSqlHostDataSourceTest, addDuplicate6WithHWAddr)
    TEST_F(PgSqlHostDataSourceTest, optionsReservations6)
    TEST_F(PgSqlHostDataSourceTest, optionsReservations46)
    TEST_F(PgSqlHostDataSourceTest, formattedOptionsReservations6)
    TEST_F(PgSqlHostDataSourceTest, formattedOptionsReservations46)
    - All included and passing.
2016-06-24 11:56:07 -04:00
Thomas Markwalder
3c01633e93 [4277] PgSqlHostWithOptionsExchange, PgSqlOptionExchange now functional
src/lib/dhcpsrv/pgsql_connection.h
    Added OID_TEXT

src/lib/dhcpsrv/pgsql_exchange.cc
    PsqlBindArray::addNull()

    class PgSqlExchange
        - getColumnLabel() - now gets column name from result set
        - getColumnValue variants are now static methods
        - rename column_labels_ to columns_
        - isColumnNull() new method tests if column in row is null
        - dumpRow() - debug method dumps row as text

src/lib/dhcpsrv/pgsql_host_data_source.cc
    PgSqlHostWithOptionsExchange
    PgSqlOptionExchange  now functional

src/lib/dhcpsrv/tests/pgsql_host_data_source_unittest.cc
    TEST_F(PgSqlHostDataSourceTest, addDuplicate4)
    TEST_F(PgSqlHostDataSourceTest, formattedOptionsReservations4)
    - Enabled and passing.
2016-06-24 07:31:24 -04:00
Thomas Markwalder
8047f97887 [4277] Insert and fetch IPv4 Hosts plus tests work (without options)
src/lib/dhcpsrv/host_data_source_factory.cc
    HostDataSourceFactory::create() - now instantiates PgSqlHostDataSource

src/lib/dhcpsrv/pgsql_host_data_source.cc
    Enabled basic IPv4 host statements and methods

src/lib/dhcpsrv/tests
    New file: pgsql_host_data_source_unittest.cc

src/lib/dhcpsrv/tests/Makefile.am
    Added pgsql_host_data_source_unittest.cc
2016-06-22 07:40:52 -04:00
Thomas Markwalder
334289573e [4277] Bare bones implementation of PgSqlHostDataSource
src/lib/dhcpsrv
    pgsql_host_data_source.c
    pgsql_host_data_source.h  - new files, preliminary implementation

src/lib/dhcpsrv/Makefile.am
    Added new files pgsql_host_data_source.cc, pgsql_host_data_source.h

src/lib/dhcpsrv/dhcpsrv_messages.mes
    Added log messages DHCPSRV_PGSQL_HOST_DB_GET_VERSION, DHCPSRV_PGSQL_START_TRANSACTION

src/lib/dhcpsrv/pgsql_connection.cc
src/lib/dhcpsrv/pgsql_connection.h
    Added PgSqlTransaction
    Added PgSqlConnection::startTransaction()

src/lib/dhcpsrv/pgsql_exchange.cc
src/lib/dhcpsrv/pgsql_exchange.h
    PsqlBindArray
    - Added storage of conversion strings used for bound values
    - Added add() variants for uint8_t, IOAddress, uint8_t buffer
    - Added templated variant for miscellaneous types

    PgSqlExchange
    - Removed getColumnValue variants for various integers, replaced
    with templated version for miscellaneous types

src/lib/dhcpsrv/pgsql_lease_mgr.cc
    Added todo comment to remember to account for hwaddr columns added to lease6

src/lib/dhcpsrv/tests/pgsql_exchange_unittest.cc
    TEST(PsqlBindArray, basicOperation) - new test to exercise bind functions
2016-06-21 13:21:40 -04:00