[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openvswitch-discuss
Subject:    [ovs-discuss] [NIC-19 8/8] vswitchd: Support creating fake bond device interfaces.
From:       blp () nicira ! com (Ben Pfaff)
Date:       2009-07-30 22:27:49
Message-ID: 1248992869-27179-9-git-send-email-blp () nicira ! com
[Download RAW message or body]

Citrix QA scripts expect that "brctl show" shows a bond interface for each
bond that is added to a bridge.  The only way to do that without modifying
brctl itself is to create an actual network device by that name, so this
commit adds a new bonding configuration key that causes an internal
device by the name of the bond to be created.

This new configuration key is intentionally undocumented, because I don't
want anyone to use it.

Bug NIC-19.
---
 vswitchd/bridge.c                                  |   27 ++++++++++++++++---
 .../opt_xensource_libexec_interface-reconfigure    |    1 +
 2 files changed, 23 insertions(+), 5 deletions(-)

diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c
index 057172e..726c550 100644
--- a/vswitchd/bridge.c
+++ b/vswitchd/bridge.c
@@ -460,9 +460,23 @@ bridge_reconfigure(void)
         for (i = 0; i < add_ifaces.n; i++) {
             const char *if_name = add_ifaces.names[i];
             for (;;) {
-                int internal = cfg_get_bool(0, "iface.%s.internal", if_name);
-                int error = dpif_port_add(&br->dpif, if_name, next_port_no++,
-                                          internal ? ODP_PORT_INTERNAL : 0);
+                bool internal;
+                int error;
+
+                /* It's an internal interface if it's marked that way, or if
+                 * it's a bonded interface for which we're faking up a network
+                 * device. */
+                internal = cfg_get_bool(0, "iface.%s.internal", if_name);
+                if (cfg_get_bool(0, "bonding.%s.fake-iface", if_name)) {
+                    struct port *port = port_lookup(br, if_name);
+                    if (port && port->n_ifaces > 1) {
+                        internal = true;
+                    }
+                }
+
+                /* Add to datapath. */
+                error = dpif_port_add(&br->dpif, if_name, next_port_no++,
+                                      internal ? ODP_PORT_INTERNAL : 0);
                 if (error != EEXIST) {
                     if (next_port_no >= 256) {
                         VLOG_ERR("ran out of valid port numbers on dp%u",
@@ -1308,9 +1322,12 @@ bridge_get_all_ifaces(const struct bridge *br, struct svec \
*ifaces)  struct iface *iface = port->ifaces[j];
             svec_add(ifaces, iface->name);
         }
+        if (port->n_ifaces > 1
+            && cfg_get_bool(0, "bonding.%s.fake-iface", port->name)) {
+            svec_add(ifaces, port->name);
+        }
     }
-    svec_sort(ifaces);
-    assert(svec_is_unique(ifaces));
+    svec_sort_unique(ifaces);
 }
 
 /* For robustness, in case the administrator moves around datapath ports behind
diff --git a/xenserver/opt_xensource_libexec_interface-reconfigure \
b/xenserver/opt_xensource_libexec_interface-reconfigure index 1ff5359..fde745b 100755
--- a/xenserver/opt_xensource_libexec_interface-reconfigure
+++ b/xenserver/opt_xensource_libexec_interface-reconfigure
@@ -749,6 +749,7 @@ def configure_bond(pif):
     argv = ['--del-match=bonding.%s.[!0-9]*' % interface]
     argv += ["--add=bonding.%s.slave=%s" % (interface, slave)
              for slave in physdevs]
+    argv += ['--add=bonding.%s.fake-iface=true']
 
     if pifrec['MAC'] != "":
         argv += ['--add=port.%s.mac=%s' % (interface, pifrec['MAC'])]
-- 
1.6.3.3


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic