Change in vdsm[master]: vdsm: add functionality to acquire host devices

mpolednik at redhat.com mpolednik at redhat.com
Wed Sep 3 12:59:31 UTC 2014


Martin Polednik has uploaded a new change for review.

Change subject: vdsm: add functionality to acquire host devices
......................................................................

vdsm: add functionality to acquire host devices

Acquire call (libvirt's dettach call) is mandatory to properly
detach device from host.

Change-Id: I530fed56831314286942b8afa62900208812bfb5
Signed-off-by: Martin Polednik <mpolednik at redhat.com>
---
M vdsm/hostdev.py
1 file changed, 13 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/89/32389/1

diff --git a/vdsm/hostdev.py b/vdsm/hostdev.py
index 7ad5695..896fe95 100644
--- a/vdsm/hostdev.py
+++ b/vdsm/hostdev.py
@@ -24,6 +24,9 @@
 from vdsm import libvirtconnection
 
 
+DETACHABLE_DEVICES = ('usb', 'pci')
+
+
 def _parse_device_params(device_xml):
     params = {}
 
@@ -116,3 +119,13 @@
             del(devices[device_name])
 
     return devices
+
+
+def acquire(device_name):
+    device = libvirtconnection.get().nodeDeviceLookupByName(device_name)
+    device_params = _parse_device_params(device)
+
+    if device_params['capability'] in DETACHABLE_DEVICES:
+        device.dettach()
+
+    return device_params


-- 
To view, visit http://gerrit.ovirt.org/32389
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I530fed56831314286942b8afa62900208812bfb5
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Martin Polednik <mpolednik at redhat.com>


More information about the vdsm-patches mailing list