When using ovsdb-client with an ovsdb-server with multiple databases, an
assertion could trigger due to them being returned in non-sorted order.
This commit changes the fetch_dbs() function to always return databases
in sorted order, since both callers are expecting that behavior.

Signed-off-by: Justin Pettit <jpet...@nicira.com>
Reported-by: Spiro Kourtessis <sp...@vmware.com>
---
 AUTHORS              |    1 +
 ovsdb/ovsdb-client.c |    2 +-
 2 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/AUTHORS b/AUTHORS
index 593776d..c113f16 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -194,6 +194,7 @@ Scott Hendricks         shendri...@nicira.com
 Sean Brady              sbr...@gtfservices.com
 Sebastian Andrzej Siewior  sebast...@breakpoint.cc
 Sébastien RICCIO        s...@swisscenter.com
+Spiro Kourtessis        sp...@vmware.com
 Srini Seetharaman       seeth...@stanford.edu
 Stephen Hemminger       shemmin...@vyatta.com
 Takayuki HAMA           t-h...@cb.jp.nec.com
diff --git a/ovsdb/ovsdb-client.c b/ovsdb/ovsdb-client.c
index 37bd1aa..bba9782 100644
--- a/ovsdb/ovsdb-client.c
+++ b/ovsdb/ovsdb-client.c
@@ -392,6 +392,7 @@ fetch_dbs(struct jsonrpc *rpc, struct svec *dbs)
         svec_add(dbs, name->u.string);
     }
     jsonrpc_msg_destroy(reply);
+    svec_sort(&dbs);
 }
 
 static void
@@ -404,7 +405,6 @@ do_list_dbs(struct jsonrpc *rpc, const char *database 
OVS_UNUSED,
 
     svec_init(&dbs);
     fetch_dbs(rpc, &dbs);
-    svec_sort(&dbs);
     SVEC_FOR_EACH (i, db_name, &dbs) {
         puts(db_name);
     }
-- 
1.7.5.4

_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to