aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2025-03-11 18:00:14 +0400
committerMarc-André Lureau <marcandre.lureau@redhat.com>2025-05-24 16:33:18 +0200
commit688ff4cbdf4993c60ee250afc48e15c0880f28de (patch)
treebb9b4f0db1f883bd3d7d3b9ac19f1ebd8016358f
parentac5e2bc910d350cd0653b8d049518d642ee14a49 (diff)
downloadqemu-688ff4cbdf4993c60ee250afc48e15c0880f28de.zip
qemu-688ff4cbdf4993c60ee250afc48e15c0880f28de.tar.gz
qemu-688ff4cbdf4993c60ee250afc48e15c0880f28de.tar.bz2
ui/vdagent: keep "connected" state
During post-load of migration, virtio will notify of fe_open state. However vdagent code will handle this as a reconnection. This will trigger a connection reset/caps with the agent. Check if the state actually changed before resetting the connection. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
-rw-r--r--ui/vdagent.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/ui/vdagent.c b/ui/vdagent.c
index 4027126..210b8c1 100644
--- a/ui/vdagent.c
+++ b/ui/vdagent.c
@@ -40,6 +40,7 @@ struct VDAgentChardev {
bool clipboard;
/* guest vdagent */
+ bool connected;
uint32_t caps;
VDIChunkHeader chunk;
uint32_t chunksize;
@@ -858,6 +859,7 @@ static void vdagent_disconnect(VDAgentChardev *vd)
{
trace_vdagent_disconnect();
+ vd->connected = false;
g_byte_array_set_size(vd->outbuf, 0);
vdagent_reset_bufs(vd);
vd->caps = 0;
@@ -876,6 +878,10 @@ static void vdagent_chr_set_fe_open(struct Chardev *chr, int fe_open)
trace_vdagent_fe_open(fe_open);
+ if (vd->connected == fe_open) {
+ return;
+ }
+
if (!fe_open) {
trace_vdagent_close();
vdagent_disconnect(vd);
@@ -885,6 +891,7 @@ static void vdagent_chr_set_fe_open(struct Chardev *chr, int fe_open)
return;
}
+ vd->connected = true;
vdagent_send_caps(vd, true);
}