[ovs-dev] [PATCH] vswitchd: Make Interface's ofport a persistent column.

Gurucharan Shetty shettyg at nicira.com
Mon Nov 19 17:09:34 UTC 2012


Currently, the 'ofport' column in Interface table is
ephemeral and is populated by vswitchd everytime it is
started or when a new interface is created with vswitchd
running.

Making it persistent lets vswitchd try and assign the
same ofport number to a particular interface across
restarts. This is just a fallback option when
'ofport_request' column is empty.

Signed-off-by: Gurucharan Shetty <gshetty at nicira.com>
---
 vswitchd/bridge.c          |    7 +++++--
 vswitchd/vswitch.ovsschema |    7 +++----
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c
index 316ecc7..6185c4f 100644
--- a/vswitchd/bridge.c
+++ b/vswitchd/bridge.c
@@ -290,12 +290,14 @@ bridge_init_ofproto(const struct ovsrec_open_vswitch *cfg)
                 for (k = 0; k < port_cfg->n_interfaces; k++) {
                     struct ovsrec_interface *if_cfg = port_cfg->interfaces[k];
                     struct iface_hint *iface_hint;
+                    int64_t ofport = if_cfg->n_ofport ?
+                        *if_cfg->ofport : OFPP_NONE;
 
                     iface_hint = xmalloc(sizeof *iface_hint);
                     iface_hint->br_name = br_cfg->name;
                     iface_hint->br_type = br_cfg->datapath_type;
                     iface_hint->ofp_port = if_cfg->n_ofport_request ?
-                        *if_cfg->ofport_request : OFPP_NONE;
+                        *if_cfg->ofport_request : ofport;
 
                     shash_add(&iface_hints, if_cfg->name, iface_hint);
                 }
@@ -2529,10 +2531,11 @@ bridge_queue_if_cfg(struct bridge *br,
                     const struct ovsrec_port *parent)
 {
     struct if_cfg *if_cfg = xmalloc(sizeof *if_cfg);
+    int64_t ofport = cfg->n_ofport ? *cfg->ofport : OFPP_NONE;
 
     if_cfg->cfg = cfg;
     if_cfg->parent = parent;
-    if_cfg->ofport = cfg->n_ofport_request ? *cfg->ofport_request : OFPP_NONE;
+    if_cfg->ofport = cfg->n_ofport_request ? *cfg->ofport_request : ofport;
     hmap_insert(&br->if_cfg_todo, &if_cfg->hmap_node,
                 hash_string(if_cfg->cfg->name, 0));
 }
diff --git a/vswitchd/vswitch.ovsschema b/vswitchd/vswitch.ovsschema
index 1234488..35cc564 100644
--- a/vswitchd/vswitch.ovsschema
+++ b/vswitchd/vswitch.ovsschema
@@ -1,6 +1,6 @@
 {"name": "Open_vSwitch",
- "version": "6.11.0",
- "cksum": "3699219253 17163",
+ "version": "6.12.0",
+ "cksum": "1488803988 17135",
  "tables": {
    "Open_vSwitch": {
      "columns": {
@@ -176,8 +176,7 @@
        "external_ids": {
          "type": {"key": "string", "value": "string", "min": 0, "max": "unlimited"}},
        "ofport": {
-         "type": {"key": "integer", "min": 0, "max": 1},
-         "ephemeral": true},
+         "type": {"key": "integer", "min": 0, "max": 1}},
        "ofport_request": {
          "type": {
            "key": {"type": "integer",
-- 
1.7.9.5




More information about the dev mailing list