mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 14:15:28 +00:00
qemu: save domain state to XML after reboot
Currently qemuDomainReboot() does reboot in two phases: qemuMonitorSystemPowerdown() and qemuProcessFakeReboot(). qemuMonitorSystemPowerdown() shutdowns the domain and saves domain state/reason as VIR_DOMAIN_SHUTDOWN_UNKNOWN. qemuProcessFakeReboot() sets domain state/reason to VIR_DOMAIN_RESUMED_UNPAUSED but does not save domain state changes. Subsequent restart of libvirtd leads to restoring domain state/reason to saved that is VIR_DOMAIN_SHUTDOWN_UNKNOWN and to automatic shutdown of the domain. This commit adds virDomainSaveStatus() into qemuProcessFakeReboot() to avoid unexpected shutdowns.
This commit is contained in:
parent
befc36a81d
commit
2697c8a116
@ -547,6 +547,7 @@ qemuProcessFakeReboot(void *opaque)
|
||||
virDomainObjPtr vm = opaque;
|
||||
qemuDomainObjPrivatePtr priv = vm->privateData;
|
||||
virDomainEventPtr event = NULL;
|
||||
virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
|
||||
int ret = -1;
|
||||
VIR_DEBUG("vm=%p", vm);
|
||||
virObjectLock(vm);
|
||||
@ -585,6 +586,11 @@ qemuProcessFakeReboot(void *opaque)
|
||||
VIR_DOMAIN_EVENT_RESUMED,
|
||||
VIR_DOMAIN_EVENT_RESUMED_UNPAUSED);
|
||||
|
||||
if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0) {
|
||||
VIR_WARN("Unable to save status on vm %s after state change",
|
||||
vm->def->name);
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
|
||||
endjob:
|
||||
@ -601,6 +607,7 @@ cleanup:
|
||||
}
|
||||
if (event)
|
||||
qemuDomainEventQueue(driver, event);
|
||||
virObjectUnref(cfg);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user