supported by the libxl hypervisor driver.)
QEMU/KVM supports the ``on_poweroff`` and ``on_reboot`` events handling the
-``destroy`` and ``restart`` actions.
+``destroy`` and ``restart`` actions, but the combiatnion of ``on_poweroff`` set
+to ``restart`` and ``on_reboot`` set to ``destroy`` is forbidden.
The ``on_crash`` event supports these additional actions :since:`since 0.8.4` .
{
qemuDomainObjPrivate *priv = vm->privateData;
- if (priv->fakeReboot) {
+ if (priv->fakeReboot ||
+ vm->def->onPoweroff == VIR_DOMAIN_LIFECYCLE_ACTION_RESTART) {
g_autofree char *name = g_strdup_printf("reboot-%s", vm->def->name);
virThread th;
/* In case of fake reboot qemu shutdown state is transient so don't
* change domain state nor send events. */
- if (!priv->fakeReboot) {
+ if (!priv->fakeReboot ||
+ vm->def->onPoweroff != VIR_DOMAIN_LIFECYCLE_ACTION_RESTART) {
VIR_DEBUG("Transitioned guest %s to shutdown state",
vm->def->name);
virDomainObjSetState(vm,
return -1;
}
+ /* the qemu driver can't meaningfully handle
+ * onPoweroff -> reboot + onReboot -> destroy */
+ if (onPoweroff == VIR_DOMAIN_LIFECYCLE_ACTION_RESTART &&
+ onReboot == VIR_DOMAIN_LIFECYCLE_ACTION_DESTROY) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("qemu driver doesn't support 'onReboot' set to 'destroy and 'onPoweroff' set to 'reboot'"));
+ return -1;
+ }
+
return 0;
}