mirror of
https://github.com/OpenNebula/one.git
synced 2026-11-19 11:22:55 +09:00
Revert "bug #1822: delete isofiles dir on iso creation failure"
This reverts commit7e51d3f9ac. Reverted to apply2fbfbee9instead
This commit is contained in:
1 parent
7e51d3f9ac
commit
ee083475c6
1 file changed
+5
-35
@@ -38,31 +38,6 @@ fi
|
||||
|
||||
. $TMCOMMON
|
||||
|
||||
function exec_and_set_error
|
||||
{
|
||||
message=$2
|
||||
|
||||
EXEC_LOG_ERR=`$1 2>&1 1>/dev/null`
|
||||
EXEC_LOG_RC=$?
|
||||
|
||||
if [ $EXEC_LOG_RC -ne 0 ]; then
|
||||
log_error "Command \"$1\" failed: $EXEC_LOG_ERR"
|
||||
|
||||
if [ -n "$2" ]; then
|
||||
export ERROR="$2"
|
||||
else
|
||||
export ERROR="Error executing $1: $EXEC_LOG_ERR"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
function exit_error
|
||||
{
|
||||
error_message "$ERROR"
|
||||
rm -rf $ISO_DIR > /dev/null 2>&1
|
||||
exit -1
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Set dst path and dirs
|
||||
#-------------------------------------------------------------------------------
|
||||
@@ -81,27 +56,22 @@ VM_ID=`basename $DST_DIR`
|
||||
ISO_DIR="$DS_DIR/.isofiles/$VM_ID"
|
||||
ISO_FILE="$ISO_DIR/$VM_ID.iso"
|
||||
|
||||
exec_and_set_error "mkdir -p $ISO_DIR" "Could not create tmp dir to make context dev"
|
||||
[ -n "$ERROR" ] && exit_error
|
||||
exec_and_log "mkdir -p $ISO_DIR" "Could not create tmp dir to make context dev"
|
||||
|
||||
for f in $SRC; do
|
||||
case $f in
|
||||
http://*)
|
||||
exec_and_set_error "$WGET -P $ISO_DIR $f" "Error downloading $f"
|
||||
exec_and_log "$WGET -P $ISO_DIR $f" "Error downloading $f"
|
||||
;;
|
||||
*)
|
||||
exec_and_set_error "cp -R $f $ISO_DIR" "Error copying $f to $ISO_DIR"
|
||||
exec_and_log "cp -R $f $ISO_DIR" "Error copying $f to $ISO_DIR"
|
||||
;;
|
||||
esac
|
||||
|
||||
[ -n "$ERROR" ] && exit_error
|
||||
done
|
||||
|
||||
exec_and_set_error "$MKISOFS -o $ISO_FILE -J -R $ISO_DIR" "Error creating iso fs"
|
||||
[ -n "$ERROR" ] && exit_error
|
||||
exec_and_log "$MKISOFS -o $ISO_FILE -J -R $ISO_DIR" "Error creating iso fs"
|
||||
|
||||
exec_and_set_error "$SCP $ISO_FILE $DST" "Error copying context ISO to $DST"
|
||||
[ -n "$ERROR" ] && exit_error
|
||||
exec_and_log "$SCP $ISO_FILE $DST" "Error copying context ISO to $DST"
|
||||
|
||||
# Creates symbolic link to add a .iso suffix, needed for VMware CDROMs
|
||||
ssh_exec_and_log $DST_HOST "$LN -s $DST_PATH $DST_PATH.iso" "Error creating ISO symbolic link"
|
||||
|
||||
Reference in new issue
Block a user