From fb0ef7a60eda3ee906dc0e3bc6ed5e54da7e0c74 Mon Sep 17 00:00:00 2001 From: Shivaprasad G Bhat Date: Wed, 1 Apr 2015 16:28:05 +0530 Subject: [PATCH] hostdev: Report the domain name for used hostdevs during nodedev-detach MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The nodedev-detach can report the name of the domain using the device just the way nodedev-reattach does it. Signed-off-by: Shivaprasad G Bhat Signed-off-by: Ján Tomko --- src/util/virhostdev.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/util/virhostdev.c b/src/util/virhostdev.c index 83f567d307..68e060b985 100644 --- a/src/util/virhostdev.c +++ b/src/util/virhostdev.c @@ -1521,11 +1521,18 @@ int virHostdevPCINodeDeviceDetach(virHostdevManagerPtr hostdev_mgr, virPCIDevicePtr pci) { + virPCIDeviceAddressPtr devAddr = NULL; int ret = -1; virObjectLock(hostdev_mgr->activePCIHostdevs); virObjectLock(hostdev_mgr->inactivePCIHostdevs); + if (!(devAddr = virPCIDeviceGetAddress(pci))) + goto out; + + if (virHostdevIsPCINodeDeviceUsed(devAddr, hostdev_mgr)) + goto out; + if (virPCIDeviceDetach(pci, hostdev_mgr->activePCIHostdevs, hostdev_mgr->inactivePCIHostdevs) < 0) { goto out; @@ -1535,6 +1542,7 @@ virHostdevPCINodeDeviceDetach(virHostdevManagerPtr hostdev_mgr, out: virObjectUnlock(hostdev_mgr->inactivePCIHostdevs); virObjectUnlock(hostdev_mgr->activePCIHostdevs); + VIR_FREE(devAddr); return ret; } -- GitLab