dnl Dump out and check the actual database contents.
on_exit 'kill `cat ovsdb-server.pid`'
AT_CHECK([[ovsdb-server --detach --pidfile --no-chdir --remote=punix:socket db]],
- [0], [stdout], [ignore])
+ [0], [stdout], [ignore])
AT_CHECK([[ovsdb-client dump unix:socket ordinals]],
- [0], [stdout], [ignore])
+ [0], [stdout], [ignore])
OVS_APP_EXIT_AND_WAIT([ovsdb-server])
AT_CHECK([uuidfilt stdout], [0], [dnl
AT_CHECK([test `wc -l < db` -eq 4])
dnl And check that the dumped data is the same too:
AT_CHECK([[ovsdb-server --detach --pidfile --no-chdir --remote=punix:socket db]],
- [0], [stdout], [ignore])
+ [0], [stdout], [ignore])
AT_CHECK([[ovsdb-client dump unix:socket ordinals]],
- [0], [stdout], [ignore])
+ [0], [stdout], [ignore])
OVS_APP_EXIT_AND_WAIT([ovsdb-server])
AT_CHECK([uuidfilt stdout], [0], [dnl
[[for pair in 'zero 0' 'one 1' 'two 2' 'three 3' 'four 4' 'five 5'; do
set -- $pair
ovsdb-tool transact db1 '
- ["ordinals",
- {"op": "insert",
- "table": "ordinals",
- "row": {"name": "'$1'", "number": '$2'}},
- {"op": "comment",
- "comment": "add row for '"$pair"'"}]'
+ ["ordinals",
+ {"op": "insert",
+ "table": "ordinals",
+ "row": {"name": "'$1'", "number": '$2'}},
+ {"op": "comment",
+ "comment": "add row for '"$pair"'"}]'
done | uuidfilt]], [0],
[[[{"uuid":["uuid","<0>"]},{}]
[{"uuid":["uuid","<1>"]},{}]
]], [ignore])
# Dump the data.
-AT_CHECK([ovsdb-server -vfile -vvlog:off --monitor --detach --no-chdir --pidfile --log-file --remote=punix:db.sock db1])
+AT_CHECK([ovsdb-server -vfile -vvlog:off --detach --no-chdir --pidfile --log-file --remote=punix:db.sock db1])
AT_CHECK([ovsdb-client dump > expout])
OVS_APP_EXIT_AND_WAIT([ovsdb-server])
ovsdb-tool create-cluster db2 db1 unix:s1.raft
# Dump the data.
-AT_CHECK([ovsdb-server -vconsole:off -vfile -vvlog:off --monitor --detach --no-chdir --pidfile --log-file --remote=punix:db.sock db2])
-AT_CHECK([ovsdb-client wait ordinals connected])
+AT_CHECK([ovsdb-server -vconsole:off -vfile -vvlog:off --detach --no-chdir --pidfile --log-file --remote=punix:db.sock db2])
+AT_CHECK([ovsdb_client_wait ordinals connected])
AT_CHECK([ovsdb-client dump > dump2])
OVS_APP_EXIT_AND_WAIT([ovsdb-server])
# Make sure that the clustered data matched the standalone data.
AT_CHECK([cat dump2], [0], [expout])
AT_CLEANUP
+
+AT_SETUP([ovsdb-tool convert-to-standalone])
+AT_KEYWORDS([ovsdb file positive])
+ordinal_schema > schema
+AT_CHECK([ovsdb-tool create-cluster db schema unix:s1.raft], [0], [stdout], [ignore])
+AT_CHECK([ovsdb-server --detach --no-chdir --pidfile --remote=punix:socket --log-file db >/dev/null 2>&1])
+for txn in m4_foreach([txn], [[[["ordinals",
+ {"op": "insert",
+ "table": "ordinals",
+ "row": {"number": 0, "name": "zero"}},
+ {"op": "insert",
+ "table": "ordinals",
+ "row": {"number": 1, "name": "one"}},
+ {"op": "insert",
+ "table": "ordinals",
+ "row": {"number": 2, "name": "two"}}]]]], ['txn' ]); do
+AT_CHECK([ovsdb-client transact unix:socket "$txn"], [0], [ignore], [ignore])
+done
+AT_CHECK([ovsdb-client transact unix:socket '[["ordinals"]]'], [0],
+ [ignore], [ignore])
+AT_CHECK([ovsdb-client dump unix:socket > clusterdump])
+AT_CHECK([ovs-appctl -t ovsdb-server -e exit], [0], [ignore], [ignore])
+
+# Convert to standalone database from clustered database.
+AT_CHECK(ovsdb-tool cluster-to-standalone db1 db)
+
+# Check its standalone db
+AT_CHECK([ovsdb-tool db-is-standalone db1])
+
+# Dump the standalone db data.
+AT_CHECK([ovsdb-server -vconsole:off -vfile -vvlog:off --detach --no-chdir --pidfile --log-file --remote=punix:db.sock db1])
+AT_CHECK([ovsdb_client_wait ordinals connected])
+AT_CHECK([ovsdb-client dump > standalonedump])
+OVS_APP_EXIT_AND_WAIT([ovsdb-server])
+
+# Make sure both standalone and cluster db data matches.
+AT_CHECK([diff standalonedump clusterdump])
+AT_CLEANUP