EasyManua.ls Logo

HP HPE VAN SDN Controller 2.7 - Page 203

HP HPE VAN SDN Controller 2.7
231 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
# Verifies the success of the backup.
#------------------------------------------------------------------------------
function verifyBackupStatus {
local nodeIndex=$1
local backupIP=${ipArr[$nodeIndex]}
local backupUrl="https://$backupIP:8443/sdn/v2.0/backup/status"
backupStatus[$nodeIndex]='get $backupIP ${nodeAuth[$nodeIndex]} $backupUrl'
if [ "${backupStatus[$nodeIndex]}" == "SUCCESS" ]; then
teamBackup_log "Backup completed successfully on $backupIP."
let "backup_complete = $backup_complete - 1"
return
fi
}
#------------------------------------------------------------------------------
# Function teamBackupZip ( )
# Creates a single zip for all the team backup data.
#------------------------------------------------------------------------------
function teamBackupZip {
teamZip='date|tr ' ' '_'|tr ':' '_''
teamZip="$BACKUP_TEAM_DIR/sdn_team_backup_$teamZip.zip"
rm -rf $BACKUP_TEAM_DIR/sdn_team_backup* $TEAM_BACKUP_STATUS_FILE
zip -r $teamZip $BACKUP_TEAM_DIR/
rm -rf $BACKUP_TEAM_DIR/sdn_controller_backup*
}
#------------------------------------------------------------------------------
# Function remoteBackupFileCopy ( )
# Copies the team backup zip to the specified remote location.
#------------------------------------------------------------------------------
function remoteBackupFileCopy {
if [ "$remotePath" == "" ]; then
teamBackup_log "Team backup data was not copied to the remote location."
return
fi
teamBackup_log "Copying team backup to the remote location $remotePath..."
scp $BACKUP_TEAM_DIR/sdn_team_backup* $remotePath
}
#------------------------------------------------------------------------------
# Function getSysInfo ( <authToken> )
# Gets the SysInformation for the running node.
#------------------------------------------------------------------------------
function getSysInfo {
local leadAuth=$1
local sysUrl="https://localhost:8443/sdn/v2.0/systems"
for i in {1..5}; do
sysInfo='get localhost $leadAuth "$sysUrl"'
if [ $errorCode -ne 0 ]; then
teamBackup_log "Failed to retrieve the system information."
exitBackup 1
fi
[ "$sysInfo" != "" ] && break
sleep 5
done
if [ "$sysInfo" == "" ]; then
teamBackup_log "Failed to retrieve the system information."
exitBackup 1
fi
}
#------------------------------------------------------------------------------
# Function extractRole_NodeIP ( <systemInfo>)
# Extracts IP and role for all the nodes in a team.
#------------------------------------------------------------------------------
function extractRole_NodeIP {
sysinfo=$1
ipArr=($(echo $sysinfo|tr -d '"'| tr -d '['|tr -d ']'| sed -e 's/\,/\n/g'| grep -w "ip"| cut -d ':' -f2-))
roleArr=($(echo $sysinfo|tr -d '"'| tr -d '['|tr -d ']'| sed -e 's/\,/\n/g'| grep -w "role"| cut -d ':' -f2-))
numNodes=${#ipArr[@]}
teamBackup_log "Number of nodes in the team is $numNodes."
for (( i=0; i<=$numNodes; i++ )); do
if [ "${roleArr[$i]}" == "leader" ]; then
leaderIp=${ipArr[$i]}
teamBackup_log "The team leader is $leaderIp."
break
fi
done
}
#------------------------------------------------------------------------------
# Function teamBackup_log ( <message> )
# Writes messages to the log for the team backup operation.
#------------------------------------------------------------------------------
function teamBackup_log {
msg="$1"
echo "$msg" |tee -a $TEAM_BACKUP_LOGFILE
}
#------------------------------------------------------------------------------
# Function exitBackup ( <exitStatus> )
# Exits the backup.
#------------------------------------------------------------------------------
function exitBackup {
Backing up a controller team 203

Table of Contents

Related product manuals