In qemu driver we listen to virtio channel events like an agent
connected to or disconnected from the guest part of socket.
However, with a little exception - when we find out that the
socket in question is the guest agent one, we connect or
disconnect guest agent which is done prior setting new state in
internal structure. Due to a bug in our code it may happen that
we got the event but failed to set it in internal structure
representing the channel.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
src/qemu/qemu_driver.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index e2134ee..8ccf68b 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -4457,6 +4457,12 @@ processSerialChangedEvent(virQEMUDriverPtr driver,
dev.data.chr->targetType != VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_VIRTIO)
goto endjob;
+ dev.data.chr->state = newstate;
+
+ if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0)
+ VIR_WARN("unable to save status of domain %s after updating state of "
+ "channel %s", vm->def->name, devAlias);
+
if (STREQ_NULLABLE(dev.data.chr->target.name, "org.qemu.guest_agent.0"))
{
if (newstate == VIR_DOMAIN_CHR_DEVICE_STATE_CONNECTED) {
if (!priv->agent) {
@@ -4479,12 +4485,6 @@ processSerialChangedEvent(virQEMUDriverPtr driver,
qemuDomainEventQueue(driver, event);
}
- dev.data.chr->state = newstate;
-
- if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0)
- VIR_WARN("unable to save status of domain %s after updating state of "
- "channel %s", vm->def->name, devAlias);
-
endjob:
qemuDomainObjEndJob(driver, vm);
--
2.4.10