2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-08-30 21:45:37 +00:00

[master] Finishing merge of trac5494 (Cassandra vs macOS)

This commit is contained in:
Francis Dupont
2018-02-08 16:02:48 +01:00
12 changed files with 60 additions and 20 deletions

View File

@@ -160,6 +160,9 @@ We have received the following contributions:
- Ebben Aries - Ebben Aries
2017-10: Option length checks improvements for the V-I Vendor Class option 2017-10: Option length checks improvements for the V-I Vendor Class option
- Ryan Goodfellow (rcgoodfellow)
2018-01: Fix kea-admin typo breaking lease-dump
Kea uses log4cplus (http://sourceforge.net/projects/log4cplus/) for logging, Kea uses log4cplus (http://sourceforge.net/projects/log4cplus/) for logging,
Boost (http://www.boost.org/) library for almost everything, and can use Botan Boost (http://www.boost.org/) library for almost everything, and can use Botan
(http://botan.randombit.net/) or OpenSSL (https://www.openssl.org/) for (http://botan.randombit.net/) or OpenSSL (https://www.openssl.org/) for

View File

@@ -1,3 +1,11 @@
1358. [build,bug] fdupont
Cassandra build fixes for macOS.
(Trac #5494, git xxx)
1357. [bug] rcgoodfellow
Fixed bug in kea-admon causing error on lease-dump.
(github #61, git xxx)
1356. [func] andreipavelQ,tomek 1356. [func] andreipavelQ,tomek
The logging configuration is now applied early, which helps The logging configuration is now applied early, which helps
seeing errors in case the new configuration is faulty. seeing errors in case the new configuration is faulty.

View File

@@ -263,7 +263,24 @@ local all postgres trust
@subsection cqlUnitTestsPrerequisites Cassandra database @subsection cqlUnitTestsPrerequisites Cassandra database
@todo: Describe steps necessary to set up Cassandra database suitable for running @todo: Describe steps necessary to set up Cassandra database suitable
unittests. for running unittests.
It seems this was enough:
-# Launch cassandra if not running (-f for foreground)
@verbatim
% cassandra -f
@endverbatim
The tool is cqlsh:
-# Run the tool
@verbatim
% cqlsh
Connected to Test Cluster at 127.0.0.1:9042.
[cqlsh 5.0.1 | Cassandra 3.11.1 | CQL spec 3.4.4 | Native protocol v4]
Use HELP for help.
cqlsh> @endverbatim\n
*/ */

View File

@@ -527,7 +527,7 @@ Debian and Ubuntu:
"configure" step (see <xref linkend="configure"/>), the --with-mysql switch "configure" step (see <xref linkend="configure"/>), the --with-mysql switch
should be specified: should be specified:
<screen><userinput>./configure [other-options] --with-mysql</userinput></screen> <screen><userinput>./configure [other-options] --with-mysql</userinput></screen>
If MySQL was not installed in the default location, the location of the MySQL If MySQL was not installed in the default location, the location of the MySQL
configuration program "mysql_config" should be included with the switch, i.e. configuration program "mysql_config" should be included with the switch, i.e.
<screen><userinput>./configure [other-options] --with-mysql=<replaceable>path-to-mysql_config</replaceable></userinput></screen> <screen><userinput>./configure [other-options] --with-mysql=<replaceable>path-to-mysql_config</replaceable></userinput></screen>
</para> </para>
@@ -549,7 +549,7 @@ Debian and Ubuntu:
"configure" step (see <xref linkend="configure"/>), the --with-pgsql switch "configure" step (see <xref linkend="configure"/>), the --with-pgsql switch
should be specified: should be specified:
<screen><userinput>./configure [other-options] --with-pgsql</userinput></screen> <screen><userinput>./configure [other-options] --with-pgsql</userinput></screen>
If PostgreSQL was not installed in the default location, the location of the PostgreSQL If PostgreSQL was not installed in the default location, the location of the PostgreSQL
configuration program "pg_config" should be included with the switch, i.e. configuration program "pg_config" should be included with the switch, i.e.
<screen><userinput>./configure [other-options] --with-pgsql=<replaceable>path-to-pg_config</replaceable></userinput></screen> <screen><userinput>./configure [other-options] --with-pgsql=<replaceable>path-to-pg_config</replaceable></userinput></screen>
</para> </para>
@@ -574,6 +574,7 @@ Debian and Ubuntu:
$ <userinput>git clone https://github.com/datastax/cpp-driver</userinput> $ <userinput>git clone https://github.com/datastax/cpp-driver</userinput>
$ <userinput>cd cpp-driver</userinput> $ <userinput>cd cpp-driver</userinput>
$ <userinput>mkdir build</userinput> $ <userinput>mkdir build</userinput>
$ <userinput>cd build</userinput>
$ <userinput>cmake ..</userinput> $ <userinput>cmake ..</userinput>
$ <userinput>make</userinput> $ <userinput>make</userinput>
</screen> </screen>

View File

@@ -1,4 +1,4 @@
# Copyright (C) 2014-2017 Internet Systems Consortium, Inc. ("ISC") # Copyright (C) 2014-2018 Internet Systems Consortium, Inc. ("ISC")
# #
# This Source Code Form is subject to the terms of the Mozilla Public # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this # License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -141,7 +141,8 @@ cql_execute_script() {
cql_version() { cql_version() {
version=$(cql_execute "SELECT version, minor FROM schema_version" "$@") version=$(cql_execute "SELECT version, minor FROM schema_version" "$@")
version=$(echo "$version" | grep -A 1 "+" | grep -v "+" | tr -d ' ' | cut -d "|" -f 1-2 --output-delimiter=".") error=$?
echo "${version}" version=$(echo "$version" | grep -A 1 "+" | grep -v "+" | tr -d ' ' | cut -d "|" -f 1-2 | tr "|" ".")
return $? echo "$version"
return $error
} }

View File

@@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
# Copyright (C) 2014-2017 Internet Systems Consortium, Inc. ("ISC") # Copyright (C) 2014-2018 Internet Systems Consortium, Inc. ("ISC")
# #
# This Source Code Form is subject to the terms of the Mozilla Public # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this # License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -448,7 +448,7 @@ mysql_dump() {
### Functions used for dump ### Functions used for dump
pgsql_dump() { pgsql_dump() {
# Check the lease type was given # Check the lease type was given
if [ $dump_type -eq o ]; then if [ $dump_type -eq 0 ]; then
log_error "lease-dump: lease type ( -4 or -6 ) needs to be specified" log_error "lease-dump: lease type ( -4 or -6 ) needs to be specified"
usage usage
exit 1 exit 1
@@ -518,11 +518,11 @@ cql_dump() {
fi fi
# Parse and display header. # Parse and display header.
echo "$result" | head -n 2 | tail -n 1 | sed -e 's/\s*//g' | sed -e 's/|/,/g' > $dump_file echo "$result" | head -n 2 | tail -n 1 | sed -e 's/[[:space:]]*//g' | sed -e 's/|/,/g' > $dump_file
# Parse and display contents - done separately from header to allow sorting # Parse and display contents - done separately from header to allow sorting
# by address. # by address. awk script replaces head -n -2 which is not portable.
echo "$result" | tail -n +4 | head -n -2 | sed -e 's/\s*//g' | sed -e 's/|/,/g' | sort -r >> $dump_file echo "$result" | tail -n +4 | awk 'n>=2 { print a[n%2] } { a[n%2]=$0; n=n+1 }' | sed -e 's/[[:space:]]*//g' | sed -e 's/|/,/g' | sort -r >> $dump_file
echo lease$dump_type successfully dumped to $dump_file echo lease$dump_type successfully dumped to $dump_file
exit 0 exit 0

View File

@@ -330,7 +330,7 @@ public:
/// ///
/// @throw isc::dhcp::DbOperationError An operation on the open database has /// @throw isc::dhcp::DbOperationError An operation on the open database has
/// failed. /// failed.
virtual bool deleteLease(const isc::asiolink::IOAddress& addr); virtual bool deleteLease(const isc::asiolink::IOAddress& addr) override;
/// @brief Deletes all expired and reclaimed DHCPv4 leases. /// @brief Deletes all expired and reclaimed DHCPv4 leases.
/// ///
@@ -361,7 +361,7 @@ public:
/// ///
/// @param subnet_id identifier of the subnet /// @param subnet_id identifier of the subnet
/// @return number of leases removed. /// @return number of leases removed.
virtual size_t wipeLeases4(const SubnetID& subnet_id); virtual size_t wipeLeases4(const SubnetID& subnet_id) override;
/// @brief Removed specified IPv6 leases. /// @brief Removed specified IPv6 leases.
/// ///
@@ -372,7 +372,7 @@ public:
/// ///
/// @param subnet_id identifier of the subnet /// @param subnet_id identifier of the subnet
/// @return number of leases removed. /// @return number of leases removed.
virtual size_t wipeLeases6(const SubnetID& subnet_id); virtual size_t wipeLeases6(const SubnetID& subnet_id) override;
/// @brief Return backend type /// @brief Return backend type
/// ///

View File

@@ -1,4 +1,4 @@
-- Copyright (C) 2015-2017 Deutsche Telekom AG. -- Copyright (C) 2015-2018 Deutsche Telekom AG.
-- Author: Razvan Becheriu <razvan.becheriu@qualitance.com> -- Author: Razvan Becheriu <razvan.becheriu@qualitance.com>
@@ -152,6 +152,8 @@ INSERT INTO lease_hwaddr_source (hwaddr_source, name) VALUES (32, 'HWADDR_SOURCE
-- Hardware address extracted from docsis options -- Hardware address extracted from docsis options
INSERT INTO lease_hwaddr_source (hwaddr_source, name) VALUES (64, 'HWADDR_SOURCE_DOCSIS_CMTS'); INSERT INTO lease_hwaddr_source (hwaddr_source, name) VALUES (64, 'HWADDR_SOURCE_DOCSIS_CMTS');
INSERT INTO lease_hwaddr_source (hwaddr_source, name) VALUES (128, 'HWADDR_SOURCE_DOCSIS_MODEM');
-- Create table holding mapping of the lease states to their names. -- Create table holding mapping of the lease states to their names.
-- This is not used in queries from the DHCP server but rather in -- This is not used in queries from the DHCP server but rather in
-- direct queries from the lease database management tools. -- direct queries from the lease database management tools.

View File

@@ -21,6 +21,8 @@ DROP TABLE IF EXISTS lease_hwaddr_source;
DROP TABLE IF EXISTS lease_state; DROP TABLE IF EXISTS lease_state;
DROP TABLE IF EXISTS schema_version; DROP TABLE IF EXISTS schema_version;
DROP TABLE IF EXISTS host_reservations; DROP TABLE IF EXISTS host_reservations;
DROP TABLE IF EXISTS dhcp4_options;
DROP TABLE IF EXISTS dhcp6_options;
DROP INDEX IF EXISTS lease4index1; DROP INDEX IF EXISTS lease4index1;
DROP INDEX IF EXISTS lease4index2; DROP INDEX IF EXISTS lease4index2;

View File

@@ -20,6 +20,6 @@ EXTRA_DIST = system_messages
# Scripts for Cassandra support. Ultimately those scripts will have to be # Scripts for Cassandra support. Ultimately those scripts will have to be
# incorporated in DataStax cpp-driver source tree, but until that happens, # incorporated in DataStax cpp-driver source tree, but until that happens,
# let's keep them in Kea rpo # let's keep them in Kea rpo
EXTRA_DIST += cql_config cql_config_defines.sh EXTRA_DIST += cql_config cql_config_defines.sh.sample
endif endif

View File

@@ -1,8 +1,14 @@
#!/bin/bash #!/bin/bash
DIR=$(readlink -f $0 | xargs dirname)
if test `uname -s` = "Darwin"; then
DIR=$(stat -f %N $0 | xargs dirname)
else
DIR=$(readlink -f $0 | xargs dirname)
fi
if ! [ -f ${DIR}/cql_config_defines.sh ] || ! [ -x ${DIR}/cql_config_defines.sh ] if ! [ -f ${DIR}/cql_config_defines.sh ] || ! [ -x ${DIR}/cql_config_defines.sh ]
then then
echo "missing path configuration file for DataStax Cassandra (cql_config_defines.h)" echo "missing path configuration file for DataStax Cassandra (cql_config_defines.sh)"
exit 0 exit 0
fi fi
source ${DIR}/cql_config_defines.sh source ${DIR}/cql_config_defines.sh