mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 12:35:17 +00:00
qemuProcessLaunch: Setup handling of 'on_reboot' via QMP when starting the process
Rather than using '-no-reboot' use the QMP command to update the lifecycle action of 'on_reboot'. This will be identical to how we set the behaviour during lifetime and also avoids problems with use of the 'system-reset' QMP command during bringup of the VM (used to update the firmware table of disks when disks were hotplugged as part of startup). Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
24dab19f8a
commit
d0fad4ab2e
@ -7024,6 +7024,37 @@ qemuProcessSetupDisksTransient(virDomainObj *vm,
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
qemuProcessSetupLifecycleActions(virDomainObj *vm,
|
||||
qemuDomainAsyncJob asyncJob)
|
||||
{
|
||||
qemuDomainObjPrivate *priv = vm->privateData;
|
||||
int rc;
|
||||
|
||||
if (!(virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_SET_ACTION)))
|
||||
return 0;
|
||||
|
||||
/* for now we handle only onReboot->destroy here as an alternative to
|
||||
* '-no-reboot' on the commandline */
|
||||
if (vm->def->onReboot != VIR_DOMAIN_LIFECYCLE_ACTION_DESTROY)
|
||||
return 0;
|
||||
|
||||
if (qemuDomainObjEnterMonitorAsync(priv->driver, vm, asyncJob) < 0)
|
||||
return -1;
|
||||
|
||||
rc = qemuMonitorSetAction(priv->mon,
|
||||
QEMU_MONITOR_ACTION_SHUTDOWN_KEEP,
|
||||
QEMU_MONITOR_ACTION_REBOOT_SHUTDOWN,
|
||||
QEMU_MONITOR_ACTION_WATCHDOG_KEEP,
|
||||
QEMU_MONITOR_ACTION_PANIC_KEEP);
|
||||
|
||||
if (qemuDomainObjExitMonitor(priv->driver, vm) < 0 || rc < 0)
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* qemuProcessLaunch:
|
||||
*
|
||||
@ -7382,6 +7413,10 @@ qemuProcessLaunch(virConnectPtr conn,
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
VIR_DEBUG("Setting handling of lifecycle actions");
|
||||
if (qemuProcessSetupLifecycleActions(vm, asyncJob) < 0)
|
||||
goto cleanup;
|
||||
|
||||
ret = 0;
|
||||
|
||||
cleanup:
|
||||
|
Loading…
x
Reference in New Issue
Block a user