summaryrefslogtreecommitdiffstats
path: root/autocluster
diff options
context:
space:
mode:
authorMartin Schwenke <martin@meltin.net>2012-05-07 13:54:46 +1000
committerMartin Schwenke <martin@meltin.net>2012-05-07 13:54:46 +1000
commitb3e3340a1e23360bf0efa4b8a1bd471dd31ac885 (patch)
tree5e47b71a2db28e7c9d36ef52c31049410108258d /autocluster
parentd8c144444949d4577315a533112f8f10d327b1b6 (diff)
downloadautocluster-b3e3340a1e23360bf0efa4b8a1bd471dd31ac885.tar.gz
autocluster-b3e3340a1e23360bf0efa4b8a1bd471dd31ac885.tar.xz
autocluster-b3e3340a1e23360bf0efa4b8a1bd471dd31ac885.zip
New option DISK_FOLLOW_SYMLINKS
If DISK_FOLLOW_SYMLINKS=yes then for any disk image paths that are a symlink, follow the symlink when creating the image. This allows disk images to be reorganised, perhaps across several disks, and replaced with symlinks. On the next cluster creation the symlinks will be respected and the layout of disk images will be maintained. Signed-off-by: Martin Schwenke <martin@meltin.net>
Diffstat (limited to 'autocluster')
-rwxr-xr-xautocluster21
1 files changed, 15 insertions, 6 deletions
diff --git a/autocluster b/autocluster
index f5fae9f..cec09e4 100755
--- a/autocluster
+++ b/autocluster
@@ -197,28 +197,32 @@ create_node_COMMON ()
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)
@@ -488,8 +492,13 @@ create_base() {
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