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 <[email protected]>
Reported-by: Spiro Kourtessis <[email protected]>
---
 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         [email protected]
 Sean Brady              [email protected]
 Sebastian Andrzej Siewior  [email protected]
 Sébastien RICCIO        [email protected]
+Spiro Kourtessis        [email protected]
 Srini Seetharaman       [email protected]
 Stephen Hemminger       [email protected]
 Takayuki HAMA           [email protected]
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
[email protected]
http://openvswitch.org/mailman/listinfo/dev

Reply via email to