EasyManua.ls Logo

HP HPE VAN SDN Controller 2.7 - Page 208

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...
fi
uuidURL="https://${restoreIpArr[$i]}:8443/sdn/v2.0/systems"
restoreUUID[$i]='get ${restoreIpArr[$i]} ${restoreAuth[$i]} "$uuidURL"'
if [ "${restoreUUID[$i]}" == "" ]; then
teamBackup_log "Failed to get the UUID for ${restoreIpArr[$i]}, can't start restore."
exitBackup 1
fi
restoreUUID[$i]='extractJSONString "${restoreUUID[$i]}" "uid" | sed '/^$/d''
teamBackup_log "UUID for ${restoreIpArr[$i]} is ${restoreUUID[$i]}"
# Upload the backup files to a specific node.
local ipFileName="sdn_controller_backup_${restoreIpArr[$i]}*.zip"
local zipFile='ls $RESTORE_BACKUP_FILESET/$ipFileName'
upload_backup_file ${restoreIpArr[$i]} ${restoreUUID[$i]} \
${restoreAuth[$i]} $zipFile
# Check if this is the leader node from the backup set.
local leaderZip='echo $zipFile|grep "Leader"'
[ "$leaderZip" != "" ] && leaderIndex=$I
done
# Start restore in the leader node first before all the other nodes.
if [ $leaderIndex -ne -1 ]; then
restore_node ${restoreIpArr[$leaderIndex]} ${restoreUUID[$leaderIndex]} \
${restoreAuth[$leaderIndex]}
fi
# Verify the leader node is up after the restore.
validate_node_status ${restoreIpArr[$leaderIndex]}
# Continue restore on the remaining nodes.
for (( i=0; i<$numNodes; i++ )); do
# Skip the leader node; it's already done.
[ $i -eq $leaderIndex ] && continue
# Restore the specified node.
restore_node ${restoreIpArr[$i]} ${restoreUUID[$i]} ${restoreAuth[$i]}
done
sleep 200
# Validate that the restored nodes are up.
for (( n=0; n<$numNodes; n++ )); do
# Skip the leader node; it's already done.
[ $n -eq $leaderIndex ] && continue
validate_node_status ${restoreIpArr[$n]}
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 {
[ $1 -ne 0 ] && teamBackup_log "Stopping backup/restore with errors."
rm -rf $TEAM_BACKUP_STATUS_FILE
kill -s TERM $B_PID
exit $1
}
#------------------------------------------------------------------------------
# Function get ( <ipAddr> <authToken> <url> )
# Performs a GET.
#------------------------------------------------------------------------------
function get {
local getIP=$1
local getToken=$2
local getUrl=$3
local attempts=0
while [ $attempts -lt 5 ]; do
curl --noproxy $getIP --header "X-Auth-Token:$getToken" \
--fail -ksS -L -f --request GET --url "$getUrl"
errorCode=$
?
let "attempts = $attempts + 1"
if [ 35 -eq $errorCode ]; then
teamBackup_log "SSL error on GET of $getUrl, retrying..."
continue;
fi
break;
done
}
#------------------------------------------------------------------------------
# Function post ( <ipAddr> <authToken> <url> <data>)
# Performs a POST of the specified data.
#------------------------------------------------------------------------------
function post {
local postIP=$1
local postToken=$2
local postUrl=$3
local postData=$4
local attempts=0
while [ $attempts -lt 5 ]; do
postRes='curl --noproxy $postIP --header "X-Auth-Token:$postToken" \
--fail -ksS --request POST --url "$postUrl" --data-binary "$postData"'
208 Scripts

Table of Contents

Related product manuals