Blame virtinst-0.400.3-hostdev-libvirt-calls.patch

fb96538
# HG changeset patch
fb96538
# User Cole Robinson <crobinso@redhat.com>
fb96538
# Date 1237302675 14400
fb96538
# Node ID 1288ff456cdb1a387771624594300ab6be324181
fb96538
# Parent  143cad71a2a6e83bfff7f46a0f7105e3eeb43ab2
fb96538
Fix node device dettach/reset libvirt calls
fb96538
fb96538
diff -r 143cad71a2a6 -r 1288ff456cdb virtinst/NodeDeviceParser.py
fb96538
--- a/virtinst/NodeDeviceParser.py	Mon Mar 09 23:31:51 2009 -0400
fb96538
+++ b/virtinst/NodeDeviceParser.py	Tue Mar 17 11:11:15 2009 -0400
fb96538
@@ -405,10 +405,11 @@
fb96538
     if not isinstance(conn, libvirt.virConnect):
fb96538
         raise ValueError(_("'conn' must be a virConnect instance."))
fb96538
 
fb96538
-    if dir(libvirt).count("virNodeDeviceDettach") == 0:
fb96538
-        return False
fb96538
+    if (hasattr(libvirt, "virNodeDevice") and
fb96538
+        hasattr(libvirt.virNodeDevice, "dettach")):
fb96538
+        return True
fb96538
 
fb96538
-    return True
fb96538
+    return False
fb96538
 
fb96538
 def lookupNodeName(conn, name):
fb96538
     """
fb96538
diff -r 143cad71a2a6 -r 1288ff456cdb virtinst/VirtualHostDevice.py
fb96538
--- a/virtinst/VirtualHostDevice.py	Mon Mar 09 23:31:51 2009 -0400
fb96538
+++ b/virtinst/VirtualHostDevice.py	Tue Mar 17 11:11:15 2009 -0400
fb96538
@@ -201,8 +201,8 @@
fb96538
         try:
fb96538
             # Do this as a sanity check, so that we don't fail at domain
fb96538
             # start time
fb96538
-            self._nodedev.deviceDetach()
fb96538
-            self._nodedev.deviceReset()
fb96538
+            self._nodedev.dettach()
fb96538
+            self._nodedev.reset()
fb96538
         except Exception, e:
fb96538
             raise RuntimeError(_("Could not detach PCI device: %s" % str(e)))
fb96538