It's pretty easy to get 0 remotes here from ovn-northd if you specify
--ovnnb-db='' or --ovnnb-db='   ' on the command line.  The internals
of jsonrpc_session aren't equipped to cope with that, so just add a
dummy remote instead.

Signed-off-by: Ben Pfaff <[email protected]>
---
 lib/jsonrpc.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/jsonrpc.c b/lib/jsonrpc.c
index 060b6669d893..10c0c09962da 100644
--- a/lib/jsonrpc.c
+++ b/lib/jsonrpc.c
@@ -825,8 +825,10 @@ jsonrpc_session_open_multiple(const struct svec *remotes, 
bool retry)
     s = xmalloc(sizeof *s);
 
     /* Set 'n' remotes from 'names'. */
-    ovs_assert(remotes->n > 0);
     svec_clone(&s->remotes, remotes);
+    if (!s->remotes.n) {
+        svec_add(&s->remotes, "invalid:");
+    }
     s->next_remote = 0;
 
     s->reconnect = reconnect_create(time_msec());
-- 
2.26.2

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to