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

B #: Avoid fallocate failure if not supported (#1081)

This commit is contained in:
Christian González 2021-04-08 16:11:56 +02:00 committed by GitHub
parent 326c0f9aa2
commit ead26711f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 7 deletions

View File

@ -418,7 +418,7 @@ if [ "$TO" != "-" ]; then
convert_image
fi
fallocate -d "$TO"
fallocate -d "$TO" &> /dev/null || true # Avoid errors if fallocate not supported by FS
elif [ -n "$CONVERT" ]; then
convert_image

View File

@ -142,10 +142,10 @@ if [ -n "$BRIDGE_LIST" ]; then
DST_HOST=`get_destination_host $ID`
TMP_DST="$STAGING_DIR/$IMAGE_HASH"
multiline_exec_and_log "set -e -o pipefail; $COPY_COMMAND | $SSH $DST_HOST $DD of=$TMP_DST bs=${DD_BLOCK_SIZE:-64k}" \
multiline_exec_and_log "set -e -o pipefail; $COPY_COMMAND | $SSH $DST_HOST $DD of=$TMP_DST bs=${DD_BLOCK_SIZE:-64k} conv=sparse" \
"Error dumping $SRC to $DST_HOST:$TMP_DST"
ssh_exec_and_log "$DST_HOST" "set -e -o pipefail; mkdir -p $BASE_PATH; mv -f $TMP_DST $DST; fallocate -d $DST" \
ssh_exec_and_log "$DST_HOST" "set -e -o pipefail; mkdir -p $BASE_PATH; mv -f $TMP_DST $DST" \
"Error moving $TMP_DST to $DST in $DST_HOST"
if [ "x$CONVERT" = 'xyes' ] && [ -n "$DRIVER" ]; then
@ -162,7 +162,7 @@ else
multiline_exec_and_log "$CONVERT_CMD" "Error converting $DST"
fi
fallocate -d "$DST"
fallocate -d "$DST" &> /dev/null || true # Avoid errors if fallocate not supported by FS
FORMAT=$($QEMU_IMG info $DST | grep "^file format:" | awk '{print $3}' || :)
fi

View File

@ -80,10 +80,8 @@ if [ -n "$BRIDGE_LIST" ]; then
DST_HOST=`get_destination_host $ID`
CP_CMD="$UTILS_PATH/downloader.sh -n '${IMPORT_SOURCE}' -"
multiline_exec_and_log "set -e -o pipefail; $CP_CMD | $SSH ${DST_HOST} $DD of=${DST_PATH} bs=${DD_BLOCK_SIZE:-64k}" \
multiline_exec_and_log "set -e -o pipefail; $CP_CMD | $SSH ${DST_HOST} $DD of=${DST_PATH} bs=${DD_BLOCK_SIZE:-64k} conv=sparse" \
"Error dumping ${IMPORT_SOURCE} to ${DST_HOST}:${DST_PATH}"
ssh_exec_and_log "$DST_HOST" "fallocate -d $DST_PATH" "Error running: fallocate -d $DST_PATH"
else
CP_CMD="$UTILS_PATH/downloader.sh -n ${IMPORT_SOURCE} ${DST_PATH}"
exec_and_log "$CP_CMD" "Error copying ${IMPORT_SOURCE} to ${DST_PATH}"