Skip to content

Commit

Permalink
F OpenNebula#5441: Allow disabling fallocate for fs DS_MAD (OpenNebul…
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian González authored and atodorov-storpool committed Aug 3, 2021
1 parent dd7f9ba commit 767c80e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 0 additions & 2 deletions src/datastore_mad/remotes/downloader.sh
Expand Up @@ -495,8 +495,6 @@ if [ "$TO" != "-" ]; then
convert_image
fi

fallocate -d "$TO" &> /dev/null || true # Avoid errors if fallocate not supported by FS

elif [ -n "$CONVERT" ]; then
convert_image
fi
8 changes: 6 additions & 2 deletions src/datastore_mad/remotes/fs/cp
Expand Up @@ -64,7 +64,8 @@ done < <($XPATH /DS_DRIVER_ACTION_DATA/DATASTORE/BASE_PATH \
/DS_DRIVER_ACTION_DATA/DATASTORE/TEMPLATE/CONVERT \
/DS_DRIVER_ACTION_DATA/DATASTORE/TEMPLATE/DRIVER \
/DS_DRIVER_ACTION_DATA/IMAGE/TYPE \
/DS_DRIVER_ACTION_DATA/IMAGE/TEMPLATE/URL_ARGS)
/DS_DRIVER_ACTION_DATA/IMAGE/TEMPLATE/URL_ARGS \
/DS_DRIVER_ACTION_DATA/DATASTORE/TEMPLATE/SPARSE)

unset i

Expand All @@ -83,6 +84,7 @@ CONVERT="${XPATH_ELEMENTS[i++]:-yes}"
DRIVER="${XPATH_ELEMENTS[i++]}"
IMAGE_TYPE="${XPATH_ELEMENTS[i++]}"
URL_ARGS="${XPATH_ELEMENTS[i++]}"
SPARSE="${XPATH_ELEMENTS[i++]}"

DST=`generate_image_path`
IMAGE_HASH=`basename $DST`
Expand Down Expand Up @@ -168,7 +170,9 @@ else
multiline_exec_and_log "$CONVERT_CMD" "Error converting $DST"
fi

fallocate -d "$DST" &> /dev/null || true # Avoid errors if fallocate not supported by FS
if [ "$(echo "$SPARSE" | tr A-Z a-z)" != "no" ]; then
fallocate -d "$DST" &> /dev/null || true # Avoid errors if fallocate not supported by FS
fi

FORMAT=$($QEMU_IMG info $DST | grep "^file format:" | awk '{print $3}' || :)
fi
Expand Down

0 comments on commit 767c80e

Please sign in to comment.