[ovs-dev] [PATCH 1/4] ovs-vsctl: Create AutoAttach records on demand, for backward compatibility.

Ben Pfaff blp at nicira.com
Fri Mar 20 06:52:33 UTC 2015


The AutoAttach table is new in OVS 2.3.90, but ovs-vsctl was creating a
record in the table unconditionally whenever it created a new bridge.
This caused a gratuitous incompatibility with older databases, which can
be a problem during upgrade.  This commit switches to creating the
AutoAttaach record for a bridge lazily, only when the first mapping is
created for the bridge.

VMware-BZ: #1413562
CC: Dennis Flynn <drflynn at avaya.com>
Reported-by: Alex Wang <alexw at nicira.com>
Signed-off-by: Ben Pfaff <blp at nicira.com>
---
 utilities/ovs-vsctl.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/utilities/ovs-vsctl.c b/utilities/ovs-vsctl.c
index 1abefb4..fa73b00 100644
--- a/utilities/ovs-vsctl.c
+++ b/utilities/ovs-vsctl.c
@@ -1807,7 +1807,6 @@ cmd_add_br(struct vsctl_context *ctx)
 
     if (!parent_name) {
         struct ovsrec_port *port;
-        struct ovsrec_autoattach *aa;
         struct ovsrec_bridge *br;
 
         iface = ovsrec_interface_insert(ctx->txn);
@@ -1818,12 +1817,9 @@ cmd_add_br(struct vsctl_context *ctx)
         ovsrec_port_set_name(port, br_name);
         ovsrec_port_set_interfaces(port, &iface, 1);
 
-        aa = ovsrec_autoattach_insert(ctx->txn);
-
         br = ovsrec_bridge_insert(ctx->txn);
         ovsrec_bridge_set_name(br, br_name);
         ovsrec_bridge_set_ports(br, &port, 1);
-        ovsrec_bridge_set_auto_attach(br, aa);
 
         ovs_insert_bridge(ctx->ovs, br);
     } else {
@@ -2732,6 +2728,10 @@ cmd_add_aa_mapping(struct vsctl_context *ctx)
     }
 
     if (br && br->br_cfg) {
+        if (!br->br_cfg->auto_attach) {
+            struct ovsrec_autoattach *aa = ovsrec_autoattach_insert(ctx->txn);
+            ovsrec_bridge_set_auto_attach(br->br_cfg, aa);
+        }
         autoattach_insert_mapping(br->br_cfg->auto_attach, isid, vlan);
     }
 }
-- 
2.1.3




More information about the dev mailing list