HP VAN SDN Controller Administrator Guide

94
# Get the system Information for the local controller.
getSysInfo $leaderAuth
# Get the set of team IPs and their associated team roles.
extractRole_NodeIP $sysInfo
(validateTeamLead)
# Initiate a backup on each node.
for (( i=0; i<$numNodes; i++ )); do
nodeAuth[$i]=`getAuthToken ${ipArr[$i]}`
uuidURL="https://${ipArr[$i]}:8443/sdn/v2.0/contact"
nodeUUID[$i]=`get ${ipArr[$i]} ${nodeAuth[$i]} "$uuidURL"`
nodeUUID[$i]=`extractJSONString "${nodeUUID[$i]}" "uid" | sed '/^$/d'`
if [ "${ipArr[$i]}" == "$leaderIp" ]; then
# Skip the leader backup backup, since it will be done last.
leaderIndex=$i
continue
fi
backupsession[$i]=`backupNode $i`
teamBackup_log "Started backup ${backupsession[$i]} on ${ipArr[$i]}."
done
# Verify the status of the backup on each node.
backup_complete=$numNodes
waitTime=$(($BACKUP_WAIT_COUNT*10/60))
for (( k=0; k<$BACKUP_WAIT_COUNT; k++ )); do
if [ $backup_complete -le 1 ]; then
teamBackup_log "Backup on all member nodes completed successfully."
break
fi
sleep 10
for (( i=0; i<$numNodes; i++ )); do
# Skip the leader node check, since it will be done last.
[ "${ipArr[$i]}" == "$leaderIp" ] && continue
# Backup already completed for this node, so continue.
[ "${backupStatus[$i]}" == "3" ] && continue
verifyBackupStatus $i
done
done
if [ $backup_complete -gt 1 ]; then
teamBackup_log "Backup of all member nodes took longer than $waitTime min.
Aborting backup..."
teamBackup_log "To increase backup wait time, change BACKUP_WAIT_COUNT in the
script."
exitBackup 1
fi
# Last, backup the leader node to avoid synchronization issues on a restore.
backupsession[$leaderIndex]=`backupNode $leaderIndex`
teamBackup_log "Started backup ${backupsession[$leaderIndex]} on leader
${ipArr[$leaderIndex]}."
backup_complete=1
# Verify the backup on the leader node.
for (( k=0; k<$BACKUP_WAIT_COUNT; k++ )); do
sleep 10
verifyBackupStatus $leaderIndex
if [ $backup_complete -le 0 ]; then
teamBackup_log "Backup on the leader node completed successfully."