From: Justin Pettit Date: Thu, 14 Jan 2010 21:10:35 +0000 (-0800) Subject: ovsdb: Provide helper function to determine if IDL has ever connected X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f3d645212a60b4c0e99e66488ab8ef9fd1e8d8cb;p=openvswitch ovsdb: Provide helper function to determine if IDL has ever connected --- diff --git a/lib/ovsdb-idl.c b/lib/ovsdb-idl.c index 635dcccb..a4407a57 100644 --- a/lib/ovsdb-idl.c +++ b/lib/ovsdb-idl.c @@ -291,6 +291,12 @@ ovsdb_idl_get_seqno(const struct ovsdb_idl *idl) return idl->change_seqno; } +bool +ovsdb_idl_has_ever_connected(const struct ovsdb_idl *idl) +{ + return ovsdb_idl_get_seqno(idl) != 0; +} + void ovsdb_idl_force_reconnect(struct ovsdb_idl *idl) { diff --git a/lib/ovsdb-idl.h b/lib/ovsdb-idl.h index fb551b48..88514b94 100644 --- a/lib/ovsdb-idl.h +++ b/lib/ovsdb-idl.h @@ -16,6 +16,7 @@ #ifndef OVSDB_IDL_H #define OVSDB_IDL_H 1 +#include #include struct json; @@ -29,6 +30,7 @@ void ovsdb_idl_run(struct ovsdb_idl *); void ovsdb_idl_wait(struct ovsdb_idl *); unsigned int ovsdb_idl_get_seqno(const struct ovsdb_idl *); +bool ovsdb_idl_has_ever_connected(const struct ovsdb_idl *); void ovsdb_idl_force_reconnect(struct ovsdb_idl *); enum ovsdb_idl_txn_status { diff --git a/vswitchd/ovs-brcompatd.c b/vswitchd/ovs-brcompatd.c index 34162f3e..a45bee11 100644 --- a/vswitchd/ovs-brcompatd.c +++ b/vswitchd/ovs-brcompatd.c @@ -1190,7 +1190,7 @@ main(int argc, char *argv[]) ovs = ovsrec_open_vswitch_first(idl); brc_recv_update(ovs); - if (!ovs && ovsdb_idl_get_seqno(idl)) { + if (!ovs && ovsdb_idl_has_ever_connected(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);