|
|
|
@ -59,9 +59,13 @@ ENABLE_VM_SERVICES=false
|
|
|
|
|
FILESYSTEM="ext4"
|
|
|
|
|
SYSTEMD=false
|
|
|
|
|
|
|
|
|
|
if [ -L /sys/block/vda ] ; then
|
|
|
|
|
# if TARGET_DISK environment variable is set accept it
|
|
|
|
|
if [ -n "$TARGET_DISK" ] ; then
|
|
|
|
|
export DISK="${TARGET_DISK}"
|
|
|
|
|
else # otherwise try to find sane default
|
|
|
|
|
if [ -L /sys/block/vda ] ; then
|
|
|
|
|
export DISK=vda # will be configured as /dev/vda
|
|
|
|
|
else
|
|
|
|
|
else
|
|
|
|
|
# in some cases, sda is not the HDD, but the CDROM,
|
|
|
|
|
# so better walk through all devices.
|
|
|
|
|
for i in /sys/block/sd*; do
|
|
|
|
@ -70,6 +74,7 @@ else
|
|
|
|
|
break
|
|
|
|
|
fi
|
|
|
|
|
done
|
|
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
### helper functions {{{
|
|
|
|
@ -754,13 +759,16 @@ check_for_supported_disk() {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# run in according environment only
|
|
|
|
|
if [[ $(imvirt 2>/dev/null) == "Physical" ]] ; then
|
|
|
|
|
if [ -n "$TARGET_DISK" ] ; then
|
|
|
|
|
logit "Skipping check for supported disk as TARGET_DISK variable is set."
|
|
|
|
|
else
|
|
|
|
|
if [[ $(imvirt 2>/dev/null) == "Physical" ]] ; then
|
|
|
|
|
|
|
|
|
|
if ! check_for_supported_disk ; then
|
|
|
|
|
die "Error: /dev/${DISK} does not look like a VirtIO, ServeRAID, LSILOGIC or PowerEdge disk/controller. Exiting to avoid possible data damage."
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
else
|
|
|
|
|
else
|
|
|
|
|
# make sure it runs only within qemu/kvm
|
|
|
|
|
if [[ "$DISK" == "vda" ]] && readlink -f /sys/block/vda/device | grep -q 'virtio' ; then
|
|
|
|
|
echo "Looks like a virtio disk, ok."
|
|
|
|
@ -773,6 +781,7 @@ else
|
|
|
|
|
else
|
|
|
|
|
die "Error: /dev/${DISK} does not look like a virtual disk. Exiting to avoid possible data damage. Note: imvirt output is $(imvirt)"
|
|
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
# relevant only while deployment, will be overriden later
|
|
|
|
|