summaryrefslogtreecommitdiff
path: root/ovsdb
diff options
context:
space:
mode:
authorBen Pfaff <blp@nicira.com>2010-05-07 10:44:01 -0700
committerBen Pfaff <blp@nicira.com>2010-05-07 14:36:06 -0700
commita1ae5dc8da2d30704f7654e0d593cf2ca1e088f7 (patch)
tree70d2f5afd14c202b62505a5c3f87d65cf677266e /ovsdb
parente86dd676cdb1885ee4f8f1fa92176d159d5bb533 (diff)
downloadopenvswitch-a1ae5dc8da2d30704f7654e0d593cf2ca1e088f7.tar.gz
ovsdb-client: Serialize columns in predictable order on "monitor" command.
The "monitor" command goes to some trouble to write its output in a predictable order, so that test programs can reliably compare it against expectations. This commit fixes up one part that was missing, which is that the columns were not being ordered predictably (it depended on hash order, which differs between big-endian and little-endian systems). It also updates the test suite to expect the new order.
Diffstat (limited to 'ovsdb')
-rw-r--r--ovsdb/ovsdb-client.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/ovsdb/ovsdb-client.c b/ovsdb/ovsdb-client.c
index 7a8310f15..7177b2614 100644
--- a/ovsdb/ovsdb-client.c
+++ b/ovsdb/ovsdb-client.c
@@ -917,14 +917,22 @@ do_monitor(int argc, char *argv[])
ovsdb_column_set_add(&columns, column);
}
} else {
- struct shash_node *node;
-
- SHASH_FOR_EACH (node, &table->columns) {
- const struct ovsdb_column *column = node->data;
- if (column->index != OVSDB_COL_UUID) {
+ const struct shash_node **nodes;
+ size_t i, n;
+
+ n = shash_count(&table->columns);
+ nodes = shash_sort(&table->columns);
+ for (i = 0; i < n; i++) {
+ const struct ovsdb_column *column = nodes[i]->data;
+ if (column->index != OVSDB_COL_UUID
+ && column->index != OVSDB_COL_VERSION) {
ovsdb_column_set_add(&columns, column);
}
}
+ free(nodes);
+
+ ovsdb_column_set_add(&columns,
+ ovsdb_table_schema_get_column(table, "_version"));
}
if (argc >= 6 && *argv[5] != '\0') {