HP HPE VAN SDN Controller 2.7 Administrator's Manual page 200

Table of Contents

Advertisement

}
function check_stop_and_exit {
OUT=$1
if [[ $OUT -ne 0 && $OUT -ne 1 ]]; then
restore_log "Stopping Cassandra failed and Restore failed : $OUT"
rm $INFO_FILE
exit 1
fi
}
function check_and_exit {
OUT=$1
if [ $OUT -ne 0 ]; then
restore_log "Restore failed:$OUT"
rm $INFO_FILE
exit 1
fi
}
function restorePostGre {
restore_log "Restoring postgre database..."
# unzip the zip of postgre
unzip -o postgreSQLdata.zip -d $targetDir
# delete the sdndb first and re-create it
dropdb sdndb
createdb -O sdn sdndb
# remove the extra things that pg_dump back up
sed -i '/REVOKE ALL ON SCHEMA public FROM PUBLIC/d' backupPG.sql
sed -i '/REVOKE ALL ON SCHEMA public FROM postgres/d' backupPG.sql
sed -i '/GRANT ALL ON SCHEMA public TO postgres/d' backupPG.sql
sed -i '/GRANT ALL ON SCHEMA public TO PUBLIC/d' backupPG.sql
# this assumes that sdndb database already exists
psql sdndb < backupPG.sql
check_and_exit $?
}
function restoreLicenseLogs {
if [ -f licenselog.zip ]
then
restore_log "Restoring license history logs..."
# unzip the license logs
unzip -o licenselog.zip -d /var/log/sdn/virgo/logs
check_and_exit $?
fi
}
function restoreMetricsData {
if [ -f metricsData.zip ]
then
restore_log "Restoring metrics data..."
# wipe out existing contents
rm -rf $metricsDir/*
# unzip the metrics data
unzip -o metricsData.zip -d "$metricsDir"
check_and_exit $?
fi
}
function command_exists {
command -v $1 &> /dev/null;
}
function wait_for_sdnc_stop {
restore_log "Waiting for SDNC to stop..."
pid='get_sdnc_pid'
if [[ -z $pid ]]; then return 0; fi
for tries in 'seq $WAIT_FOR_STOP'; do
sleep 1
is_sdnc_running || return 0
done
return 1
}
# check if unzip is present or not
if command_exists unzip; then :
else
restore_log "Unzip is not installed"
restore_log "Please install unzip utility and try again"
check_and_exit 1
fi
wait_for_sdnc_stop
check_and_exit $?
200 Scripts

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents