119c2d
From 8363046dd5f3e018aaea7b6d9b711fb3d1e417cc Mon Sep 17 00:00:00 2001
119c2d
Message-Id: <8363046dd5f3e018aaea7b6d9b711fb3d1e417cc@dist-git>
119c2d
From: Jim Fehlig <jfehlig@suse.com>
119c2d
Date: Fri, 7 Jan 2022 14:35:10 -0700
119c2d
Subject: [PATCH] docs: Add man page for libvirt-guests
119c2d
119c2d
Signed-off-by: Jim Fehlig <jfehlig@suse.com>
119c2d
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
119c2d
(cherry picked from commit 161727417a91bdddf8f3167cf70c3de2829be81c)
119c2d
119c2d
https://bugzilla.redhat.com/show_bug.cgi?id=2042529
119c2d
---
119c2d
 docs/manpages/index.rst          |   1 +
119c2d
 docs/manpages/libvirt-guests.rst | 151 +++++++++++++++++++++++++++++++
119c2d
 docs/manpages/meson.build        |   1 +
119c2d
 libvirt.spec.in                  |   1 +
119c2d
 tools/libvirt-guests.service.in  |   2 +-
119c2d
 5 files changed, 155 insertions(+), 1 deletion(-)
119c2d
 create mode 100644 docs/manpages/libvirt-guests.rst
119c2d
119c2d
diff --git a/docs/manpages/index.rst b/docs/manpages/index.rst
119c2d
index fb4a36d46a..8fd0d90041 100644
119c2d
--- a/docs/manpages/index.rst
119c2d
+++ b/docs/manpages/index.rst
119c2d
@@ -41,6 +41,7 @@ Tools
119c2d
 * `virt-admin(1) <virt-admin.html>`__ - daemon administration interface
119c2d
 * `virsh(1) <virsh.html>`__ - management user interface
119c2d
 * `virt-qemu-run(1) <virt-qemu-run.html>`__ - run standalone QEMU instances
119c2d
+* `libvirt-guests(8) <libvirt-guests.html>`__ - suspend/resume running libvirt guests
119c2d
 
119c2d
 Key codes
119c2d
 =========
119c2d
diff --git a/docs/manpages/libvirt-guests.rst b/docs/manpages/libvirt-guests.rst
119c2d
new file mode 100644
119c2d
index 0000000000..76045ed11a
119c2d
--- /dev/null
119c2d
+++ b/docs/manpages/libvirt-guests.rst
119c2d
@@ -0,0 +1,151 @@
119c2d
+==============
119c2d
+libvirt-guests
119c2d
+==============
119c2d
+
119c2d
+-------------------------------------
119c2d
+suspend/resume running libvirt guests
119c2d
+-------------------------------------
119c2d
+
119c2d
+:Manual section: 8
119c2d
+:Manual group: Virtualization Support
119c2d
+
119c2d
+.. contents::
119c2d
+
119c2d
+SYNOPSIS
119c2d
+========
119c2d
+
119c2d
+``libvirt-guests`` *COMMAND*
119c2d
+
119c2d
+
119c2d
+DESCRIPTION
119c2d
+===========
119c2d
+
119c2d
+``libvirt-guests`` is a service that can be used to coordinate guest and host
119c2d
+lifecyle actions. By default, ``libvirt-guests`` will suspend running guests
119c2d
+when the host shuts down, and restore them to their pre-shutdown state when
119c2d
+the host reboots.
119c2d
+
119c2d
+``libvirt-guests`` is typically under control of systemd. When
119c2d
+``libvirt-guests.service`` is enabled, systemd will call ``libvirt-guests``
119c2d
+with the ``start`` *COMMAND* when the host boots. Conversely, systemd will call
119c2d
+``libvirt-guests`` with the ``stop`` *COMMAND* when the host shuts down.
119c2d
+
119c2d
+``libvirt-guests`` can be used directly. In addition to the ``start`` and
119c2d
+``stop`` *COMMAND*\s, it also supports ``status``, ``restart``, ``condrestart``,
119c2d
+``try-restart``, ``reload``, ``force-reload``, ``gueststatus``, and
119c2d
+``shutdown`` *COMMAND*\s.
119c2d
+
119c2d
+
119c2d
+FILES
119c2d
+=====
119c2d
+
119c2d
+``libvirt-guests`` defines several variables to control service behavior.
119c2d
+The default vaule of these variables can be overridden in:
119c2d
+
119c2d
+* ``@SYSCONFDIR@/sysconfig/libvirt-guests``
119c2d
+
119c2d
+The following variables are supported:
119c2d
+
119c2d
+- URIS=default
119c2d
+
119c2d
+  URIs to check for running guests. Example:
119c2d
+  ``URIS='default xen:///system xen+tcp://host/system lxc:///system'``
119c2d
+
119c2d
+- ON_BOOT=start
119c2d
+
119c2d
+  Action taken on host boot
119c2d
+
119c2d
+  * start
119c2d
+
119c2d
+    All guests which were running on shutdown are started on boot regardless
119c2d
+    of their autostart settings
119c2d
+
119c2d
+  * ignore
119c2d
+
119c2d
+    ``libvirt-guests`` won't start any guest on boot, however, guests marked
119c2d
+    as autostart will still be automatically started by libvirtd
119c2d
+
119c2d
+- START_DELAY=0
119c2d
+
119c2d
+  Number of seconds to wait between each guest start. Set to 0 to allow parallel
119c2d
+  startup.
119c2d
+
119c2d
+- ON_SHUTDOWN=suspend
119c2d
+
119c2d
+  Action taken on host shutdown
119c2d
+
119c2d
+  * suspend
119c2d
+
119c2d
+    All running guests are suspended using virsh managedsave
119c2d
+
119c2d
+  * shutdown
119c2d
+
119c2d
+    All running guests are asked to shutdown. Please be careful with this
119c2d
+    settings since there is no way to distinguish between a guest which is
119c2d
+    stuck or ignores shutdown requests and a guest which just needs a long
119c2d
+    time to shutdown. When setting ON_SHUTDOWN=shutdown, you must also set
119c2d
+    SHUTDOWN_TIMEOUT to a value suitable for your guests.
119c2d
+
119c2d
+- PARALLEL_SHUTDOWN=0
119c2d
+
119c2d
+  Number of guests will be shutdown concurrently, taking effect when
119c2d
+  "ON_SHUTDOWN" is set to "shutdown". If Set to 0, guests will be shutdown one
119c2d
+  after another. Number of guests on shutdown at any time will not exceed number
119c2d
+  set in this variable.
119c2d
+
119c2d
+- SHUTDOWN_TIMEOUT=300
119c2d
+
119c2d
+  Number of seconds we're willing to wait for a guest to shut down. If parallel
119c2d
+  shutdown is enabled, this timeout applies as a timeout for shutting down all
119c2d
+  guests on a single URI defined in the variable URIS. If this is 0, then there
119c2d
+  is no time out (use with caution, as guests might not respond to a shutdown
119c2d
+  request). The default value is 300 seconds (5 minutes).
119c2d
+
119c2d
+- BYPASS_CACHE=0
119c2d
+
119c2d
+  If non-zero, try to bypass the file system cache when saving and
119c2d
+  restoring guests, even though this may give slower operation for
119c2d
+  some file systems.
119c2d
+
119c2d
+- SYNC_TIME=0
119c2d
+
119c2d
+  If non-zero, try to sync guest time on domain resume. Be aware, that
119c2d
+  this requires guest agent with support for time synchronization
119c2d
+  running in the guest. By default, this functionality is turned off.
119c2d
+
119c2d
+
119c2d
+BUGS
119c2d
+====
119c2d
+
119c2d
+Please report all bugs you discover.  This should be done via either:
119c2d
+
119c2d
+#. the mailing list
119c2d
+
119c2d
+   `https://libvirt.org/contact.html <https://libvirt.org/contact.html>`_
119c2d
+
119c2d
+#. the bug tracker
119c2d
+
119c2d
+   `https://libvirt.org/bugs.html <https://libvirt.org/bugs.html>`_
119c2d
+
119c2d
+Alternatively, you may report bugs to your software distributor / vendor.
119c2d
+
119c2d
+
119c2d
+AUTHORS
119c2d
+=======
119c2d
+
119c2d
+Please refer to the AUTHORS file distributed with libvirt.
119c2d
+
119c2d
+
119c2d
+LICENSE
119c2d
+=======
119c2d
+
119c2d
+``libvirt-guests`` is distributed under the terms of the GNU LGPL v2.1+.
119c2d
+This is free software; see the source for copying conditions. There
119c2d
+is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
119c2d
+PURPOSE
119c2d
+
119c2d
+
119c2d
+SEE ALSO
119c2d
+========
119c2d
+
119c2d
+libvirtd(8), `https://libvirt.org/ <https://libvirt.org/>`_
119c2d
diff --git a/docs/manpages/meson.build b/docs/manpages/meson.build
119c2d
index 150f45d296..bad9b62a2e 100644
119c2d
--- a/docs/manpages/meson.build
119c2d
+++ b/docs/manpages/meson.build
119c2d
@@ -21,6 +21,7 @@ docs_man_files = [
119c2d
   { 'name': 'virt-qemu-run', 'section': '1', 'install': conf.has('WITH_QEMU') },
119c2d
   { 'name': 'virt-xml-validate', 'section': '1', 'install': true },
119c2d
 
119c2d
+  { 'name': 'libvirt-guests', 'section': '8', 'install': conf.has('WITH_LIBVIRTD') },
119c2d
   { 'name': 'libvirtd', 'section': '8', 'install': conf.has('WITH_LIBVIRTD') },
119c2d
   { 'name': 'virt-sanlock-cleanup', 'section': '8', 'install': conf.has('WITH_SANLOCK') },
119c2d
   { 'name': 'virt-ssh-helper', 'section': '8', 'install': conf.has('WITH_LIBVIRTD') },
119c2d
diff --git a/tools/libvirt-guests.service.in b/tools/libvirt-guests.service.in
119c2d
index 10c664016a..1a9b233e11 100644
119c2d
--- a/tools/libvirt-guests.service.in
119c2d
+++ b/tools/libvirt-guests.service.in
119c2d
@@ -6,7 +6,7 @@ After=network.target
119c2d
 After=time-sync.target
119c2d
 After=libvirtd.service
119c2d
 After=virt-guest-shutdown.target
119c2d
-Documentation=man:libvirtd(8)
119c2d
+Documentation=man:libvirt-guests(8)
119c2d
 Documentation=https://libvirt.org
119c2d
 
119c2d
 [Service]
119c2d
-- 
119c2d
2.35.0
119c2d