Skip to content

Commit

Permalink
ovn-nbctl: Don't loop forever on lost db connection.
Browse files Browse the repository at this point in the history
The main loop of ovn-nbctl had a condition to catch if the conenction
to the db was lost.  However, it didn't break out of the loop when the
condition occurred.  Now it should log the error once and exit with a
non-zero status code.

Signed-off-by: Russell Bryant <rbryant@redhat.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
  • Loading branch information
russellb authored and blp committed Mar 31, 2015
1 parent 5d867be commit 62ce36b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion ovn/ovn-nbctl.c
Expand Up @@ -583,6 +583,7 @@ main(int argc, char *argv[])
struct nbctl_context nb_ctx = { .idl = NULL, };
enum ovsdb_idl_txn_status txn_status;
unsigned int seqno;
int res = 0;

fatal_ignore_sigpipe();
set_program_name(argv[0]);
Expand All @@ -604,6 +605,8 @@ main(int argc, char *argv[])
int retval = ovsdb_idl_get_last_error(nb_ctx.idl);
VLOG_ERR("%s: database connection failed (%s)",
db, ovs_retval_to_string(retval));
res = 1;
break;
}

if (seqno != ovsdb_idl_get_seqno(nb_ctx.idl)) {
Expand All @@ -628,5 +631,5 @@ main(int argc, char *argv[])
}
ovsdb_idl_destroy(nb_ctx.idl);

exit(0);
exit(res);
}

0 comments on commit 62ce36b

Please sign in to comment.