Skip to content

Commit

Permalink
ovs-lib: Backup and remove existing DB when joining cluster.
Browse files Browse the repository at this point in the history
ovsdb-tool join-cluster requires a remote addr, so the existing
code that tried to join a cluster without it when there was an
existing $DB_FILE would fail.

Instead, if we are trying to specifically join a cluster and there
is an existing $DB_FILE, back it up and remove the original before
continuing to join the cluster.

Signed-off-by: Terry Wilson <[email protected]>
Acked-by: Dumitru Ceara <[email protected]>
Acked-by: Flavio Fernandes <[email protected]>
Signed-off-by: Ilya Maximets <[email protected]>
  • Loading branch information
otherwiseguy authored and igsilya committed Nov 30, 2021
1 parent c041042 commit c60eec0
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions utilities/ovs-lib.in
Original file line number Diff line number Diff line change
Expand Up @@ -519,13 +519,13 @@ join_cluster() {
LOCAL_ADDR="$3"
REMOTE_ADDR="$4"

if test ! -e "$DB_FILE"; then
ovsdb_tool join-cluster "$DB_FILE" "$SCHEMA_NAME" "$LOCAL_ADDR" "$REMOTE_ADDR"
elif ovsdb_tool db-is-standalone "$DB_FILE"; then
# Backup standalone database and join cluster.
if test -e "$DB_FILE" && ovsdb_tool db-is-standalone "$DB_FILE"; then
backup_db || return 1
rm $DB_FILE
fi
if test ! -e "$DB_FILE"; then
action "Joining $DB_FILE to cluster" \
ovsdb_tool join-cluster "$DB_FILE" "$SCHEMA_NAME" "$LOCAL_ADDR"
ovsdb_tool join-cluster "$DB_FILE" "$SCHEMA_NAME" "$LOCAL_ADDR" "$REMOTE_ADDR"
fi
}

Expand Down

0 comments on commit c60eec0

Please sign in to comment.