]> git.ipfire.org Git - thirdparty/libvirt.git/commit
qemu: simplify PCI configfd handling in monitor
authorEric Blake <eblake@redhat.com>
Tue, 15 Mar 2011 23:10:16 +0000 (17:10 -0600)
committerEric Blake <eblake@redhat.com>
Mon, 21 Mar 2011 16:47:48 +0000 (10:47 -0600)
commit098312391e4fba8a783877d223b502328cc67429
tree56ac04aa00eab9ff9f527b32083437b2a85ad34a
parent058d4efa5839003e7952aac45618b282c4129e35
qemu: simplify PCI configfd handling in monitor

This is also a bug fix - on the error path, qemu_hotplug would
leave the configfd file leaked into qemu.  At least the next
attempt to hotplug a PCI device would reuse the same fdname,
and when the qemu getfd monitor command gets a new fd by the
same name as an earlier one, it closes the earlier one, so there
is no risk of qemu running out of fds.

* src/qemu/qemu_monitor.h (qemuMonitorAddDeviceWithFd): New
prototype.
* src/qemu/qemu_monitor.c (qemuMonitorAddDevice): Move guts...
(qemuMonitorAddDeviceWithFd): ...to new function, and add support
for fd passing.
* src/qemu/qemu_hotplug.c (qemuDomainAttachHostPciDevice): Use it
to simplify code.
Suggested by Daniel P. Berrange.
src/qemu/qemu_hotplug.c
src/qemu/qemu_monitor.c
src/qemu/qemu_monitor.h