
# extract the backup archive content
cd $targetDir
for file in 'ls -a *.*'
do
case $file in
config.zip)
restore_log "Restoring config files..."
unzip -o $file -d $configDir
check_and_exit $?
;;
teamConfig.zip)
restore_log "Restoring teaming Config files..."
restoreTeamConfig $file
check_and_exit $?
;;
userrepo.zip)
restore_log "Restoring user repository..."
rm -rf $repoDir/*
unzip -o $file -d $repoDir
check_and_exit $?
;;
cassandradata.zip)
restore_log "Restoring cassandra data files..."
restoreCassandraData $file cassandraconfig.zip
check_and_exit $?
;;
*)
;;
esac
done
# restore postgre sql
restorePostGre
# restore licensing compliance history logs
restoreLicenseLogs
# restore metrics data
restoreMetricsData
# clean up virgo runtime environment
clean_virgo_runtime
# create links to /var/log/sdn/virgo
[ ! -L /opt/sdn/virgo/serviceability ] && ln -s /var/log/sdn/virgo /opt/sdn/virgo/serviceability
# Change permissions in case the user IDs have changed since the backup.
sudo chown -R sdn:sdn /opt/sdn /var/lib/sdn /var/log/sdn/virgo/logs/license-history.log
restore_log "Turning off the restore mode..."
# delete the restore.indicator file
[ -f /opt/sdn/backup/restore.indicator ] && rm /opt/sdn/backup/restore.indicator
restore_log "Restore done..."
Backing up a controller team
NOTE:
Because the scripts in this appendix cross page boundaries, be careful to avoid including
the page number when copying a script. Copying a script one page at a time can prevent inclusion
of page numbers.
#!/bin/bash
#-------------------------------------------------------------------------------
# Copyright 2013 Hewlett Packard Co., All Rights Reserved.
#-------------------------------------------------------------------------------
#
# Backup a Team
#-------------------------------------------------------------------------------
export BACKUP_DIR="/opt/sdn/backup"
export BACKUP_TEAM_DIR="/opt/sdn/team_backup"
export TEAM_BACKUP_STATUS_FILE="$BACKUP_TEAM_DIR/teamBackup_status"
export TEAM_BACKUP_LOGFILE="$BACKUP_TEAM_DIR/teamBackup_log.log"
export BACKUP_WAIT_COUNT=200 # this * 10 = seconds to wait for backup to finish
export B_PID=$$
trap "exit 1" TERM
#==============================================================================
# F U N C T I O N S
#==============================================================================
#------------------------------------------------------------------------------
# Function validateTeamLead ( )
# Validates configured node IP against the team leader IP.
Backing up a controller team
201