{
return txn->idl;
}
+
+/* Blocks until 'idl' successfully connects to the remote database and
+ * retrieves its contents. */
+void
+ovsdb_idl_get_initial_snapshot(struct ovsdb_idl *idl)
+{
+ while (1) {
+ ovsdb_idl_run(idl);
+ if (ovsdb_idl_has_ever_connected(idl)) {
+ return;
+ }
+ ovsdb_idl_wait(idl);
+ poll_block();
+ }
+}
\f
/* If 'lock_name' is nonnull, configures 'idl' to obtain the named lock from
* the database server and to avoid modifying the database when the lock cannot
const struct uuid *);
struct ovsdb_idl *ovsdb_idl_txn_get_idl (struct ovsdb_idl_txn *);
+void ovsdb_idl_get_initial_snapshot(struct ovsdb_idl *);
\f
/* ovsdb_idl_loop provides an easy way to manage the transactions related
static char *vtep_remote;
static char *ovnsb_remote;
-static void
-get_initial_snapshot(struct ovsdb_idl *idl)
-{
- while (1) {
- ovsdb_idl_run(idl);
- if (ovsdb_idl_has_ever_connected(idl)) {
- return;
- }
- ovsdb_idl_wait(idl);
- poll_block();
- }
-}
-
int
main(int argc, char *argv[])
{
/* Connect to VTEP database. */
struct ovsdb_idl_loop vtep_idl_loop = OVSDB_IDL_LOOP_INITIALIZER(
ovsdb_idl_create(vtep_remote, &vteprec_idl_class, true, true));
- get_initial_snapshot(vtep_idl_loop.idl);
+ ovsdb_idl_get_initial_snapshot(vtep_idl_loop.idl);
/* Connect to OVN SB database. */
struct ovsdb_idl_loop ovnsb_idl_loop = OVSDB_IDL_LOOP_INITIALIZER(
ovsdb_idl_create(ovnsb_remote, &sbrec_idl_class, true, true));
- get_initial_snapshot(ovnsb_idl_loop.idl);
+ ovsdb_idl_get_initial_snapshot(ovnsb_idl_loop.idl);
/* Main loop. */
exiting = false;
static char *ovs_remote;
-static void
-get_initial_snapshot(struct ovsdb_idl *idl)
-{
- while (1) {
- ovsdb_idl_run(idl);
- if (ovsdb_idl_has_ever_connected(idl)) {
- return;
- }
- ovsdb_idl_wait(idl);
- poll_block();
- }
-}
-
static const struct ovsrec_bridge *
get_br_int(struct ovsdb_idl *ovs_idl)
{
encaps_register_ovs_idl(ovs_idl_loop.idl);
binding_register_ovs_idl(ovs_idl_loop.idl);
physical_register_ovs_idl(ovs_idl_loop.idl);
- get_initial_snapshot(ovs_idl_loop.idl);
+ ovsdb_idl_get_initial_snapshot(ovs_idl_loop.idl);
/* Connect to OVN SB database. */
char *ovnsb_remote = get_ovnsb_remote(ovs_idl_loop.idl);
struct ovsdb_idl_loop ovnsb_idl_loop = OVSDB_IDL_LOOP_INITIALIZER(
ovsdb_idl_create(ovnsb_remote, &sbrec_idl_class, true, true));
- get_initial_snapshot(ovnsb_idl_loop.idl);
+ ovsdb_idl_get_initial_snapshot(ovnsb_idl_loop.idl);
/* Main loop. */
exiting = false;