[libvirt] [PATCH] hostdev: Report the domain name for used hostdevs during nodedev-detach

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 <sbhat@linux.vnet.ibm.com> --- src/util/virhostdev.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/util/virhostdev.c b/src/util/virhostdev.c index 23365a3..55eb9c9 100644 --- a/src/util/virhostdev.c +++ b/src/util/virhostdev.c @@ -1519,11 +1519,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;

On Wed, Apr 01, 2015 at 04:28:05PM +0530, Shivaprasad G Bhat wrote:
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 <sbhat@linux.vnet.ibm.com> --- src/util/virhostdev.c | 7 +++++++ 1 file changed, 7 insertions(+)
ACK
diff --git a/src/util/virhostdev.c b/src/util/virhostdev.c index 23365a3..55eb9c9 100644 --- a/src/util/virhostdev.c +++ b/src/util/virhostdev.c @@ -1519,11 +1519,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;
devAddr needs to be freed I have added VIR_FREE to the out: section and pushed the patch. Jan

Thanks Jan. Regards, Shiva On Tue, Apr 7, 2015 at 5:42 PM, Ján Tomko <jtomko@redhat.com> wrote:
On Wed, Apr 01, 2015 at 04:28:05PM +0530, Shivaprasad G Bhat wrote:
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 <sbhat@linux.vnet.ibm.com> --- src/util/virhostdev.c | 7 +++++++ 1 file changed, 7 insertions(+)
ACK
diff --git a/src/util/virhostdev.c b/src/util/virhostdev.c index 23365a3..55eb9c9 100644 --- a/src/util/virhostdev.c +++ b/src/util/virhostdev.c @@ -1519,11 +1519,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;
devAddr needs to be freed
I have added VIR_FREE to the out: section and pushed the patch.
Jan
participants (3)
-
Ján Tomko
-
Shivaprasad bhat
-
Shivaprasad G Bhat