From: Ben Pfaff Date: Fri, 20 Mar 2015 06:22:05 +0000 (-0700) Subject: ovs-vsctl: Create AutoAttach records on demand, for backward compatibility. X-Git-Tag: v2.4.0~451 X-Git-Url: http://git.cascardo.eti.br/?a=commitdiff_plain;ds=sidebyside;h=c557ca04169bbe0af253bd910a5328ac3eee98e7;p=cascardo%2Fovs.git ovs-vsctl: Create AutoAttach records on demand, for backward compatibility. 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 Reported-by: Alex Wang Signed-off-by: Ben Pfaff Acked-by: Justin Pettit --- diff --git a/utilities/ovs-vsctl.c b/utilities/ovs-vsctl.c index 1abefb440..fa73b008e 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); } }