[virt-tools-list] [PATCH] virt-manager: enable direct interface selection
Gerhard Stenzel
gstenzel at linux.vnet.ibm.com
Wed Apr 6 14:07:12 UTC 2011
The following patch adds support to select direct interfaces
when defining a virtual machine via virt-manager. Also remove
the unused show_manual_bridge.
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
@@ -356,7 +356,7 @@ def get_network_selection(net_list, brid
return net_type, net_src
-def populate_network_list(net_list, conn, show_manual_bridge=True):
+def populate_network_list(net_list, conn, show_direct_interfaces=True):
model = net_list.get_model()
model.clear()
@@ -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 (show_direct_interfaces and virtinst.support.check_conn_support(conn.vmm,
+ virtinst.support.SUPPORT_CONN_HV_DIRECT_INTERFACE)):
+ sensitive = True
+ nettype = VirtualNetworkInterface.TYPE_DIRECT
+ bridge_name = name
+ brlabel = ": %s" % _("macvtap")
+ else:
+ sensitive = False
+ brlabel = "(%s)" % _("Not bridged")
label = _("Host device %s %s") % (br.get_name(), brlabel)
if hasShared and not brIdxLabel:
@@ -484,12 +491,6 @@ def populate_network_list(net_list, conn
model.insert(0, row)
default = 0
- if show_manual_bridge:
- # After all is said and done, add a manual bridge option
- manual_row = build_row(None, None, _("Specify shared device name"),
- True, False, manual_bridge=True)
- model.append(manual_row)
-
set_active(default)
return return_warn
@@ -530,6 +531,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
Index: virt-manager/src/virtManager/create.py
===================================================================
--- virt-manager.orig/src/virtManager/create.py
+++ virt-manager/src/virtManager/create.py
@@ -549,7 +549,7 @@ class vmmCreate(vmmGObjectUI):
# Networking
net_list = self.window.get_widget("config-netdev")
- do_warn = uihelpers.populate_network_list(net_list, self.conn)
+ do_warn = uihelpers.populate_network_list(net_list, self.conn, False)
self.set_net_warn(self.conn.netdev_error or do_warn,
self.conn.netdev_error, True)
===================================================================
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