Blame SOURCES/cobbler-xenpv-tap-driver.patch

1070a0
--- ./koan/xencreate.py	2010-07-28 17:48:48.000000000 +0200
1070a0
+++ ./koan/xencreate.py	2011-01-06 23:04:33.000000000 +0100
1070a0
@@ -36,11 +36,16 @@ import virtinst
1070a0
 import app as koan
1070a0
 
1070a0
 try:
1070a0
-    import virtinst.DistroManager as DistroManager
1070a0
-except:
1070a0
-    # older virtinst, this is probably ok
1070a0
-    # but we know we can't do Xen fullvirt installs
1070a0
-    pass
1070a0
+    from virtinst.DistroManager import PXEInstaller
1070a0
+    pxe_installer = PXEInstaller()
1070a0
+except ImportError:
1070a0
+    try:
1070a0
+        from virtinst import PXEInstaller
1070a0
+        pxe_installer = PXEInstaller(os_type='hvm')
1070a0
+    except:
1070a0
+        # older virtinst, this is probably ok
1070a0
+        # but we know we can't do Xen fullvirt installs
1070a0
+        pass
1070a0
 import traceback
1070a0
 
1070a0
 def random_mac():
1070a0
@@ -77,7 +82,7 @@ def start_install(name=None,
1070a0
 
1070a0
     if fullvirt:
1070a0
         # FIXME: add error handling here to explain when it's not supported
1070a0
-        guest = virtinst.FullVirtGuest(installer=DistroManager.PXEInstaller())
1070a0
+        guest = virtinst.FullVirtGuest(installer=pxe_installer)
1070a0
     else:
1070a0
         guest = virtinst.ParaVirtGuest()
1070a0
 
1070a0
@@ -123,7 +128,15 @@ def start_install(name=None,
1070a0
 
1070a0
     for d in disks:
1070a0
         if d[1] != 0 or d[0].startswith("/dev"):
1070a0
-            guest.disks.append(virtinst.XenDisk(d[0], size=d[1]))
1070a0
+            virtdisk = virtinst.XenDisk(d[0], size=d[1])
1070a0
+
1070a0
+            # Set driver_name to tap for Xen PV guests
1070a0
+            if guest.installer and guest.installer.os_type in ('xen', 'linux'):
1070a0
+                if virtdisk.type == virtinst.XenDisk.TYPE_FILE and \
1070a0
+                   virtinst._util.is_blktap_capable():
1070a0
+                    virtdisk.driver_name = virtinst.XenDisk.DRIVER_TAP
1070a0
+
1070a0
+            guest.disks.append(virtdisk)
1070a0
         else:
1070a0
             raise koan.InfoException("this virtualization type does not work without a disk image, set virt-size in Cobbler to non-zero")
1070a0