[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH] Allow arbitrary values for the vif 'type'.


  • To: xen-devel@xxxxxxxxxxxxxxxxxxx
  • From: David Edmondson <dme@xxxxxxx>
  • Date: Tue, 21 Nov 2006 11:28:07 +0000
  • Cancel-lock: sha1:hEgXTQkuVjywWU0PBmc4hLExOHI=
  • Delivery-date: Tue, 21 Nov 2006 04:05:50 -0800
  • List-id: Xen developer discussion <xen-devel.lists.xensource.com>

To allow our backend network driver to support multiple methods of
connecting to a physical network it is useful to be able to use
different values for the 'type' of the vif in a configuration file.

Currently only 'ioemu' is ever specified, and it is treated specially
by the vif DevController.  The attached patch allows arbitrary types,
to be interpreted by the backend driver (or hotplug script, I suppose,
though that could also be achieved by specifying a different script).
The 'ioemu' behaviour is maintained.

At the moment the only type I'm using (in addition to 'netfront' and
'ioemu') is 'SUNW_mac'.

Would it be useful to contribute a patch to the Linux 'netback' driver
to have it complain if it sees an unexpected 'type'?

# HG changeset patch
# User David Edmondson <dme@xxxxxxx>
# Date 1164106407 28800
# Node ID 9f84cf198a6c7ce598624972943be28a77b11d2b
# Parent  445e228b7cb5c0ac2f1d91c4958a9e63cc5f6276
Allow arbitrary values for the vif 'type'.

Signed-off-by: David Edmondson <dme@xxxxxxx>

diff --git a/tools/python/xen/xend/server/netif.py 
b/tools/python/xen/xend/server/netif.py
--- a/tools/python/xen/xend/server/netif.py
+++ b/tools/python/xen/xend/server/netif.py
@@ -158,16 +158,20 @@ class NetifController(DevController):
 
         devid = self.allocateDeviceID()
 
+        # The default type is 'netfront'.
+        if not typ:
+            typ = 'netfront'
+            
         if not mac:
             mac = randomMAC()
 
         back = { 'script' : script,
                  'mac'    : mac,
-                 'handle' : "%i" % devid }
+                 'handle' : "%i" % devid,
+                 'type'   : typ }
 
         if typ == 'ioemu':
             front = {}
-            back['type'] = 'ioemu'
         else:
             front = { 'handle' : "%i" % devid,
                       'mac'    : mac }
diff --git a/tools/python/xen/xm/create.py b/tools/python/xen/xm/create.py
--- a/tools/python/xen/xm/create.py
+++ b/tools/python/xen/xm/create.py
@@ -285,7 +285,7 @@ gopts.var('vif', val="type=TYPE,mac=MAC,
           fn=append_value, default=[],
           use="""Add a network interface with the given MAC address and bridge.
           The vif is configured by calling the given configuration script.
-          If type is not specified, default is netfront not ioemu device.
+          If type is not specified, default is netfront.
           If mac is not specified a random MAC address is used.
           If not specified then the network backend chooses it's own MAC 
address.
           If bridge is not specified the first bridge found is used.
dme.
-- 
David Edmondson, Sun Microsystems, http://www.dme.org
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.