From f3d645212a60b4c0e99e66488ab8ef9fd1e8d8cb Mon Sep 17 00:00:00 2001 From: Justin Pettit Date: Thu, 14 Jan 2010 13:10:35 -0800 Subject: [PATCH] ovsdb: Provide helper function to determine if IDL has ever connected --- lib/ovsdb-idl.c | 6 ++++++ lib/ovsdb-idl.h | 2 ++ vswitchd/ovs-brcompatd.c | 2 +- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/ovsdb-idl.c b/lib/ovsdb-idl.c index 635dcccb4..a4407a57d 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 fb551b485..88514b942 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 34162f3eb..a45bee119 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); -- 2.43.0