Hi On Fri, Mar 21, 2025 at 7:40 AM <yong.hu...@smartx.com> wrote: > > From: Hyman Huang <yong.hu...@smartx.com> > > Our goal is to migrate VMs that are configured with qemu-vdagent-typed > chardev while allowing the agent to continue working without having > to restart the service in guest. >
I sent a more complete series last week: "[PATCH for-10.1 00/10] Support vdagent migration" https://patchew.org/QEMU/20250311155932.1472092-1-marcandre.lur...@redhat.com/ > Let's justify which fields should be taken into account for struct > VDAgentChardev. > > struct VDAgentChardev { > Chardev parent; > > /* config */ > bool mouse; > bool clipboard; > > /* guest vdagent */ > uint32_t caps; > VDIChunkHeader chunk; > uint32_t chunksize; > uint8_t *msgbuf; > uint32_t msgsize; > uint8_t *xbuf; > uint32_t xoff, xsize; > Buffer outbuf; > > /* mouse */ > DeviceState mouse_dev; > uint32_t mouse_x; > uint32_t mouse_y; > uint32_t mouse_btn; > uint32_t mouse_display; > QemuInputHandlerState *mouse_hs; > > /* clipboard */ > QemuClipboardPeer cbpeer; > uint32_t last_serial[QEMU_CLIPBOARD_SELECTION__COUNT]; > uint32_t cbpending[QEMU_CLIPBOARD_SELECTION__COUNT]; > }; > > parent: > No dynamic information is generated. skip migrating. > > mouse, clipboard: > The mouse and clipboard should be set up identically on both sides. > Skip migrating. > > caps: > Store the negotiated caps between the client and the guest. > Should migrate. > > chunk, ... outbuf: > The spice agent protocol's message transportation between the client > and the guest is implemented using all of these fields, however the > message loss can be tolerated by guests because the issue may occur > in the real world as well. > Could skip migrating. It's part of the host/guest state, data will be lost and it's likely the communication will break if it's not migrated. > > mouse_dev, ... mouse_hs: > The mouse state can be reset after a live migration since the agent > working inside the guest does not heavily depend on them. > Could skip migrating same > cbpeer: > Since the cbpeer would lose the data it references to if the qemu > clipboard data was not migrated, this field can also be initialized > after live migration. > Could skip migrating > We should migrate the clipboard content too, to avoid having to request it again, or have a noticeable effect. > last_serial, cbpending: > It is necessary for the agent to function after live migration. > Should migrate. > > For the last_serial, saving & loading its value to make ensure the > client receives the most recent clipboard data from the guest after > live migration. > > For the cbpending, saving & loading its value aims to inform the > guest that the clipboard has been released and is now empty in > case that the guest acts strangely while supposing that the > requested data can be properly retrieved. > > To summarize, all we need to do is migrate the caps, last_serial > and cbpendings fields of the struct VDAgentChardev, > > Please review, thanks > > Yong > > Hyman Huang (3): > vdagent: Wrap vdagent_register_to_qemu_clipboard function > vdagent: Set up mouse and clipboard after live migration > vdagent: Drop blocker to support migration > > ui/trace-events | 1 + > ui/vdagent.c | 102 +++++++++++++++++++++++++++++++++++++++--------- > 2 files changed, 85 insertions(+), 18 deletions(-) > > -- > 2.27.0 >