[PATCH v2 3/3] virhook: changes in docs about support hooks placed in several files

Dmitry Nesterenko dmitry.nesterenko at virtuozzo.com
Tue Jun 23 14:45:35 UTC 2020


Signed-off-by: Dmitry Nesterenko <dmitry.nesterenko at virtuozzo.com>
---
 NEWS.rst           |  6 ++++++
 docs/hooks.html.in | 27 +++++++++++++++++++++++++++
 2 files changed, 33 insertions(+)

diff --git a/NEWS.rst b/NEWS.rst
index 42d159b233..18917d9e95 100644
--- a/NEWS.rst
+++ b/NEWS.rst
@@ -28,6 +28,12 @@ v6.5.0 (unreleased)
     schema for node devices was expanded to support attributes for mediated
     devices.
 
+  * virhook: Support hooks placed in several files
+
+    Running all scripts from directory /etc/libvirt/hooks/<driver>.d in
+    alphabetical order. Hook script in old place will be executed
+    as first for backward compatibility.
+
 * **Improvements**
 
 * **Bug fixes**
diff --git a/docs/hooks.html.in b/docs/hooks.html.in
index 7c9d3ef7f3..a38ba05522 100644
--- a/docs/hooks.html.in
+++ b/docs/hooks.html.in
@@ -36,6 +36,9 @@
       <li>If your installation of libvirt has instead been compiled from
           source, it is likely to be
           <code>/usr/local/etc/libvirt/hooks/</code>.</li>
+      <li><span class="since">Since 6.5.0</span>, you can also place several
+          hook scripts in the directories
+          <code>/etc/libvirt/hooks/<driver>.d/</code>.</li>
     </ul>
     <p>To use hook scripts, you will need to create this <code>hooks</code>
        directory manually, place the desired hook scripts inside, then make
@@ -59,6 +62,10 @@
           Executed when a network is started or stopped or an
           interface is plugged/unplugged to/from the network</li>
     </ul>
+    <p><span class="since">Since 6.5.0</span>, you can also have
+       several scripts with any name in the directories
+       <code>/etc/libvirt/hooks/<driver>.d/</code>. They are
+       executed in alphabetical order after main script.</p>
     <br/>
 
     <h2><a id="structure">Script structure</a></h2>
@@ -191,6 +198,16 @@
         script returns failure or the output XML is not valid, restore of the
         image will be aborted. This hook may be used, e.g., to change
         location of disk images for restored domains.</li>
+      <li><span class="since">Since 6.5.0</span>, you can also place several
+        hook scripts in the directory
+        <code>/etc/libvirt/hooks/qemu.d/</code>. They are executed in
+        alphabetical order after main script. In this case each script also
+        acts as filter and can modify the domain XML and print it out on
+        its standart output. This script output is passed to standard input
+        next script in order. Empty output from any script is also identical
+        to copying the input XML without changing it.
+        In case any script returns failure common process will be aborted,
+        but all scripts from the directory will are executed.</li>
       <li><span class="since">Since 0.9.13</span>, the qemu hook script
         is also called when the libvirtd daemon restarts and reconnects
         to previously running QEMU processes. If the script fails, the
@@ -274,6 +291,16 @@
         script returns failure or the output XML is not valid, incoming
         migration will be canceled. This hook may be used, e.g., to change
         location of disk images for incoming domains.</li>
+      <li><span class="since">Since 6.5.0</span>, you can also place several
+        hook scripts in the directory
+        <code>/etc/libvirt/hooks/libxl.d/</code>. They are executed in
+        alphabetical order after main script. In this case each script also
+        acts as filter and can modify the domain XML and print it out on
+        its standart output. This script output is passed to standard input
+        next script in order. Empty output from any script is also identical
+        to copying the input XML without changing it.
+        In case any script returns failure common process will be aborted,
+        but all scripts from the directory will are executed.</li>
       <li><span class="since">Since 2.1.0</span>, the libxl hook script
         is also called when the libvirtd daemon restarts and reconnects
         to previously running Xen domains. If the script fails, the
-- 
2.18.4




More information about the libvir-list mailing list