On 01/17/2012 01:31 PM, Osier Yang wrote: > It doesn't make sense to reattach a device to host while it's > still in use, e.g, by a domain. > --- > src/qemu/qemu_driver.c | 15 +++++++++++++++ > 1 files changed, 15 insertions(+), 0 deletions(-) > > diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c > index 47e2380..c920bfd 100644 > --- a/src/qemu/qemu_driver.c > +++ b/src/qemu/qemu_driver.c > @@ -9244,6 +9244,7 @@ qemudNodeDeviceReAttach (virNodeDevicePtr dev) > { > struct qemud_driver *driver = dev->conn->privateData; > pciDevice *pci; > + pciDevice *other; > unsigned domain, bus, slot, function; > int ret = -1; > > @@ -9254,6 +9255,20 @@ qemudNodeDeviceReAttach (virNodeDevicePtr dev) > if (!pci) > return -1; > > + other = pciDeviceListFind(driver->activePciHostdevs, pci); > + if (other) { > + const char *other_name = pciDeviceGetUsedBy(other); > + > + if (other_name) > + qemuReportError(VIR_ERR_OPERATION_INVALID, > + _("PCI device %s is still in use by domain %s"), > + pciDeviceGetName(pci), other_name); > + else > + qemuReportError(VIR_ERR_OPERATION_INVALID, > + _("PCI device %s is still in use"), > + pciDeviceGetName(pci)); > + } ACK and pushed. -- Eric Blake eblake@xxxxxxxxxx +1-919-301-3266 Libvirt virtualization library http://libvirt.org
Attachment:
signature.asc
Description: OpenPGP digital signature
-- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list