]> git.proxmox.com Git - ovs.git/commitdiff
ovsdb: Provide helper function to determine if IDL has ever connected
authorJustin Pettit <jpettit@nicira.com>
Thu, 14 Jan 2010 21:10:35 +0000 (13:10 -0800)
committerJustin Pettit <jpettit@nicira.com>
Thu, 14 Jan 2010 21:10:35 +0000 (13:10 -0800)
lib/ovsdb-idl.c
lib/ovsdb-idl.h
vswitchd/ovs-brcompatd.c

index 635dcccb48ba1b2b2e28734210a8c231d43f9a85..a4407a57d44ace17f0a4ee199a5dab0eac73d01d 100644 (file)
@@ -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)
 {
index fb551b485ec6b5355e68e53fe4d6dc5481226fcf..88514b942dcdb9baee438d840c75fe6ad4a1369f 100644 (file)
@@ -16,6 +16,7 @@
 #ifndef OVSDB_IDL_H
 #define OVSDB_IDL_H 1
 
+#include <stdbool.h>
 #include <stdint.h>
 
 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 {
index 34162f3eb1d831ad4cdd95efaeffdfb7ad01fd30..a45bee1191e626213f94ea7b0db96533d9c671ec 100644 (file)
@@ -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);