提交 6ea54769 编写于 作者: M Michal Privoznik

qemu: Update fsfreeze status on domain state transitions

https://bugzilla.redhat.com/show_bug.cgi?id=1160084

As of b6d4dad1 (1.2.5) libvirt keeps track if domain disks have been
frozen. However, this falls into that set of information which don't
survive domain restart. Therefore, we need to clear the flag upon some
state transitions. Moreover, once we clear the flag we must update the
status file too.
Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
上级 b84be34f
...@@ -4040,11 +4040,6 @@ processGuestPanicEvent(virQEMUDriverPtr driver, ...@@ -4040,11 +4040,6 @@ processGuestPanicEvent(virQEMUDriverPtr driver,
VIR_WARN("Unable to release lease on %s", vm->def->name); VIR_WARN("Unable to release lease on %s", vm->def->name);
VIR_DEBUG("Preserving lock state '%s'", NULLSTR(priv->lockState)); VIR_DEBUG("Preserving lock state '%s'", NULLSTR(priv->lockState));
if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0) {
VIR_WARN("Unable to save status on vm %s after state change",
vm->def->name);
}
switch (action) { switch (action) {
case VIR_DOMAIN_LIFECYCLE_CRASH_COREDUMP_DESTROY: case VIR_DOMAIN_LIFECYCLE_CRASH_COREDUMP_DESTROY:
if (doCoreDumpToAutoDumpPath(driver, vm, VIR_DUMP_MEMORY_ONLY) < 0) { if (doCoreDumpToAutoDumpPath(driver, vm, VIR_DUMP_MEMORY_ONLY) < 0) {
...@@ -4102,6 +4097,11 @@ processGuestPanicEvent(virQEMUDriverPtr driver, ...@@ -4102,6 +4097,11 @@ processGuestPanicEvent(virQEMUDriverPtr driver,
} }
cleanup: cleanup:
if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0) {
VIR_WARN("Unable to save status on vm %s after state change",
vm->def->name);
}
virObjectUnref(cfg); virObjectUnref(cfg);
} }
......
...@@ -529,6 +529,7 @@ qemuProcessHandleReset(qemuMonitorPtr mon ATTRIBUTE_UNUSED, ...@@ -529,6 +529,7 @@ qemuProcessHandleReset(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
virQEMUDriverPtr driver = opaque; virQEMUDriverPtr driver = opaque;
virObjectEventPtr event; virObjectEventPtr event;
qemuDomainObjPrivatePtr priv; qemuDomainObjPrivatePtr priv;
virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
virObjectLock(vm); virObjectLock(vm);
...@@ -536,12 +537,20 @@ qemuProcessHandleReset(qemuMonitorPtr mon ATTRIBUTE_UNUSED, ...@@ -536,12 +537,20 @@ qemuProcessHandleReset(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
priv = vm->privateData; priv = vm->privateData;
if (priv->agent) if (priv->agent)
qemuAgentNotifyEvent(priv->agent, QEMU_AGENT_EVENT_RESET); qemuAgentNotifyEvent(priv->agent, QEMU_AGENT_EVENT_RESET);
/* Clear some domain runtime information. For instance,
* fsfreeze won't survive domain reset. This, however,
* required the domain status file to be rewritten onto disk. */
priv->quiesced = false;
if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0)
VIR_WARN("Failed to save status on vm %s", vm->def->name);
virObjectUnlock(vm); virObjectUnlock(vm);
if (event) if (event)
qemuDomainEventQueue(driver, event); qemuDomainEventQueue(driver, event);
virObjectUnref(cfg);
return 0; return 0;
} }
...@@ -4849,6 +4858,7 @@ void qemuProcessStop(virQEMUDriverPtr driver, ...@@ -4849,6 +4858,7 @@ void qemuProcessStop(virQEMUDriverPtr driver,
virPortAllocatorRelease(driver->migrationPorts, priv->nbdPort); virPortAllocatorRelease(driver->migrationPorts, priv->nbdPort);
priv->nbdPort = 0; priv->nbdPort = 0;
priv->quiesced = false;
if (priv->agent) { if (priv->agent) {
qemuAgentClose(priv->agent); qemuAgentClose(priv->agent);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册