summaryrefslogtreecommitdiff
path: root/ovn
diff options
context:
space:
mode:
authorHan Zhou <hzhou8@ebay.com>2019-02-15 18:49:52 -0800
committerBen Pfaff <blp@ovn.org>2019-02-22 13:48:34 -0800
commit530a1c18f3c8c7a4c079f1c74636f800d54e6b89 (patch)
treea7aca1ffdf37c3252fd5c2dda7f5513c207097d7 /ovn
parent1f4a175ecbe7a58b052ad26bcef3cbddb5de7d2f (diff)
downloadopenvswitch-530a1c18f3c8c7a4c079f1c74636f800d54e6b89.tar.gz
ovn-nbctl: Daemon mode should retry when IDL connection lost.
When creating IDL, "retry" was set to false. However, in daemon mode, reconnecting upon DB server failure should be transparent to user. This even impacts HA mode. E.g. in clustered mode, although IDL tries to connect to next server, but at the first retry the server fail-over may not be completed yet, and it stops retry after N (N = number of remotes) times. This patch makes sure in daemon mode retry is set to true so that the daemon will automatically retry forever. Signed-off-by: Han Zhou <hzhou8@ebay.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
Diffstat (limited to 'ovn')
-rw-r--r--ovn/utilities/ovn-nbctl.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/ovn/utilities/ovn-nbctl.c b/ovn/utilities/ovn-nbctl.c
index 2fa0b3389..cca7dbaa1 100644
--- a/ovn/utilities/ovn-nbctl.c
+++ b/ovn/utilities/ovn-nbctl.c
@@ -174,15 +174,19 @@ main(int argc, char *argv[])
apply_options_direct(parsed_options, n_parsed_options, &local_options);
free(parsed_options);
- /* Initialize IDL. */
- idl = the_idl = ovsdb_idl_create(db, &nbrec_idl_class, true, false);
- ovsdb_idl_set_leader_only(idl, leader_only);
-
+ bool daemon_mode = false;
if (get_detach()) {
if (argc != optind) {
ctl_fatal("non-option arguments not supported with --detach "
"(use --help for help)");
}
+ daemon_mode = true;
+ }
+ /* Initialize IDL. "retry" is true iff in daemon mode. */
+ idl = the_idl = ovsdb_idl_create(db, &nbrec_idl_class, true, daemon_mode);
+ ovsdb_idl_set_leader_only(idl, leader_only);
+
+ if (daemon_mode) {
server_loop(idl, argc, argv);
} else {
struct ctl_command *commands;