From: Matteo Croce Date: Wed, 27 Sep 2017 13:46:13 +0000 (+0200) Subject: ovs-lib: dont't purge corrupted DB X-Git-Tag: v2.12.3~2495 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=dbb5ecb4bed1e206ff7be9235a9bc7c6ea32b836;p=mirror_ovs.git ovs-lib: dont't purge corrupted DB In ovs-lib there is a function named upgrade_db which tries to convert a database after OVS {up,down}grades. This function uses ovsdb-tool to check if the DB needs to be upgraded. If the upgrade fails, it purges the DB and create an empty one. ovsdb-tool returns "yes" or "no" to indicate if the DB needs upgrading, but if the DB is corrupted it returns a list of errors. Change a condition from "!= no" to "= yes" because in case of DB corruption upgrade_db would purge the existing DB without writing anything in the logs. Signed-off-by: Matteo Croce Signed-off-by: Ben Pfaff Acked-by: Mark Michelson --- diff --git a/utilities/ovs-lib.in b/utilities/ovs-lib.in index ac2da85b7..1bccea0c5 100644 --- a/utilities/ovs-lib.in +++ b/utilities/ovs-lib.in @@ -408,7 +408,7 @@ upgrade_db () { log_warning_msg "$DB_FILE does not exist" install_dir `dirname $DB_FILE` create_db "$DB_FILE" "$DB_SCHEMA" - elif test X"`ovsdb_tool needs-conversion "$DB_FILE" "$DB_SCHEMA"`" != Xno; then + elif test X"`ovsdb_tool needs-conversion "$DB_FILE" "$DB_SCHEMA"`" = Xyes; then # Back up the old version. version=`ovsdb_tool db-version "$DB_FILE"` cksum=`ovsdb_tool db-cksum "$DB_FILE" | awk '{print $1}'`