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

[Xen-changelog] Back out changes to netif backend messaging to set vifname.



ChangeSet 1.1159.256.64, 2005/03/24 21:24:38+00:00, mjw@xxxxxxxxxxxxxxxxxxx

        Back out changes to netif backend messaging to set vifname.
        Try using 'ip link' instead.
        
        Signed-off-by: Mike Wray <mike.wray@xxxxxx>



 linux-2.6.11-xen-sparse/drivers/xen/netback/interface.c |    6 +-----
 tools/python/xen/lowlevel/xu/xu.c                       |    2 --
 tools/python/xen/xend/Vifctl.py                         |   13 +++++++++++++
 tools/python/xen/xend/server/netif.py                   |    9 +++++++--
 xen/include/public/io/domain_controller.h               |    5 ++---
 5 files changed, 23 insertions(+), 12 deletions(-)


diff -Nru a/linux-2.6.11-xen-sparse/drivers/xen/netback/interface.c 
b/linux-2.6.11-xen-sparse/drivers/xen/netback/interface.c
--- a/linux-2.6.11-xen-sparse/drivers/xen/netback/interface.c   2005-03-25 
07:04:52 -05:00
+++ b/linux-2.6.11-xen-sparse/drivers/xen/netback/interface.c   2005-03-25 
07:04:52 -05:00
@@ -121,11 +121,7 @@
     netif_t          **pnetif, *netif;
     char               name[IFNAMSIZ] = {};
 
-    if(create->vifname[0] == '\0'){
-        snprintf(name, IFNAMSIZ - 1, "vif%u.%u", domid, handle);
-    } else {
-        snprintf(name, IFNAMSIZ - 1, "%s", create->vifname);
-    }
+    snprintf(name, IFNAMSIZ - 1, "vif%u.%u", domid, handle);
     dev = alloc_netdev(sizeof(netif_t), name, ether_setup);
     if ( dev == NULL )
     {
diff -Nru a/tools/python/xen/lowlevel/xu/xu.c 
b/tools/python/xen/lowlevel/xu/xu.c
--- a/tools/python/xen/lowlevel/xu/xu.c 2005-03-25 07:04:52 -05:00
+++ b/tools/python/xen/lowlevel/xu/xu.c 2005-03-25 07:04:52 -05:00
@@ -480,7 +480,6 @@
         C2P(netif_be_create_t, domid,        Int, Long);
         C2P(netif_be_create_t, netif_handle, Int, Long);
         C2P(netif_be_create_t, status,       Int, Long);
-        C2P(netif_be_create_t, vifname,      String, String);
         return dict;
     case TYPE(CMSG_NETIF_BE, CMSG_NETIF_BE_DESTROY):
         C2P(netif_be_destroy_t, domid,        Int, Long);
@@ -648,7 +647,6 @@
         P2C(netif_be_create_t, mac[3],       u8);
         P2C(netif_be_create_t, mac[4],       u8);
         P2C(netif_be_create_t, mac[5],       u8);
-        P2CSTRING(netif_be_create_t, vifname);
         break;
     case TYPE(CMSG_NETIF_BE, CMSG_NETIF_BE_DESTROY):
         P2C(netif_be_destroy_t, domid,        u32);
diff -Nru a/tools/python/xen/xend/Vifctl.py b/tools/python/xen/xend/Vifctl.py
--- a/tools/python/xen/xend/Vifctl.py   2005-03-25 07:04:52 -05:00
+++ b/tools/python/xen/xend/Vifctl.py   2005-03-25 07:04:52 -05:00
@@ -37,6 +37,19 @@
     args = ' '.join(args)
     os.system(script + ' ' + args)
 
+def set_vif_name(vif_old, vif_new):
+    if vif_old == vif_new:
+        vif = view_new
+    if os.system("ip link show %s" % vif_old) == 0:
+        os.system("ip link set %s down" % vif_old)
+        os.system("ip link set %s name %s" % (vif_old, vif_new))
+        os.system("ip link set %s up" % vif_new)
+    if os.system("ip link show %s" % vif_new) == 0:
+        vif = vif_new
+    else:
+        vif = vif_old
+    return vif
+
 def vifctl(op, vif=None, script=None, domain=None, mac=None, bridge=None, 
ipaddr=[]):
     """Call a vif control script.
     Xend calls this when bringing vifs up or down.
diff -Nru a/tools/python/xen/xend/server/netif.py 
b/tools/python/xen/xend/server/netif.py
--- a/tools/python/xen/xend/server/netif.py     2005-03-25 07:04:52 -05:00
+++ b/tools/python/xen/xend/server/netif.py     2005-03-25 07:04:52 -05:00
@@ -134,7 +134,7 @@
 
         self.vifname = sxp.child_value(config, 'vifname')
         if self.vifname is None:
-            self.vifname = "vif%d.%d" % (self.controller.dom, self.vif)
+            self.vifname = self.default_vifname()
         if len(self.vifname) > 15:
             raise XendError('invalid vifname: too long: ' + self.vifname)
         mac = self._get_config_mac(config)
@@ -217,6 +217,9 @@
         """
         return self.vifname
 
+    def default_vifname(self):
+        return "vif%d.%d" % (self.controller.dom, self.vif)
+    
     def get_mac(self):
         """Get the MAC address as a string.
         """
@@ -248,6 +251,8 @@
         @param op: operation name (up, down)
         @param vmname: vmname
         """
+        if op == 'up':
+            Vifctl.set_vif_name(self.default_vifname(), self.vifname)
         Vifctl.vifctl(op, **self.vifctl_params(vmname=vmname))
         vnet = XendVnet.instance().vnet_of_bridge(self.bridge)
         if vnet:
@@ -276,7 +281,7 @@
                       { 'domid'        : self.controller.dom,
                         'netif_handle' : self.vif,
                         'mac'          : self.mac,
-                        'vifname'      : self.vifname
+                        #'vifname'      : self.vifname
                         })
         self.getBackendInterface().writeRequest(msg, response=d)
         return d
diff -Nru a/xen/include/public/io/domain_controller.h 
b/xen/include/public/io/domain_controller.h
--- a/xen/include/public/io/domain_controller.h 2005-03-25 07:04:52 -05:00
+++ b/xen/include/public/io/domain_controller.h 2005-03-25 07:04:52 -05:00
@@ -466,10 +466,9 @@
     u32        netif_handle;  /*  4: Domain-specific interface handle.   */
     u8         mac[6];        /*  8 */
     u16        __pad1;        /* 14 */
-    char       vifname[16];   /* 16 */
     /* OUT */
-    u32        status;        /* 32 */
-} PACKED netif_be_create_t; /* 36 bytes */
+    u32        status;        /* 16 */
+} PACKED netif_be_create_t; /* 20 bytes */
 
 /*
  * CMSG_NETIF_BE_DESTROY:


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/xen-changelog


 


Rackspace

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