X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=vswitchd%2Fovs-brcompatd.c;h=594d474b1d6e831dc76a7fcb67ad0aa7c958b591;hb=250382a8fc839cb077b2636983a1c1de0d6b0e17;hp=a446e7ced9755b3950c6d68b9b0d118370c5a4d4;hpb=927889486aa059cf43f633bc158a31c37fabda4e;p=openvswitch diff --git a/vswitchd/ovs-brcompatd.c b/vswitchd/ovs-brcompatd.c index a446e7ce..594d474b 100644 --- a/vswitchd/ovs-brcompatd.c +++ b/vswitchd/ovs-brcompatd.c @@ -39,7 +39,6 @@ #include "dirs.h" #include "dynamic-string.h" #include "fatal-signal.h" -#include "fault.h" #include "leak-checker.h" #include "netdev.h" #include "netlink.h" @@ -1144,11 +1143,9 @@ main(int argc, char *argv[]) struct unixctl_server *unixctl; const char *remote; struct ovsdb_idl *idl; - unsigned int idl_seqno; int retval; set_program_name(argv[0]); - register_fault_handlers(); time_init(); vlog_init(); vlog_set_levels(VLM_ANY_MODULE, VLF_CONSOLE, VLL_WARN); @@ -1159,7 +1156,7 @@ main(int argc, char *argv[]) process_init(); die_if_already_running(); - daemonize(); + daemonize_start(); retval = unixctl_server_create(NULL, &unixctl); if (retval) { @@ -1177,39 +1174,30 @@ main(int argc, char *argv[]) } } + daemonize_complete(); + idl = ovsdb_idl_create(remote, &ovsrec_idl_class); - idl_seqno = ovsdb_idl_get_seqno(idl); for (;;) { const struct ovsrec_open_vswitch *ovs; struct ovsdb_idl_txn *txn; - int status; - unsigned int new_idl_seqno; + enum ovsdb_idl_txn_status status; ovsdb_idl_run(idl); - /* xxx Complete hack to get around bad ovs! */ - new_idl_seqno = ovsdb_idl_get_seqno(idl); - if (new_idl_seqno == idl_seqno) { - ovsdb_idl_wait(idl); - poll_block(); - printf("xxx trying again...\n"); - idl_seqno = new_idl_seqno; - continue; - } - - ovs = ovsrec_open_vswitch_first(idl); - if (!ovs) { - /* XXX it would be more user-friendly to create a record ourselves - * (while verifying that the table is empty before doing so). */ - ovs_fatal(0, "%s: database does not contain any Open vSwitch " - "configuration", remote); - } - txn = ovsdb_idl_txn_create(idl); unixctl_server_run(unixctl); - brc_recv_update(ovs); + ovs = ovsrec_open_vswitch_first(idl); + if (ovs) { + brc_recv_update(ovs); + } else if (ovsdb_idl_get_seqno(idl)) { + static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 1); + VLOG_WARN_RL(&rl, "%s: database does not contain any Open vSwitch " + "configuration", remote); + } else { + /* Haven't yet received initial database contents. */ + } netdev_run(); #if 0 @@ -1249,6 +1237,7 @@ main(int argc, char *argv[]) ovs_fatal(0, "transaction aborted"); case TXN_SUCCESS: + case TXN_UNCHANGED: break; case TXN_TRY_AGAIN: