summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDumitru Ceara <dceara@redhat.com>2019-07-08 12:07:00 +0200
committerBen Pfaff <blp@ovn.org>2019-07-08 14:05:25 -0700
commit87cef708f7e1092ec39a9414e4a15ee5a97bb051 (patch)
tree77f1ffddeb13c3e0c778b53bf682dcd0a8f5b167 /tests
parent080f080c3bc1e87da4affdce28a01b1a87a60364 (diff)
downloadopenvswitch-87cef708f7e1092ec39a9414e4a15ee5a97bb051.tar.gz
ovn-controller: Fix chassis ovn-sbdb record init
The chassis_run code didn't take into account the scenario when the system-id was changed in the Open_vSwitch table. Due to this the code was trying to insert a new Chassis record in the OVN_Southbound DB with the same Encaps as the previous Chassis record. The transaction used to insert the new records was aborting due to the ["type", "ip"] index constraint violation as we were creating new Encap entries with the same "type" and "ip" as the old ones. In order to fix this issue the flow is now: 1. the first time ovn-controller initializes the Chassis (shortly after start up) we store the chassis-id. 2. for subsequent chassis_run calls we use last configured chassis-id stored at the previous step to lookup the old Chassis record. 3. when ovn-controller shuts down gracefully we lookup the Chassis record based on the chassis-id stored in memory at steps 1 and 2 above. This is to avoid failing to cleanup the Chassis record in OVN_Southbound DB if the OVS system-id changes between the last call to chassis_run and chassis_cleanup. Reported-at: https://bugzilla.redhat.com/1708146 Reported-by: Haidong Li <haili@redhat.com> Signed-off-by: Dumitru Ceara <dceara@redhat.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/ovn-controller.at9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/ovn-controller.at b/tests/ovn-controller.at
index d4bb0717a..343c2abed 100644
--- a/tests/ovn-controller.at
+++ b/tests/ovn-controller.at
@@ -187,6 +187,15 @@ OVS_WAIT_UNTIL([
test "${expected_iface_types}" = "${chassis_iface_types}"
])
+# Change the value of external_ids:system-id and make sure it's mirrored
+# in the Chassis record in the OVN_Southbound database.
+sysid=${sysid}-foo
+ovs-vsctl set Open_vSwitch . external-ids:system-id="${sysid}"
+OVS_WAIT_UNTIL([
+ chassis_id=$(ovn-sbctl get Chassis "${sysid}" name)
+ test "${sysid}" = "${chassis_id}"
+])
+
# Gracefully terminate daemons
OVN_CLEANUP_SBOX([hv])
OVN_CLEANUP_VSWITCH([main])