diff options
author | irina <irinagomez@us.es> | 2017-04-21 08:52:22 +0000 |
---|---|---|
committer | irina <irinagomez@us.es> | 2017-04-21 08:52:22 +0000 |
commit | 0dcf48ad78e304ff24764c332c4e7aaeca1c5e36 (patch) | |
tree | c07adb1335a3b5cd9bccc915bd9ee70c7f520447 | |
parent | 31ad04664ba58d8a75393c109b5f22b2dea0e253 (diff) |
#781 rama version 1.1: ogMcastRequest y ogMcastReceiverFile se salen con error si falla la transferencia multicast. updateCache, restoreImage y deployImage controlan estos errores.
git-svn-id: https://opengnsys.es/svn/branches/version1.1@5274 a21b9725-9963-47de-94b9-378ad31fedc9
-rwxr-xr-x | client/engine/Protocol.lib | 17 | ||||
-rwxr-xr-x | client/shared/scripts/deployImage | 7 | ||||
-rwxr-xr-x | client/shared/scripts/restoreImage | 7 | ||||
-rwxr-xr-x | client/shared/scripts/updateCache | 32 |
4 files changed, 34 insertions, 29 deletions
diff --git a/client/engine/Protocol.lib b/client/engine/Protocol.lib index 1be8ef70..fb4aea61 100755 --- a/client/engine/Protocol.lib +++ b/client/engine/Protocol.lib @@ -334,6 +334,9 @@ fi #@version 2.0 - cambios en udp-receiver para permitir multicast entre subredes #@author Juan Carlos Garcia, Universidad de Zaragoza #@date 2015/11/17 +#@version 1.1 - Control de errores en transferencia multicast (ticket #781) +#@author Irina Gomez, ETSII Universidad de Sevilla +#@date 2017/04/20 #*/ ## # @@ -465,12 +468,13 @@ do IPB=`echo "$IPB" | cut -c2-` IPBT=$IPBT$IPB done +MCASTWAIT=${MCASTWAIT:-120} REPOSUBRED=`echo $RIPBT | cut -c1-$MASCARA` CLIENTSUBRED=`echo $IPBT | cut -c1-$MASCARA` if [ $REPOSUBRED == $CLIENTSUBRED ]; then - SYNTAXCLIENT="udp-receiver $MBUFFER --portbase $PORTBASE" + SYNTAXCLIENT="udp-receiver $MBUFFER --portbase $PORTBASE --start-timeout $MCASTWAIT --receive-timeout $MCASTWAIT" else - SYNTAXCLIENT="udp-receiver $MBUFFER --portbase $PORTBASE --mcast-rdv-address $REPOIP" + SYNTAXCLIENT="udp-receiver $MBUFFER --portbase $PORTBASE --mcast-rdv-address $REPOIP --start-timeout $MCASTWAIT --receive-timeout $MCASTWAIT" fi @@ -646,7 +650,7 @@ then return $RETVAL else echo $COMMAND - eval $COMMAND || ogRaiseError $OG_ERR_MCASTRECEIVERFILE " "; return $? + eval $COMMAND || ogRaiseError $OG_ERR_MCASTRECEIVERFILE "$TARGETFILE"; return $? #[ -s "$LOGFILE" ] || return 21 fi } @@ -767,6 +771,9 @@ fi #@version 1.0.5 #@author Antonio Doblas Viso, Universidad de Málaga #@date 2012/05/29 +#@version 1.1 - Control de errores en transferencia multicast (ticket #781) +#@author Irina Gomez, ETSII Universidad de Sevilla +#@date 2017/04/20 #*/ ## function ogMcastRequest { # Variables locales @@ -784,12 +791,12 @@ REPOPORTAUX=2009 REPEAT=0 until nmap -n -sU -p $PORTAUX $REPOIP | grep open do + let REPEAT=$REPEAT+1 + [ "$REPEAT" -lt 6 ] || ogRaiseError session log $OG_ERR_PROTOCOLJOINMASTER "MULTICAST \"$FILE\" \"$PROTOOPT\" $FILELIST" || return $? echo "$MSG_SCRIPTS_TASK_START : hose $REPOIP $REPOPORTAUX --out sh -c "echo -ne START_MULTICAST $1 $2"" #update-cache: hose $REPOIP $REPOPORTAUX --out sh -c "echo -ne START_MULTICAST "$FILE" "$PROTOOPT"" #multicas-direct: hose $REPOIP 2009 --out sh -c "echo -ne START_MULTICAST /$IMAGE.img $OPTPROTOCOLO" - let REPEAT=$REPEAT+1 - [ "$REPEAT" -eq 5 ] && return sleep 10 done } diff --git a/client/shared/scripts/deployImage b/client/shared/scripts/deployImage index 821d1e3d..88e990fe 100755 --- a/client/shared/scripts/deployImage +++ b/client/shared/scripts/deployImage @@ -34,6 +34,9 @@ #@version 1.1 - Cambio de repositorio para el recurso remoto images si es necesario #@author Irina Gomez, ETSII Universidad de Sevilla #@date 2015-06-16 +#@version 1.1 - Control de errores en transferencia multicast (ticket #781) +#@author Irina Gomez, ETSII Universidad de Sevilla +#@date 2017/04/20 #**/ @@ -150,6 +153,10 @@ case "$MODE" in ;; esac # del RESTOREPROTOCOLNOTCACHE ;; + 57|60) + # Time-out en la transferencia multicast (El mensaje de error está enviado) + exit $RETVAL + ;; esac ;; *) # Error: protocolo desconocido. diff --git a/client/shared/scripts/restoreImage b/client/shared/scripts/restoreImage index 0f5317df..c73f1810 100755 --- a/client/shared/scripts/restoreImage +++ b/client/shared/scripts/restoreImage @@ -11,9 +11,14 @@ #@exception OG_ERR_FORMAT 1 formato incorrecto. #@exception OG_ERR_NOTFOUND 2 cambio de repositorio: repositorio no encontrado #@exception OG_ERR_NOTFOUND 2 fichero de imagen o partición no detectados. +#@exception $OG_ERR_MCASTRECEIVERFILE 57 Error en la recepción Multicast de un fichero +#@exception $OG_ERR_PROTOCOLJOINMASTER 60 Error en la conexión de una sesión Unicast|Multicast con el Master #@version 1.1 - Cambio de repositorio para el recurso remoto images si es necesario #@author Irina Gomez, ETSII Universidad de Sevilla #@date 2015-06-16 +#@version 1.1 - Control de errores en transferencia multicast (ticket #781) +#@author Irina Gomez, ETSII Universidad de Sevilla +#@date 2017/04/20 #**/ TIME1=$SECONDS @@ -80,7 +85,7 @@ case "$PROTO" in COMPRESS=$(ogGetImageCompressor REPO $IMGNAME) #TODO comprobar parametros anteriores ogEcho log session "[40] ogMcastReceiverPartition $DISK $PART $PORT $TOOL $COMPRESS" - ogMcastRequest "$OGUNIT$IMGNAME.img" "$PROTOOPT" + ogMcastRequest "$OGUNIT$IMGNAME.img" "$PROTOOPT" || exit $? ogExecAndLog command ogMcastReceiverPartition "$DISK" "$PART" "$PORT" "$TOOL" "$COMPRESS" RETVAL=$? ;; diff --git a/client/shared/scripts/updateCache b/client/shared/scripts/updateCache index e7e1dfe8..5815f9cb 100755 --- a/client/shared/scripts/updateCache +++ b/client/shared/scripts/updateCache @@ -12,6 +12,8 @@ #@exception OG_ERR_FORMAT formato incorrecto. #@exception OG_ERR_NOTCACHE No existe cache -15- #@exception $OG_ERR_CACHESIZE Tamaño de la paticion menor al archivo a descargar -16- +#@exception $OG_ERR_MCASTRECEIVERFILE Error en la recepción Multicast de un fichero -57- +#@exception $OG_ERR_PROTOCOLJOINMASTER Error en la conexión de una sesión Unicast|Multicast con el Master -60- #@note #@todo: #@version 0.9.1 - integracion EAC @@ -30,6 +32,9 @@ #@version 1.1 - Cambio de repositorio para el recurso remoto images si es necesario #@author Irina Gomez, ETSII Universidad de Sevilla #@date 2015-06-16 +#@version 1.1 - Control de errores en transferencia multicast (ticket #781) +#@author Irina Gomez, ETSII Universidad de Sevilla +#@date 2017/04/20 #*/ ## PROG="$(basename $0)" @@ -205,34 +210,15 @@ case "$PROTOCOLO" in fi ;; MULTICAST) - PORT=$(echo $OPTPROTOCOLO | cut -f1 -d":") - let PORTAUX=$PORT+1 ogEcho log session "$MSG_SCRIPTS_UPDATECACHE_CHECKMCASTSESSION : $REPOIP:$PORTAUX:$PORT" #TODO: ticket 379 NUMBER=$[ ( $RANDOM % 30 ) + 1 ] sleep $NUMBER #FIN TODO - if (nmap -n -sU -p $PORTAUX $REPOIP | grep open) - then - ogExecAndLog command ogMcastReceiverFile $PORT CACHE "$2" - - else - # TODO ticket 379 Realizar la petición basada en identificador de operacion - ogEcho log session "$MSG_SCRIPTS_TASK_START : hose $REPOIP 2009 --out sh -c \"echo -ne START_MULTICAST $OGUNIT$2 $OPTPROTOCOLO\"" - hose $REPOIP 2009 --out sh -c "echo -ne START_MULTICAST $OGUNIT$2 $OPTPROTOCOLO" - #echo "espero y llamo a: ogMcastReceiverFile $PORT CACHE $2" - sleep 10 - if (nmap -n -sU -p $PORTAUX $REPOIP | grep open) - then - ogExecAndLog command ogMcastReceiverFile $PORT CACHE "$2" - else - ogEcho log session "$MSG_SCRIPTS_TASK_ERR : hose $REPOIP 2009 --out sh -c echo -ne START_MULTICAST $OGUNIT$2 $OPTPROTOCOLO" - exit $OG_ERR_UPDATECACHE - fi - fi - #cat $OGLOGCOMMAND.tmp | grep -B1 "Transfer complete" - sleep 5 - #cat $OGLOGCOMMAND.tmp | grep -B1 "Transfer complete" + ogEcho log session ogMcastRequest "$2" $OPTPROTOCOLO + ogExecAndLog command ogMcastRequest "$2" $OPTPROTOCOLO || exit $? + ogEcho log session ogMcastReceiverFile ${OPTPROTOCOLO%%:*} CACHE "$2" + ogExecAndLog command ogMcastReceiverFile ${OPTPROTOCOLO%%:*} CACHE "$2" || exit $? RESUMEUPDATECACHE=$(grep -m 1 -B1 "Transfer complete" $OGLOGCOMMAND.tmp) ;; UNICAST) |