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

Gerhard Stenzel gstenzel at linux.vnet.ibm.com
Tue Apr 5 13:14:25 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: virt-manager/src/virtManager/uihelpers.py
===================================================================
--- virt-manager.orig/src/virtManager/uihelpers.py
+++ virt-manager/src/virtManager/uihelpers.py
@@ -440,8 +440,15 @@ def populate_network_list(net_list, conn
                 bridge_name = name
                 brlabel = _("(Empty bridge)")
         else:
-            sensitive = False
-            brlabel = "(%s)" % _("Not bridged")
+            if (virtinst.support.check_conn_support(conn.vmm,
+                         virtinst.support.SUPPORT_CONN_HV_DIRECT_INTERFACE)):
+                sensitive = False
+                brlabel = "(%s)" % _("Not bridged")
+            else:
+                sensitive = True
+                nettype = VirtualNetworkInterface.TYPE_DIRECT
+                bridge_name = name
+                brlabel = ": %s" % _("direct")
 
         label = _("Host device %s %s") % (br.get_name(), brlabel)
         if hasShared and not brIdxLabel:
@@ -530,6 +537,8 @@ def validate_network(parent, conn, netty
             netname = devname
         elif nettype == VirtualNetworkInterface.TYPE_BRIDGE:
             bridge = devname
+        elif nettype == VirtualNetworkInterface.TYPE_DIRECT:
+            bridge = devname
         elif nettype == VirtualNetworkInterface.TYPE_USER:
             pass
 
===================================================================

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