Hi All, 

I am exploring how to go about supporting multi-function hot-plug/unplug support from libvirt now that Qemu has enabled it.

The Qemu semantics is that, qemu queues the notification to guest until function 0 is hot-
plugged and on function 0 hot-plug, all the previously added devices in the slot are
notified to the guest.
For hot-unplug - On x86, unplug of any device in the slot would unplug all the functions of
the slot. On PPC, unplug all non-zero functions first, then unplug the function zero which
triggers the unplug of all the functions in the slot.

On Libvirt, I had a brief chat with Laine Stump on IRC and we "think" the below semantics
would be appropriate.
1) Change the virDomainAttachDeviceFlags() to recognize multiple devices in the XML
and the application should make one call to attach all the functions for the slot at one
time.
2) The libvirt qemu driver to translate this into multiple attach device commands to qemu
with the final operation being for function 0.
3) The XML now needs to accept multiple devices and there is a need for single parent 
element. I am thinking if we should have all devices to be enclosed in <device></device> 
parent element. Note that this is only when all the devices should go to the same slot. We
probably should disallow user attempting to hot-plug to different slots with this.
4) For the hot-unplug, the application to send all the devices the same way enclosed in 
<device></devices> and libvirt to go ahead with unplug only if all the devices are 
specified in the XML for the slot.

Want to know if you foresee any problem with using <device></device> semantics Or you
have any different approach/suggestions. Any comments greatly appreciated.

Thanks and Regards,
Shivaprasad