[virt-tools-list] [PATCH V2] virt-manager: enable direct interfaceselection

Decker, Schorschi schorschi.decker at bankofamerica.com
Fri Apr 8 13:16:40 UTC 2011


Defining a virtual machine or host?  We need a way to add a 'connection'
i.e. host to virt-manager with 100% CLI for automation.  Virsh -c
invokes the GUI.  There should be away to add a KVM host to virt-manager
that does not require any interactive effort.  If not, that is a feature
that is missing that should be added.

VMware vCenter has CLI support to add host via their API, so does
Hyper-V, etc.  The way to drive KVM adoption is via automation.  No?

Schorschi

-----Original Message-----
From: virt-tools-list-bounces at redhat.com
[mailto:virt-tools-list-bounces at redhat.com] On Behalf Of Gerhard Stenzel
Sent: Friday, 08 April, 2011 01:43
To: crobinso at redhat.com
Cc: virt-tools-list at redhat.com
Subject: [virt-tools-list] [PATCH V2] virt-manager: enable direct
interfaceselection

Resending the fixed version as I could not find it in git.

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
@@ -354,7 +354,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()
 
@@ -438,8 +438,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:
@@ -482,11 +489,10 @@ 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)
+    # 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
@@ -527,6 +533,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
@@ -548,7 +548,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

_______________________________________________
virt-tools-list mailing list
virt-tools-list at redhat.com
https://www.redhat.com/mailman/listinfo/virt-tools-list

----------------------------------------------------------------------
This message w/attachments (message) is intended solely for the use of the intended recipient(s) and may contain information that is privileged, confidential or proprietary. If you are not an intended recipient, please notify the sender, and then please delete and destroy all copies and attachments, and be advised that any review or dissemination of, or the taking of any action in reliance on, the information contained in or attached to this message is prohibited. 
Unless specifically indicated, this message is not an offer to sell or a solicitation of any investment products or other financial product or service, an official confirmation of any transaction, or an official statement of Sender. Subject to applicable law, Sender may intercept, monitor, review and retain e-communications (EC) traveling through its networks/systems and may produce any such EC to regulators, law enforcement, in litigation and as required by law. 
The laws of the country of each sender/recipient may impact the handling of EC, and EC may be archived, supervised and produced in countries other than the country in which you are located. This message cannot be guaranteed to be secure or free of errors or viruses. 

References to "Sender" are references to any subsidiary of Bank of America Corporation. Securities and Insurance Products: * Are Not FDIC Insured * Are Not Bank Guaranteed * May Lose Value * Are Not a Bank Deposit * Are Not a Condition to Any Banking Service or Activity * Are Not Insured by Any Federal Government Agency. Attachments that are part of this EC may have additional important disclosures and disclaimers, which you should read. This message is subject to terms available at the following link: 
http://www.bankofamerica.com/emaildisclaimer. By messaging with Sender you consent to the foregoing.




More information about the virt-tools-list mailing list