From ead26711f1611653ec40f565849b9ab373745a11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Gonz=C3=A1lez?= Date: Thu, 8 Apr 2021 16:11:56 +0200 Subject: [PATCH] B #: Avoid fallocate failure if not supported (#1081) --- src/datastore_mad/remotes/downloader.sh | 2 +- src/datastore_mad/remotes/fs/cp | 6 +++--- src/market_mad/remotes/http/import | 4 +--- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/datastore_mad/remotes/downloader.sh b/src/datastore_mad/remotes/downloader.sh index bed6e0307b..24fc8715e4 100755 --- a/src/datastore_mad/remotes/downloader.sh +++ b/src/datastore_mad/remotes/downloader.sh @@ -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 diff --git a/src/datastore_mad/remotes/fs/cp b/src/datastore_mad/remotes/fs/cp index 05499e37d6..828a35c7a6 100755 --- a/src/datastore_mad/remotes/fs/cp +++ b/src/datastore_mad/remotes/fs/cp @@ -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 diff --git a/src/market_mad/remotes/http/import b/src/market_mad/remotes/http/import index 3d06996b6e..3359f7870a 100755 --- a/src/market_mad/remotes/http/import +++ b/src/market_mad/remotes/http/import @@ -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}"