mirror of
https://github.com/libvirt/libvirt.git
synced 2026-08-19 01:24:42 -05:00
qemuProcessSetupLifecycleActions: Prepare to handle other actions
Rework the code so that it'll be possible to easily extend it to set other lifecycle actions in qemu. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
+12
-6
@@ -8176,21 +8176,27 @@ qemuProcessSetupLifecycleActions(virDomainObj *vm,
|
||||
virDomainAsyncJob asyncJob)
|
||||
{
|
||||
qemuDomainObjPrivate *priv = vm->privateData;
|
||||
qemuMonitorActionShutdown shutdown = QEMU_MONITOR_ACTION_SHUTDOWN_KEEP;
|
||||
qemuMonitorActionReboot reboot = QEMU_MONITOR_ACTION_REBOOT_KEEP;
|
||||
qemuMonitorActionWatchdog watchdog = QEMU_MONITOR_ACTION_WATCHDOG_KEEP;
|
||||
qemuMonitorActionPanic panic = QEMU_MONITOR_ACTION_PANIC_KEEP;
|
||||
int rc;
|
||||
|
||||
/* 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)
|
||||
if (vm->def->onReboot == VIR_DOMAIN_LIFECYCLE_ACTION_DESTROY)
|
||||
reboot = QEMU_MONITOR_ACTION_REBOOT_SHUTDOWN;
|
||||
|
||||
if (shutdown == QEMU_MONITOR_ACTION_SHUTDOWN_KEEP &&
|
||||
reboot == QEMU_MONITOR_ACTION_REBOOT_KEEP &&
|
||||
watchdog == QEMU_MONITOR_ACTION_WATCHDOG_KEEP &&
|
||||
panic == QEMU_MONITOR_ACTION_PANIC_KEEP)
|
||||
return 0;
|
||||
|
||||
if (qemuDomainObjEnterMonitorAsync(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);
|
||||
rc = qemuMonitorSetAction(priv->mon, shutdown, reboot, watchdog, panic);
|
||||
|
||||
qemuDomainObjExitMonitor(vm);
|
||||
if (rc < 0)
|
||||
|
||||
Reference in New Issue
Block a user