diff options
author | RYAN D. MOATS <rmoats@us.ibm.com> | 2016-04-12 08:43:59 -0500 |
---|---|---|
committer | Ben Pfaff <blp@ovn.org> | 2016-04-14 14:58:18 -0700 |
commit | 1b62572da1ba70eec5e654cff264e75f642f2cc0 (patch) | |
tree | ff13ecbfc0e3738381f136e59b4d427ba44f41e7 /ovn/controller/ovn-controller.c | |
parent | 7d9d86add52233872ea7810022716ea8afba53f1 (diff) | |
download | openvswitch-1b62572da1ba70eec5e654cff264e75f642f2cc0.tar.gz |
ovn-controller: Dynamically reconnect if ovn-remote value changes.
Allows for auto detection and reconnect if the ovn-remote needs
to change. Ovn-controller test case updated to include testing
this code.
Signed-off-by: RYAN D. MOATS <rmoats@us.ibm.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Diffstat (limited to 'ovn/controller/ovn-controller.c')
-rw-r--r-- | ovn/controller/ovn-controller.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/ovn/controller/ovn-controller.c b/ovn/controller/ovn-controller.c index c47492e6b..f68f842c6 100644 --- a/ovn/controller/ovn-controller.c +++ b/ovn/controller/ovn-controller.c @@ -330,6 +330,16 @@ main(int argc, char *argv[]) /* Main loop. */ exiting = false; while (!exiting) { + /* Check OVN SB database. */ + char *new_ovnsb_remote = get_ovnsb_remote(ovs_idl_loop.idl); + if (strcmp(ovnsb_remote, new_ovnsb_remote)) { + free(ovnsb_remote); + ovnsb_remote = new_ovnsb_remote; + ovsdb_idl_set_remote(ovnsb_idl_loop.idl, ovnsb_remote, true); + } else { + free(new_ovnsb_remote); + } + struct controller_ctx ctx = { .ovs_idl = ovs_idl_loop.idl, .ovs_idl_txn = ovsdb_idl_loop_run(&ovs_idl_loop), |