I don't understand the use-case behind this. Is this so that a local
physical smart card can be passed through to a guest from a Spice
client
and when migration happens, the QEMU instance connects back to the
Spice
client? So the device is never actually migrated?
The *smart card* is never migrated. The ccid device is. Here is the scenario:
Host A: qemu_a
qemu_a: guest
Host B: vscclient
- physical reader
Host C: qemu_b -incoming ..
yes, we will use this for SPICE, but this is submitted
to qemu on the hopes and with testing ensuring it is perfectly usable as is
without using SPICE, otherwise I wouldn't have sent it upstream.
non-SPICE usage:
1. user on B runs vscclient (and presumably the user has some connection to the
guest to use the smartcard device, i.e. vnc/ssh/spice, but that's not relevant).
2. vscclient connects via tcp to qemu_a.
3. qemu_a starts migrating to qemu_b.
(qemu_b is alive at this point, can receive incoming tcp connections on
chardev - otherwise a migration fails immediately anyway)
4. pre_load for usb-ccid sends a Reconnect message
5. vscclient gets the Reconnect message, closes socket to qemu_a, opens socket
to qemu_b
6. from guest pov nothing happened (no device detach/attach).
I have to stress that the main problem the migration intends to solve is to
avoid a detach/attach in the guest. Actual
operations on the smartcard could possibly fail as a result of the migration,
and it would not be a real problem (i.e.
we could live without, but we can't leave with a lock of the guest screen as a
result of a migration). Which is why I
consider the current code good enough. It is certainly not perfect (short
packet issue), or tested enough.
The SPICE usage scenario is basically the same, just replace vscclient with
spicec, and
we don't need the Reconnect message since SPICE takes care of this for us (we
just get
a channel detach/attach event if we care).
1. user on B runs spicec
2. spicec connects to qemu via spice channel, smart card channel connects to
usb-ccid device via spicevmc chardev (so it doesn't care it's spice or not).
3. qemu_a migrates
4. spicec disconnects from qemu_a and connects to qemu_b
5. from guest os pov nothing happens on the ccid usb device.
Regards,
Anthony Liguori