mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-21 14:50:08 +03:00
(cherry picked from commit 99ae8d3cdc111b6e9a2acb348874ce5d272c156c)
This commit is contained in:
parent
c6a065cf2f
commit
0003d1ceb1
@ -295,7 +295,30 @@ function get_rbd_cmd
|
||||
echo "ssh '$(esc_sq "$DST_HOST")' \"$RBD export '$(esc_sq "$SOURCE")' -\""
|
||||
}
|
||||
|
||||
TEMP=`getopt -o m:s:l:c:n -l md5:,sha1:,limit:,max-size:,nodecomp -- "$@"`
|
||||
# Compare 2 version strings using sort -V
|
||||
# Usage:
|
||||
# verlte "3.2.9" "3.4.0"
|
||||
function verlte() {
|
||||
[ "$1" = "`echo -e "$1\n$2" | sort -V | head -n1`" ]
|
||||
}
|
||||
|
||||
# Returns curl retry options based on its version
|
||||
function curl_retry_args {
|
||||
[ "$NO_RETRY" = "yes" ] && return
|
||||
|
||||
RETRY_ARGS="--retry 3 --retry-delay 3"
|
||||
|
||||
CURL_VER=`curl --version | grep -o 'curl [0-9\.]*' | awk '{print $2}'`
|
||||
|
||||
# To retry also on conn-reset-by-peer fresh curl is needed
|
||||
if verlte "7.71.0" "$CURL_VER"; then
|
||||
RETRY_ARGS+=" --retry-all-errors"
|
||||
fi
|
||||
|
||||
echo $RETRY_ARGS
|
||||
}
|
||||
|
||||
TEMP=`getopt -o m:s:l:c:n:o -l md5:,sha1:,limit:,max-size:,nodecomp,noretry -- "$@"`
|
||||
|
||||
if [ $? != 0 ] ; then
|
||||
echo "Arguments error" >&2
|
||||
@ -328,6 +351,10 @@ while true; do
|
||||
export MAX_SIZE="$2"
|
||||
shift 2
|
||||
;;
|
||||
-o|--noretry)
|
||||
export NO_RETRY="yes"
|
||||
shift
|
||||
;;
|
||||
--)
|
||||
shift
|
||||
break
|
||||
@ -349,7 +376,7 @@ else
|
||||
export HASH_FILE="/tmp/downloader.hash.$$"
|
||||
fi
|
||||
|
||||
GLOBAL_CURL_ARGS="--fail -sS -k -L"
|
||||
GLOBAL_CURL_ARGS="--fail -sS -k -L $(curl_retry_args)"
|
||||
|
||||
case "$FROM" in
|
||||
http://*|https://*)
|
||||
|
Loading…
x
Reference in New Issue
Block a user