mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-22 19:32:19 +00:00
qemu: Set virtio channel state sooner
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@redhat.com>
This commit is contained in:
parent
6dc0e4f171
commit
2f50445537
@ -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);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user