return idl;
}
+/* Changes the remote and creates a new session. */
+void
+ovsdb_idl_set_remote(struct ovsdb_idl *idl, const char *remote,
+ bool retry)
+{
+ if (idl) {
+ ovs_assert(!idl->txn);
+ idl->session = jsonrpc_session_open(remote, retry);
+ idl->state_seqno = UINT_MAX;
+ }
+}
+
/* Destroys 'idl' and all of the data structures that it manages. */
void
ovsdb_idl_destroy(struct ovsdb_idl *idl)
const struct ovsdb_idl_class *,
bool monitor_everything_by_default,
bool retry);
+void ovsdb_idl_set_remote(struct ovsdb_idl *, const char *, bool);
void ovsdb_idl_destroy(struct ovsdb_idl *);
void ovsdb_idl_run(struct ovsdb_idl *);
/* Main loop. */
exiting = false;
while (!exiting) {
+ /* Check OVN SB database. */
+ char *new_ovnsb_remote = get_ovnsb_remote(ovs_idl_loop.idl);
+ if (strcmp(ovnsb_remote, new_ovnsb_remote)) {
+ free(ovnsb_remote);
+ ovnsb_remote = new_ovnsb_remote;
+ ovsdb_idl_set_remote(ovnsb_idl_loop.idl, ovnsb_remote, true);
+ } else {
+ free(new_ovnsb_remote);
+ }
+
struct controller_ctx ctx = {
.ovs_idl = ovs_idl_loop.idl,
.ovs_idl_txn = ovsdb_idl_loop_run(&ovs_idl_loop),
'br-int patch-quux-to-baz patch-baz-to-quux' \
'br-int patch-baz-to-quux patch-quux-to-baz'
+# Create an empty database, serve it and switch to it
+# and verify that the OVS patch ports disappear
+# then put it back and verify that they reappear
+
+on_exit 'kill `cat $ovs_base/ovn-sb/ovsdb-server-2.pid`'
+
+ovsdb-tool create $ovs_base/ovn-sb/ovn-sb1.db "$abs_top_srcdir"/ovn/ovn-sb.ovsschema
+as ovn-sb ovsdb-server --detach --pidfile=$ovs_base/ovn-sb/ovsdb-server-2.pid --remote=punix:$ovs_base/ovn-sb/ovn-sb1.sock $ovs_base/ovn-sb/ovn-sb1.db
+AT_CHECK([ovs-vsctl -- set Open_vSwitch . external-ids:ovn-remote=unix:$ovs_base/ovn-sb/ovn-sb1.sock])
+check_patches
+AT_CHECK([ovs-vsctl -- set Open_vSwitch . external-ids:ovn-remote=unix:$ovs_base/ovn-sb/ovn-sb.sock])
+check_patches \
+ 'br-int patch-quux-to-baz patch-baz-to-quux' \
+ 'br-int patch-baz-to-quux patch-quux-to-baz'
+
# Change the logical patch ports to VIFs and verify that the OVS patch
# ports disappear.
AT_CHECK([ovn-sbctl \
OVS_APP_EXIT_AND_WAIT([ovsdb-server])
as ovn-sb
+OVS_APP_EXIT_AND_WAIT_BY_TARGET([ovsdb-server-2])
OVS_APP_EXIT_AND_WAIT([ovsdb-server])
AT_CLEANUP