[ovs-dev] [PATCH] jsonrpc: Don't assert for 0 remotes in jsonrpc_session_open_multiple().

Ben Pfaff blp at ovn.org
Fri Jun 26 19:46:24 UTC 2020


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 <blp at ovn.org>
---
 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



More information about the dev mailing list