Current code of create-cluster from standalone db takes backup of existing
standalone db and then generates a new clustered dbs from backup dbs. Hence,
during migration if nb and sb  dbs are still present, create-cluster will fail
saying file exists and will not really convert  dbs to clustered dbs. This
patch fixes the same.

e.g message that pops up while migration from standalone to raft cluster:
 * Backing up database to /etc/openvswitch/ovnnb_db.db.backup5.13.0-1278623084
ovsdb-tool: I/O error: /etc/openvswitch/ovnnb_db.db: create failed (File exists)
 * Creating cluster database /etc/openvswitch/ovnnb_db.db from existing one

Signed-off-by: aginwala <[email protected]>
---
 utilities/ovs-lib.in | 1 +
 1 file changed, 1 insertion(+)

diff --git a/utilities/ovs-lib.in b/utilities/ovs-lib.in
index fa840ec63..76ce79b9c 100644
--- a/utilities/ovs-lib.in
+++ b/utilities/ovs-lib.in
@@ -485,6 +485,7 @@ create_cluster () {
     elif ovsdb_tool db-is-standalone "$DB_FILE"; then
         # Convert standalone database to clustered.
         backup_db || return 1
+        rm -f "$DB_FILE"
         action "Creating cluster database $DB_FILE from existing one" \
                ovsdb_tool create-cluster "$DB_FILE" "$backup" "$LOCAL_ADDR"
     fi
-- 
2.20.1 (Apple Git-117)

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to