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. --- src/qemu/qemu_process.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index e5b4679..cbe35ac 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -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); } -- 1.8.2.1 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list