mkdir -p $VIRTBASE/$CLUSTER tmp
- rm -f "$DISK"
+ local di="$DISK"
+ if [ "$DISK_FOLLOW_SYMLINKS" = "yes" -a -L "$DISK" ] ; then
+ di=$(readlink "$DISK")
+ fi
+ rm -f "$di"
case "$SYSTEM_DISK_FORMAT" in
qcow2)
echo "Creating the disk..."
- qemu-img create -b "$base_disk" -f qcow2 "$DISK"
+ qemu-img create -b "$base_disk" -f qcow2 "$di"
create_node_configure_image "$DISK" "$type"
;;
raw)
echo "Creating the disk..."
- cp -v --sparse=always "$base_disk" "$DISK"
+ cp -v --sparse=always "$base_disk" "$di"
create_node_configure_image "$DISK" "$type"
;;
reflink)
echo "Creating the disk..."
- cp -v --reflink=always "$base_disk" "$DISK"
+ cp -v --reflink=always "$base_disk" "$di"
create_node_configure_image "$DISK" "$type"
;;
mmclone)
echo "Creating the disk (using mmclone)..."
local base_snap="${base_disk}.snap"
[ -f "$base_snap" ] || mmclone snap "$base_disk" "$base_snap"
- mmclone copy "$base_snap" "$DISK"
+ mmclone copy "$base_snap" "$di"
create_node_configure_image "$DISK" "$type"
;;
none)
echo "Testing WEBPROXY $WEBPROXY"
test_proxy
+ local di="$DISK"
+ if [ "$DISK_FOLLOW_SYMLINKS" = "yes" -a -L "$DISK" ] ; then
+ di=$(readlink "$DISK")
+ fi
+
echo "Creating the disk"
- qemu-img create -f $BASE_FORMAT "$DISK" $DISKSIZE
+ qemu-img create -f $BASE_FORMAT "$di" $DISKSIZE
rm -rf tmp
mkdir -p mnt tmp tmp/ISO
defconf BASE_PER_NODE_TYPE "no" \
"<yes|no>" "Use per-node-type base images"
+defconf DISK_FOLLOW_SYMLINKS "no" \
+ "<yes|no>" "If disk images use symlinks then follow them to overwrite"
+
######################################################################
# Virtualisation
local i
for i in $(seq 1 $SHAREDDISK_COUNT); do
local f="$VIRTBASE/$CLUSTER/shared$i"
+ if [ "$DISK_FOLLOW_SYMLINKS" = "yes" -a -L "$f" ] ; then
+ f=$(readlink "$f")
+ fi
rm -f "$f"
if [ "$SHARED_DISK_TYPE" = "iscsi" ] ; then
dd if=/dev/zero seek=$SHAREDDISKSIZE bs=1 count=1 of="$f"
echo "Creating TSM server node $name"
create_node_COMMON "$name" "$ip_offset" "$type" "$TSM_TEMPLATE"
+ local di="$TSMDISK"
+ if [ "$DISK_FOLLOW_SYMLINKS" = "yes" -a -L "$TSMDISK" ] ; then
+ di=$(readlink "$TSMDISK")
+ fi
+
echo "Creating tsm disk"
- qemu-img create -f qcow2 "$TSMDISK" $TSMDISKSIZE
+ qemu-img create -f qcow2 "$di" $TSMDISKSIZE
echo
}