mirror of
https://github.com/vdsm/virtual-dsm.git
synced 2025-07-03 22:16:09 +08:00
Make allocation method configurable
This commit is contained in:
parent
5a679550da
commit
eaf7a3b89c
20
run/disk.sh
20
run/disk.sh
@ -65,9 +65,18 @@ if [ ! -f "${DATA}" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Create an empty file
|
# Create an empty file
|
||||||
if ! fallocate -l "${DATA_SIZE}" "${DATA}"; then
|
|
||||||
rm -f "${DATA}"
|
if [ "$ALLOCATE" != "Y" ]; then
|
||||||
echo "ERROR: Could not allocate file for virtual disk." && exit 87
|
|
||||||
|
truncate -s "${DATA_SIZE}" "${DATA}"
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
|
if ! fallocate -l "${DATA_SIZE}" "${DATA}"; then
|
||||||
|
rm -f "${DATA}"
|
||||||
|
echo "ERROR: Could not allocate file for virtual disk." && exit 87
|
||||||
|
fi
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check if file exists
|
# Check if file exists
|
||||||
@ -80,12 +89,11 @@ if [ ! -f "${DATA}" ]; then
|
|||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
AGENT_VERSION=1
|
|
||||||
AGENT="${STORAGE}/${BASE}.agent"
|
AGENT="${STORAGE}/${BASE}.agent"
|
||||||
[ -f "$AGENT" ] && AGENT_VERSION=$(cat "${AGENT}")
|
[ -f "$AGENT" ] && AGENT_VERSION=$(cat "${AGENT}") || AGENT_VERSION=1
|
||||||
|
|
||||||
if ((AGENT_VERSION < 5)); then
|
if ((AGENT_VERSION < 5)); then
|
||||||
echo "INFO: The installed VirtualDSM Agent is an outdated version, please upgrade it."
|
echo "INFO: The installed VirtualDSM Agent v${AGENT_VERSION} is an outdated version, please upgrade it."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
KVM_DISK_OPTS="\
|
KVM_DISK_OPTS="\
|
||||||
|
Loading…
x
Reference in New Issue
Block a user