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

mpolednik at redhat.com mpolednik at redhat.com
Wed Sep 3 13:02:17 UTC 2014


Martin Polednik has uploaded a new change for review.

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

vdsm: add functionality to release host devices

Release call (libvirt's reAttach call) is mandatory to properly
reattach device back to host.

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


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/91/32391/1

diff --git a/vdsm/hostdev.py b/vdsm/hostdev.py
index 7ad5695..ef28d4e 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,11 @@
             del(devices[device_name])
 
     return devices
+
+
+def release(device_name):
+    device = libvirtconnection.get().nodeDeviceLookupByName(device_name)
+    device_params = _parse_device_params(device)
+
+    if device_params['capability'] in DETACHABLE_DEVICES:
+        device.reAttach()


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I77000c76ece87bf7335045429eab207a89badae9
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