1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-22 18:50:08 +03:00

feature #575: added error messages to tm ssh and nfs

This commit is contained in:
Javi Fontan 2011-04-27 12:53:10 +02:00
parent f41f12f190
commit 0513a98094
13 changed files with 68 additions and 38 deletions

View File

@ -34,8 +34,8 @@ DST_PATH=`arg_path $DST`
fix_paths
log "$1 $2"
log "DST: $DST_PATH"
log_debug "$1 $2"
log_debug "DST: $DST_PATH"
DST_DIR=`dirname $DST_PATH`
@ -46,12 +46,14 @@ exec_and_log "chmod a+w $DST_DIR"
case $SRC in
http://*)
log "Downloading $SRC"
exec_and_log "$WGET -O $DST_PATH $SRC"
exec_and_log "$WGET -O $DST_PATH $SRC" \
"Error downloading $SRC"
;;
*)
log "Cloning $SRC_PATH"
exec_and_log "cp -r $SRC_PATH $DST_PATH"
exec_and_log "cp -r $SRC_PATH $DST_PATH" \
"Error copying $SRC to $DST"
;;
esac

View File

@ -48,16 +48,19 @@ exec_and_log "mkdir -p $ISO_DIR"
for f in $SRC; do
case $f in
http://*)
exec_and_log "$WGET -O $ISO_DIR $f"
exec_and_log "$WGET -O $ISO_DIR $f" \
"Error downloading $f"
;;
*)
exec_and_log "cp -R $f $ISO_DIR"
exec_and_log "cp -R $f $ISO_DIR" \
"Error copying $f to $ISO_DIR"
;;
esac
done
exec_and_log "$MKISOFS -o $DST_PATH -J -R $ISO_DIR"
exec_and_log "$MKISOFS -o $DST_PATH -J -R $ISO_DIR" \
"Error creating iso fs"
exec_and_log "rm -rf $ISO_DIR"

View File

@ -34,4 +34,5 @@ SRC_PATH=`arg_path $SRC`
fix_src_path
log "Deleting $SRC_PATH"
exec_and_log "rm -rf $SRC_PATH"
exec_and_log "rm -rf $SRC_PATH" \
"Error deleting $SRC_PATH"

View File

@ -37,7 +37,8 @@ fix_dst_path
DST_DIR=`dirname $DST_PATH`
log "Creating directory $DST_DIR"
exec_and_log "mkdir -p $DST_DIR"
exec_and_log "mkdir -p $DST_DIR" \
"Could not create directory $DST_DIR"
exec_and_log "chmod a+w $DST_DIR"
log "Link $SRC_PATH"

View File

@ -36,8 +36,11 @@ fix_dst_path
DST_DIR=`dirname $DST_PATH`
exec_and_log "mkdir -p $DST_DIR"
exec_and_log "$DD if=/dev/zero of=$DST_PATH bs=1 count=1 seek=${SIZE}M"
exec_and_log "$MKFS -t $FSTYPE -F $DST_PATH"
exec_and_log "mkdir -p $DST_DIR" \
"Error creating directory $DST_DIR"
exec_and_log "$DD if=/dev/zero of=$DST_PATH bs=1 count=1 seek=${SIZE}M" \
"Could not create image $DST_PATH"
exec_and_log "$MKFS -t $FSTYPE -F $DST_PATH" \
"Unable to create filesystem $FSTYPE in $DST_PATH"
exec_and_log "chmod a+rw $DST_PATH"

View File

@ -35,15 +35,17 @@ fix_dst_path
DST_DIR=`dirname $DST_PATH`
log "Creating directory $DST_DIR"
log_debug "Creating directory $DST_DIR"
exec_and_log "mkdir -p $DST_DIR"
exec_and_log "chmod a+w $DST_DIR"
log "Creating ${SIZE}Mb image in $DST_PATH"
exec_and_log "$DD if=/dev/zero of=$DST_PATH bs=1 count=1 seek=${SIZE}M"
log_debug "Creating ${SIZE}Mb image in $DST_PATH"
exec_and_log "$DD if=/dev/zero of=$DST_PATH bs=1 count=1 seek=${SIZE}M" \
"Could not create image file $DST_PATH"
log "Initializing swap space"
exec_and_log "$MKSWAP $DST_PATH"
log_debug "Initializing swap space"
exec_and_log "$MKSWAP $DST_PATH" \
"Could not create swap on $DST_PATH"
exec_and_log "chmod a+w $DST_PATH"

View File

@ -43,7 +43,8 @@ else
log "Will not move, is not saving image"
else
log "Moving $SRC_PATH"
exec_and_log "mv $SRC_PATH $DST_PATH"
exec_and_log "mv $SRC_PATH $DST_PATH" \
"Could not move $SRC_PATH to $DST_PATH"
fi
fi

View File

