Skip to content

Commit

Permalink
ovn-controller: Remove old address set after change.
Browse files Browse the repository at this point in the history
Currently, when address set value changes, ovn controller
doesn't remove the old entry from the tracking hash, it
just adds the new one, leading to multiple entries for the
same symbol.

Fix this behavior and add a smoke test to avoid a regression
in the future.

Signed-off-by: Ryan Moats <[email protected]>
Acked-by: Flavio Fernandes <[email protected]>
Signed-off-by: Russell Bryant <[email protected]>
  • Loading branch information
jayhawk87 authored and russellb committed Jul 7, 2016
1 parent e5bac8f commit 7417d14
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
1 change: 1 addition & 0 deletions ovn/controller/lflow.c
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,7 @@ update_address_sets(struct controller_ctx *ctx)
* if the symtab entry needs to be updated due to a change. */
sset_find_and_delete(&cur_addr_set_names, addr_set_rec->name);
if (!address_sets_match(addr_set, addr_set_rec)) {
shash_find_and_delete(&local_address_sets, addr_set_rec->name);
expr_macros_remove(&expr_address_sets, addr_set_rec->name);
address_set_destroy(addr_set);
addr_set = NULL;
Expand Down
28 changes: 28 additions & 0 deletions tests/ovn.at
Original file line number Diff line number Diff line change
Expand Up @@ -3348,3 +3348,31 @@ done
OVN_CLEANUP([hv1])

AT_CLEANUP

AT_SETUP([ovn -- address sets modification/removal smoke test])
AT_KEYWORDS([ovn-addr])
ovn_start

net_add n1

sim_add hv1
as hv1
ovs-vsctl add-br br-phys
ovn_attach n1 br-phys 192.168.0.1

row=`ovn-nbctl create Address_Set name=set1 addresses=\"1.1.1.1\"`
ovn-nbctl set Address_Set $row name=set1 addresses=\"1.1.1.1,1.1.1.2\"
ovn-nbctl destroy Address_Set $row

sleep 1

# A bug previously existed in the address set support code
# that caused ovn-controller to crash after an address set
# was updated and then removed. This test case ensures
# that ovn-controller is at least still running after
# creating, updating, and deleting an address set.
AT_CHECK([ovs-appctl -t ovn-controller version], [0], [ignore])

OVN_CLEANUP([hv1])

AT_CLEANUP

0 comments on commit 7417d14

Please sign in to comment.