summaryrefslogtreecommitdiff
path: root/utilities
diff options
context:
space:
mode:
authorTerry Wilson <twilson@redhat.com>2021-11-05 13:24:20 -0500
committerIlya Maximets <i.maximets@ovn.org>2021-11-30 01:24:00 +0100
commitc60eec06492fd183a5801c6a22b990b2987f6846 (patch)
tree253dd0b492efeabb42f03399451b917f2aec3df4 /utilities
parentc041042c127c8ea846defd557e4c275b67f3d03d (diff)
downloadopenvswitch-c60eec06492fd183a5801c6a22b990b2987f6846.tar.gz
ovs-lib: Backup and remove existing DB when joining cluster.
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 <twilson@redhat.com> Acked-by: Dumitru Ceara <dceara@redhat.com> Acked-by: Flavio Fernandes <flavio@flaviof.com> Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
Diffstat (limited to 'utilities')
-rw-r--r--utilities/ovs-lib.in10
1 files changed, 5 insertions, 5 deletions
diff --git a/utilities/ovs-lib.in b/utilities/ovs-lib.in
index 3eda01d3c..13477a6a9 100644
--- a/utilities/ovs-lib.in
+++ b/utilities/ovs-lib.in
@@ -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
}