[ovs-dev] [PATCH 1/2] vswitchd: Rename bond_mode configuration.

Ethan Jackson ethan at nicira.com
Mon Jan 10 21:54:22 UTC 2011


This commit renames bond_type to bond_mode to be more consistent
with XenServer configuration.  It also renames the "slb" bond_mode
to "balance-slb".
---
 vswitchd/bridge.c          |   58 ++++++++++++++++++++++----------------------
 vswitchd/vswitch.ovsschema |    8 +++---
 vswitchd/vswitch.xml       |    6 ++--
 3 files changed, 36 insertions(+), 36 deletions(-)

diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c
index 8b07b3e..abc846c 100644
--- a/vswitchd/bridge.c
+++ b/vswitchd/bridge.c
@@ -118,7 +118,7 @@ struct bond_entry {
     tag_type iface_tag;         /* Tag associated with iface_idx. */
 };
 
-enum bond_type {
+enum bond_mode {
     BT_SLB, /* Source Load Balance (Default). */
     BT_AB   /* Active Backup. */
 };
@@ -160,7 +160,7 @@ struct port {
     size_t n_ifaces, allocated_ifaces;
 
     /* Bonding info. */
-    enum bond_type bond_type;   /* Type of the bond. BT_SLB is the default. */
+    enum bond_mode bond_mode;   /* Type of the bond. BT_SLB is the default. */
     int active_iface;           /* Ifidx on which bcasts accepted, or -1. */
     tag_type active_iface_tag;  /* Tag for bcast flows. */
     tag_type no_ifaces_tag;     /* Tag for flows when all ifaces disabled. */
@@ -1972,7 +1972,7 @@ static struct bond_entry *
 lookup_bond_entry(const struct port *port, const uint8_t mac[ETH_ADDR_LEN],
                   uint16_t vlan)
 {
-    assert(port->bond_type == BT_SLB);
+    assert(port->bond_mode == BT_SLB);
     return &port->bond_hash[bond_hash(mac, vlan)];
 }
 
@@ -2015,13 +2015,13 @@ choose_output_iface(const struct port *port, const uint8_t *dl_src,
     assert(port->n_ifaces);
     if (port->n_ifaces == 1) {
         iface = port->ifaces[0];
-    } else if (port->bond_type == BT_AB) {
+    } else if (port->bond_mode == BT_AB) {
         if (port->active_iface < 0) {
             *tags |= port->no_ifaces_tag;
             return false;
         }
         iface = port->ifaces[port->active_iface];
-    } else if (port->bond_type == BT_SLB){
+    } else if (port->bond_mode == BT_SLB){
         struct bond_entry *e = lookup_bond_entry(port, dl_src, vlan);
         if (e->iface_idx < 0 || e->iface_idx >= port->n_ifaces
             || !port->ifaces[e->iface_idx]->enabled) {
@@ -2811,7 +2811,7 @@ bridge_account_flow_ofhook_cb(const struct flow *flow, tag_type tags,
         if (nl_attr_type(a) == ODPAT_OUTPUT) {
             struct port *out_port = port_from_dp_ifidx(br, nl_attr_get_u32(a));
             if (out_port && out_port->n_ifaces >= 2 &&
-                out_port->bond_type == BT_SLB) {
+                out_port->bond_mode == BT_SLB) {
                 uint16_t vlan = (flow->vlan_tci
                                  ? vlan_tci_to_vid(flow->vlan_tci)
                                  : OFP_VLAN_NONE);
@@ -2837,7 +2837,7 @@ bridge_account_checkpoint_ofhook_cb(void *br_)
     now = time_msec();
     for (i = 0; i < br->n_ports; i++) {
         struct port *port = br->ports[i];
-        if (port->n_ifaces > 1 && port->bond_type == BT_SLB
+        if (port->n_ifaces > 1 && port->bond_mode == BT_SLB
             && now >= port->bond_next_rebalance) {
             port->bond_next_rebalance = now + port->bond_rebalance_interval;
             bond_rebalance_port(port);
@@ -2866,8 +2866,8 @@ struct slave_balance {
 };
 
 static const char *
-bond_type_to_string(enum bond_type bt) {
-    static char *bt_slb = "slb";
+bond_mode_to_string(enum bond_mode bt) {
+    static char *bt_slb = "balance-slb";
     static char *bt_ab  = "active-backup";
 
     switch (bt) {
@@ -2987,7 +2987,7 @@ bond_shift_load(struct slave_balance *from, struct slave_balance *to,
     struct port *port = from->iface->port;
     uint64_t delta = hash->tx_bytes;
 
-    assert(port->bond_type == BT_SLB);
+    assert(port->bond_mode == BT_SLB);
 
     VLOG_INFO("bond %s: shift %"PRIu64"kB of load (with hash %td) "
               "from %s to %s (now carrying %"PRIu64"kB and "
@@ -3031,7 +3031,7 @@ bond_rebalance_port(struct port *port)
     struct bond_entry *e;
     size_t i;
 
-    assert(port->bond_type == BT_SLB);
+    assert(port->bond_mode == BT_SLB);
 
     /* Sets up 'bals' to describe each of the port's interfaces, sorted in
      * descending order of tx_bytes, so that bals[0] represents the most
@@ -3256,7 +3256,7 @@ bond_unixctl_list(struct unixctl_conn *conn,
                 size_t j;
 
                 ds_put_format(&ds, "%s\t%s\t%s\t", br->name, port->name,
-                              bond_type_to_string(port->bond_type));
+                              bond_mode_to_string(port->bond_mode));
                 for (j = 0; j < port->n_ifaces; j++) {
                     const struct iface *iface = port->ifaces[j];
                     if (j) {
@@ -3304,12 +3304,12 @@ bond_unixctl_show(struct unixctl_conn *conn,
         return;
     }
 
-    ds_put_format(&ds, "bond_type: %s\n",
-                  bond_type_to_string(port->bond_type));
+    ds_put_format(&ds, "bond_mode: %s\n",
+                  bond_mode_to_string(port->bond_mode));
     ds_put_format(&ds, "updelay: %d ms\n", port->updelay);
     ds_put_format(&ds, "downdelay: %d ms\n", port->downdelay);
 
-    if (port->bond_type == BT_SLB) {
+    if (port->bond_mode == BT_SLB) {
         ds_put_format(&ds, "next rebalance: %lld ms\n",
                       port->bond_next_rebalance - time_msec());
     }
@@ -3330,7 +3330,7 @@ bond_unixctl_show(struct unixctl_conn *conn,
                           iface->delay_expires - time_msec());
         }
 
-        if (port->bond_type != BT_SLB) {
+        if (port->bond_mode != BT_SLB) {
             continue;
         }
 
@@ -3393,7 +3393,7 @@ bond_unixctl_migrate(struct unixctl_conn *conn, const char *args_,
         return;
     }
 
-    if (port->bond_type != BT_SLB) {
+    if (port->bond_mode != BT_SLB) {
         unixctl_command_reply(conn, 501, "not an SLB bond");
         return;
     }
@@ -3664,16 +3664,16 @@ port_reconfigure(struct port *port, const struct ovsrec_port *cfg)
         port->bond_next_rebalance = next_rebalance;
     }
 
-    if (!port->cfg->bond_type ||
-        !strcmp(port->cfg->bond_type, bond_type_to_string(BT_SLB))) {
-        port->bond_type = BT_SLB;
-    } else if (!strcmp(port->cfg->bond_type, bond_type_to_string(BT_AB))) {
-        port->bond_type = BT_AB;
+    if (!port->cfg->bond_mode ||
+        !strcmp(port->cfg->bond_mode, bond_mode_to_string(BT_SLB))) {
+        port->bond_mode = BT_SLB;
+    } else if (!strcmp(port->cfg->bond_mode, bond_mode_to_string(BT_AB))) {
+        port->bond_mode = BT_AB;
     } else {
-        port->bond_type = BT_SLB;
-        VLOG_WARN("port %s: unknown bond_type %s, defaulting to %s",
-                  port->name, port->cfg->bond_type,
-                  bond_type_to_string(port->bond_type));
+        port->bond_mode = BT_SLB;
+        VLOG_WARN("port %s: unknown bond_mode %s, defaulting to %s",
+                  port->name, port->cfg->bond_mode,
+                  bond_mode_to_string(port->bond_mode));
     }
 
     /* Add new interfaces and update 'cfg' member of existing ones. */
@@ -3848,7 +3848,7 @@ port_update_bonding(struct port *port)
     } else {
         size_t i;
 
-        if (port->bond_type == BT_SLB && !port->bond_hash) {
+        if (port->bond_mode == BT_SLB && !port->bond_hash) {
             port->bond_hash = xcalloc(BOND_MASK + 1, sizeof *port->bond_hash);
             for (i = 0; i <= BOND_MASK; i++) {
                 struct bond_entry *e = &port->bond_hash[i];
@@ -3863,7 +3863,7 @@ port_update_bonding(struct port *port)
             if (port->cfg->bond_fake_iface) {
                 port->bond_next_fake_iface_update = time_msec();
             }
-        } else if (port->bond_type != BT_SLB) {
+        } else if (port->bond_mode != BT_SLB) {
             free(port->bond_hash);
             port->bond_hash = NULL;
         }
@@ -3884,7 +3884,7 @@ port_update_bond_compat(struct port *port)
     struct compat_bond bond;
     size_t i;
 
-    if (port->n_ifaces < 2 || port->bond_type != BT_SLB) {
+    if (port->n_ifaces < 2 || port->bond_mode != BT_SLB) {
         proc_net_compat_update_bond(port->name, NULL);
         return;
     }
diff --git a/vswitchd/vswitch.ovsschema b/vswitchd/vswitch.ovsschema
index a8140b8..a3fd28f 100644
--- a/vswitchd/vswitch.ovsschema
+++ b/vswitchd/vswitch.ovsschema
@@ -1,6 +1,6 @@
 {"name": "Open_vSwitch",
- "version": "1.0.2",
- "cksum": "3196651018 14282",
+ "version": "1.0.3",
+ "cksum": "4212774128 14290",
  "tables": {
    "Open_vSwitch": {
      "columns": {
@@ -120,9 +120,9 @@
        "mac": {
          "type": {"key": {"type": "string"},
                   "min": 0, "max": 1}},
-       "bond_type": {
+       "bond_mode": {
          "type": {"key": {"type": "string",
-           "enum": ["set", ["slb", "active-backup"]]},
+           "enum": ["set", ["balance-slb", "active-backup"]]},
          "min": 0, "max": 1}},
        "bond_updelay": {
          "type": "integer"},
diff --git a/vswitchd/vswitch.xml b/vswitchd/vswitch.xml
index 7a70909..e500a59 100644
--- a/vswitchd/vswitch.xml
+++ b/vswitchd/vswitch.xml
@@ -520,10 +520,10 @@
       <p>These columns apply only to bonded ports.  Their values are
         otherwise ignored.</p>
 
-      <column name="bond_type">
+      <column name="bond_mode">
         <p>The type of bonding used for a bonded port.  Currently supported
-          values are <code>slb</code> and <code>active-backup</code>.  Defaults
-          to SLB if unset.</p>
+          values are <code>balance-slb</code> and <code>active-backup</code>.
+          Defaults to SLB if unset.</p>
       </column>
 
       <column name="bond_updelay">
-- 
1.7.2





More information about the dev mailing list