]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: Reject 'preserve' action for 'on_reboot'/'on_poweroff'/'on_crash'
authorPeter Krempa <pkrempa@redhat.com>
Mon, 23 Aug 2021 14:49:11 +0000 (16:49 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Wed, 25 Aug 2021 13:32:44 +0000 (15:32 +0200)
The qemu driver didn't ever implement any meaningful handling for the
'preserve' action.

Forbid the flag in the qemu def validator and update the documentation
to be factual.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
docs/formatdomain.rst
src/qemu/qemu_validate.c

index fba4765e354563fed7b53e35a06446ca8316e479..a894a51c004151f804bbf8d7a99284606382cfca 100644 (file)
@@ -1747,8 +1747,7 @@ Each of these states allow for the same four possible actions.
    supported by the libxl hypervisor driver.)
 
 QEMU/KVM supports the ``on_poweroff`` and ``on_reboot`` events handling the
-``destroy`` and ``restart`` actions. The ``preserve`` action for an
-``on_reboot`` event is treated as a ``destroy``.
+``destroy`` and ``restart`` actions.
 
 The ``on_crash`` event supports these additional actions :since:`since 0.8.4` .
 
index 7bd8d8d9e72bb9b0c76e49b809a923a1ed556785..d27c3b6c6c9c6dd3e0406a0ff148867a9cad2d3c 100644 (file)
@@ -1079,6 +1079,16 @@ qemuValidateLifecycleAction(virDomainLifecycleAction onPoweroff,
         return -1;
     }
 
+    /* The qemu driver doesn't yet implement any meaningful handling for
+     * VIR_DOMAIN_LIFECYCLE_ACTION_PRESERVE */
+    if (onPoweroff == VIR_DOMAIN_LIFECYCLE_ACTION_PRESERVE ||
+        onReboot == VIR_DOMAIN_LIFECYCLE_ACTION_PRESERVE ||
+        onCrash == VIR_DOMAIN_LIFECYCLE_ACTION_PRESERVE) {
+        virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                       _("qemu driver doesn't support the 'preserve' action for 'on_reboot'/'on_poweroff'/'on_crash'"));
+        return -1;
+    }
+
     return 0;
 }