@ -34,23 +34,26 @@ SRC_HOST=`arg_host $SRC`
DST_HOST=`arg_host $DST`
log "$1 $2"
log "DST: $DST_PATH"
log_debug "$1 $2"
log_debug "DST: $DST_PATH"
DST_DIR=`dirname $DST_PATH`
log "Creating directory $DST_DIR"
exec_and_log "$SSH $DST_HOST mkdir -p $DST_DIR"
exec_and_log "$SSH $DST_HOST mkdir -p $DST_DIR" \
"Error creating directory $DST_DIR"
case $SRC in
http://*)
log "Downloading $SRC"
exec_and_log "$SSH $DST_HOST $WGET -O $DST_PATH $SRC"
exec_and_log "$SSH $DST_HOST $WGET -O $DST_PATH $SRC" \
"Error downloading $SRC"
;;
*)
log "Cloning $SRC"
exec_and_log "$SCP $SRC $DST"
exec_and_log "$SCP $SRC $DST" \
"Error copying $SRC to $DST"
;;
esac

View File

@ -47,21 +47,27 @@ fi
ISO_DIR="$TMP_DIR/isofiles"
exec_and_log "mkdir -p $ISO_DIR"
exec_and_log "mkdir -p $ISO_DIR" \
"Error creating directory $ISO_DIR"
for f in $SRC; do
case $f in
http://*)
exec_and_log "$WGET -O $ISO_DIR $f"
exec_and_log "$WGET -O $ISO_DIR $f" \
"Error downloading $f"
;;
*)
exec_and_log "cp -R $f $ISO_DIR"
exec_and_log "cp -R $f $ISO_DIR" \
"Error copying $f to $ISO_DIR"
;;
esac
done
exec_and_log "$MKISOFS -o $TMP_DIR/$DST_FILE -J -R $ISO_DIR"
exec_and_log "$SCP $TMP_DIR/$DST_FILE $DST"
exec_and_log "rm -rf $TMP_DIR"
exec_and_log "$MKISOFS -o $TMP_DIR/$DST_FILE -J -R $ISO_DIR" \
"Error creating iso fs"
exec_and_log "$SCP $TMP_DIR/$DST_FILE $DST" \
"Error copying $TMP_DIR/$DST_FILE to $DST"
exec_and_log "rm -rf $TMP_DIR" \
"Error deleting $TMP_DIR"

View File

@ -31,4 +31,5 @@ SRC_PATH=`arg_path $SRC`
SRC_HOST=`arg_host $SRC`
log "Deleting $SRC_PATH"
exec_and_log "$SSH $SRC_HOST rm -rf $SRC_PATH"
exec_and_log "$SSH $SRC_HOST rm -rf $SRC_PATH" \
"Error deleting $SRC_PATH"

View File

@ -32,7 +32,10 @@ DST_PATH=`arg_path $DST`
DST_HOST=`arg_host $DST`
DST_DIR=`dirname $DST_PATH`
exec_and_log "$SSH $DST_HOST mkdir -p $DST_DIR"
exec_and_log "$SSH $DST_HOST $DD if=/dev/zero of=$DST_PATH bs=1 count=1 seek=${SIZE}M"
exec_and_log "$SSH $DST_HOST $MKFS -t $FSTYPE -F $DST_PATH"
exec_and_log "$SSH $DST_HOST chmod a+rw $DST_PATH"
exec_and_log "$SSH $DST_HOST mkdir -p $DST_DIR" \
"Error creating directory $DST_DIR"
exec_and_log "$SSH $DST_HOST $DD if=/dev/zero of=$DST_PATH bs=1 count=1 seek=${SIZE}M" \
"Could not create image $DST_PATH"
exec_and_log "$SSH $DST_HOST $MKFS -t $FSTYPE -F $DST_PATH" \
"Unable to create filesystem $FSTYPE in $DST_PATH"
exec_and_log "$SSH $DST_HOST chmod a+rw $DST_PATH"

View File

@ -34,10 +34,12 @@ DST_DIR=`dirname $DST_PATH`
log "Creating ${SIZE}Mb image in $DST_PATH"
exec_and_log "$SSH $DST_HOST mkdir -p $DST_DIR"
exec_and_log "$SSH $DST_HOST $DD if=/dev/zero of=$DST_PATH bs=1 count=1 seek=${SIZE}M"
exec_and_log "$SSH $DST_HOST $DD if=/dev/zero of=$DST_PATH bs=1 count=1 seek=${SIZE}M" \
"Could not create image file $DST_PATH"
log "Initializing swap space"
exec_and_log "$SSH $DST_HOST $MKSWAP $DST_PATH"
exec_and_log "$SSH $DST_HOST $MKSWAP $DST_PATH" \
"Could not create swap on $DST_PATH"
exec_and_log "$SSH $DST_HOST chmod a+w $DST_PATH"

View File

@ -36,6 +36,8 @@ DST_HOST=`arg_host $DST`
DST_DIR=`dirname $DST_PATH`
log "Moving $SRC_PATH"
exec_and_log "$SSH $DST_HOST mkdir -p $DST_DIR"
exec_and_log "$SCP -r $SRC $DST"
exec_and_log "$SSH $DST_HOST mkdir -p $DST_DIR" \
"Unable to create directory $DST_DIR"
exec_and_log "$SCP -r $SRC $DST" \
"Could not copy $SRC to $DST"
exec_and_log "$SSH $SRC_HOST rm -rf $SRC_PATH"