[virt-tools-list] [PATCH] virtinst: enable direct interface selection

Gerhard Stenzel gstenzel at linux.vnet.ibm.com
Tue Apr 5 13:12:55 UTC 2011


The following patch adds support to select direct interfaces
when defining a virtual machine via virt-manager

Signed-off-by: Gerhard Stenzel <gerhard.stenzel at de.ibm.com>

Index: python-virtinst/virtinst/VirtualNetworkInterface.py
===================================================================
--- python-virtinst.orig/virtinst/VirtualNetworkInterface.py
+++ python-virtinst/virtinst/VirtualNetworkInterface.py
@@ -148,6 +148,7 @@ class VirtualNetworkInterface(VirtualDev
         self.type = type
         self.macaddr = macaddr
         self.bridge = bridge
+        self.source_dev = bridge
         self.network = network
         self.model = model
 
@@ -352,6 +353,8 @@ class VirtualNetworkInterface(VirtualDev
             src_xml     = "      <source network='%s'/>\n" % self.network
         elif self.type == self.TYPE_ETHERNET and self.source_dev:
             src_xml     = "      <source dev='%s'/>\n" % self.source_dev
+        elif self.type == self.TYPE_DIRECT and self.source_dev:
+            src_xml     = "      <source dev='%s' mode='vepa'/>\n" % self.source_dev
 
         if self.model:
             model_xml   = "      <model type='%s'/>\n" % self.model
Index: python-virtinst/virtinst/support.py
===================================================================
--- python-virtinst.orig/virtinst/support.py
+++ python-virtinst/virtinst/support.py
@@ -60,6 +60,7 @@ SUPPORT_CONN_HV_SOUND_AC97 = 5002
 SUPPORT_CONN_HV_SOUND_ICH6 = 5003
 SUPPORT_CONN_HV_GRAPHICS_SPICE = 5004
 SUPPORT_CONN_HV_CHAR_SPICEVMC = 5005
+SUPPORT_CONN_HV_DIRECT_INTERFACE = 5006
 
 """
 Possible keys:
@@ -227,6 +228,11 @@ _support_dict = {
         "force_version" : True,
         "drv_version" : [ ("qemu", 14000), ],
     },
+    SUPPORT_CONN_HV_DIRECT_INTERFACE : {
+        "version" : 8008,
+        "force_version" : True,
+        "drv_version" : [ ("qemu", 0), ],
+    },
 }
 
 # XXX: RHEL6 has lots of feature backports, and since libvirt doesn't
===================================================================

Best regards, 

Gerhard Stenzel
-------------------------------------------------------------------------------------
IBM Deutschland Research & Development GmbH
Vorsitzender des Aufsichtsrats: Martin Jetter
Geschaeftsfuehrung: Dirk Wittkopp
Sitz der Gesellschaft: Boeblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294




More information about the virt-tools-list mailing list