summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrancis Dupont <fdupont@isc.org>2022-09-07 17:01:54 +0200
committerFrancis Dupont <fdupont@isc.org>2022-09-23 15:06:06 +0200
commitfb4c9a1a7ab1f7d9876cd5b16205b8165d5751db (patch)
tree010b849d9bd4c9fdaa52a6422a9035138c06a641
parentf2e7a9968c504287db00f6a795c6b2420ebade11 (diff)
[#1654] Checkpoint: added doc
-rw-r--r--doc/sphinx/arm/hooks-lease-cmds.rst26
-rw-r--r--src/share/api/api_files.mk4
-rw-r--r--src/share/api/lease4-write.json21
-rw-r--r--src/share/api/lease6-write.json21
4 files changed, 71 insertions, 1 deletions
diff --git a/doc/sphinx/arm/hooks-lease-cmds.rst b/doc/sphinx/arm/hooks-lease-cmds.rst
index f4ee0185fe..98815d5a2d 100644
--- a/doc/sphinx/arm/hooks-lease-cmds.rst
+++ b/doc/sphinx/arm/hooks-lease-cmds.rst
@@ -95,6 +95,10 @@ This library provides the following commands:
- ``lease6-resend-ddns`` - resends a request to update DNS entries for
an existing lease.
+- ``lease4-write`` - writes the IPv4 memfile lease database into a file.
+
+- ``lease6-write`` - writes the IPv6 memfile lease database into a file.
+
All commands use JSON syntax and can be issued either using the control
channel (see :ref:`ctrl-channel`) or Control Agent (see
:ref:`kea-ctrl-agent`).
@@ -1003,3 +1007,25 @@ Here's an example of a result returned when the lease was found:
"result": 0,
"text": "NCR generated for: 2001:db8:1::1, hostname: example.com."
}
+
+.. _command-lease4-write:
+
+.. _command-lease6-write:
+
+The ``lease4-write``, ``lease6-write`` Commands
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+``lease4-write`` and ``lease6-write`` can be used to recover emergency
+situations where the memfile lease file is damage, e.g. removed by
+accident or truncated by a full file system but the in memory database
+is still valid. These commands are supported only by the memfile database
+backend and write the lease database into a CSV file. They take the path
+of the file as the ``filename`` argument. If the specified output file
+is the same as the configured memfile one the backend close and reopen
+the file in an attempt to synchronize both file and in memory images
+of the lease database.
+
+.. note::
+
+ These commands do not replace the LFC mechanism: they should be used
+ only in exceptional circumstances.
diff --git a/src/share/api/api_files.mk b/src/share/api/api_files.mk
index cc05aba4f2..7592df963f 100644
--- a/src/share/api/api_files.mk
+++ b/src/share/api/api_files.mk
@@ -38,8 +38,8 @@ api_files += $(top_srcdir)/src/share/api/ha-maintenance-notify.json
api_files += $(top_srcdir)/src/share/api/ha-maintenance-start.json
api_files += $(top_srcdir)/src/share/api/ha-reset.json
api_files += $(top_srcdir)/src/share/api/ha-scopes.json
-api_files += $(top_srcdir)/src/share/api/ha-sync.json
api_files += $(top_srcdir)/src/share/api/ha-sync-complete-notify.json
+api_files += $(top_srcdir)/src/share/api/ha-sync.json
api_files += $(top_srcdir)/src/share/api/lease4-add.json
api_files += $(top_srcdir)/src/share/api/lease4-del.json
api_files += $(top_srcdir)/src/share/api/lease4-get-all.json
@@ -51,6 +51,7 @@ api_files += $(top_srcdir)/src/share/api/lease4-get.json
api_files += $(top_srcdir)/src/share/api/lease4-resend-ddns.json
api_files += $(top_srcdir)/src/share/api/lease4-update.json
api_files += $(top_srcdir)/src/share/api/lease4-wipe.json
+api_files += $(top_srcdir)/src/share/api/lease4-write.json
api_files += $(top_srcdir)/src/share/api/lease6-add.json
api_files += $(top_srcdir)/src/share/api/lease6-bulk-apply.json
api_files += $(top_srcdir)/src/share/api/lease6-del.json
@@ -62,6 +63,7 @@ api_files += $(top_srcdir)/src/share/api/lease6-get.json
api_files += $(top_srcdir)/src/share/api/lease6-resend-ddns.json
api_files += $(top_srcdir)/src/share/api/lease6-update.json
api_files += $(top_srcdir)/src/share/api/lease6-wipe.json
+api_files += $(top_srcdir)/src/share/api/lease6-write.json
api_files += $(top_srcdir)/src/share/api/leases-reclaim.json
api_files += $(top_srcdir)/src/share/api/libreload.json
api_files += $(top_srcdir)/src/share/api/list-commands.json
diff --git a/src/share/api/lease4-write.json b/src/share/api/lease4-write.json
new file mode 100644
index 0000000000..28ccaba222
--- /dev/null
+++ b/src/share/api/lease4-write.json
@@ -0,0 +1,21 @@
+{
+ "access": "write",
+ "avail": "2.3.1",
+ "brief": [
+ "This command writes the IPv4 memfile lease database into a CSV file."
+ ],
+ "cmd-syntax": [
+ "{",
+ " \"command\": \"lease4-write\",",
+ " \"arguments\": {",
+ " \"filename\": \"a_file.csv\"",
+ " }",
+ "}"
+ ],
+ "description": "See <xref linkend=\"idp63\"/>",
+ "hook": "lease_cmds",
+ "name": "lease4-write",
+ "support": [
+ "kea-dhcp4"
+ ]
+}
diff --git a/src/share/api/lease6-write.json b/src/share/api/lease6-write.json
new file mode 100644
index 0000000000..15301c6b8e
--- /dev/null
+++ b/src/share/api/lease6-write.json
@@ -0,0 +1,21 @@
+{
+ "access": "write",
+ "avail": "2.3.1",
+ "brief": [
+ "This command writes the IPv6 memfile lease database into a CSV file."
+ ],
+ "cmd-syntax": [
+ "{",
+ " \"command\": \"lease6-write\",",
+ " \"arguments\": {",
+ " \"filename\": \"a_file.csv\"",
+ " }",
+ "}"
+ ],
+ "description": "See <xref linkend=\"idp63\"/>",
+ "hook": "lease_cmds",
+ "name": "lease6-write",
+ "support": [
+ "kea-dhcp6"
+ ]
+}