summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Schwenke <martin@meltin.net>2011-01-25 13:19:07 +1100
committerMartin Schwenke <martin@meltin.net>2011-01-25 13:19:07 +1100
commitee437676e7bb187e2ef8718e4427e2a78a3e1bee (patch)
tree1c9ca34e64c482d08bf0dc53ab8f85c7ad58be08
parent7725dfcadfa96fdbd1907324b314477456165e24 (diff)
Support new SYSTEM_DISK_FORMAT=reflink.
This is like raw but it copied using --reflink=always. This probably requires disk images to be on btrfs, so this is experimental. Signed-off-by: Martin Schwenke <martin@meltin.net>
-rwxr-xr-xautocluster15
-rw-r--r--config.d/00base.defconf2
2 files changed, 11 insertions, 6 deletions
diff --git a/autocluster b/autocluster
index e066c93..a86a20b 100755
--- a/autocluster
+++ b/autocluster
@@ -180,8 +180,8 @@ create_node_COMMON ()
local type="$3"
local template_file="${4:-$NODE_TEMPLATE}"
- if [ "$SYSTEM_DISK_FORMAT" = "raw" -a "$BASE_FORMAT" != "raw" ] ; then
- die "Error: if SYSTEM_DISK_FORMAT is \"raw\" then BASE_FORMAT must also be \"raw\"."
+ if [ "$SYSTEM_DISK_FORMAT" != "qcow2" -a "$BASE_FORMAT" = "qcow2" ] ; then
+ die "Error: if BASE_FORMAT is \"qcow2\" then SYSTEM_DISK_FORMAT must also be \"qcow2\"."
fi
IPNUM=$(($FIRSTIP + $ip_offset))
@@ -206,6 +206,11 @@ create_node_COMMON ()
cp -v --sparse=always "$base_disk" "$DISK"
create_node_configure_image "$DISK" "$type"
;;
+ reflink)
+ echo "Creating the disk..."
+ cp -v --reflink=always "$base_disk" "$DISK"
+ create_node_configure_image "$DISK" "$type"
+ ;;
none)
echo "Skipping disk image creation as requested"
;;
@@ -642,7 +647,7 @@ setup_image ()
device=$NBD_DEVICE
extra_mount_options=""
;;
- raw)
+ raw|reflink)
device="$disk"
extra_mount_options=",loop"
;;
@@ -657,7 +662,7 @@ cleanup_image ()
qcow2)
disconnect_nbd
;;
- raw)
+ raw|reflink)
:
;;
*)
@@ -1268,7 +1273,7 @@ trap 'es=$?;
# check for needed programs
check_command expect
-if [ "$SYSTEM_DISK_FORMAT" != "raw" ] ; then
+if [ "$SYSTEM_DISK_FORMAT" = "qcow2" ] ; then
check_command $QEMU_NBD
check_command nbd-client
fi
diff --git a/config.d/00base.defconf b/config.d/00base.defconf
index 24fcb4f..9085a79 100644
--- a/config.d/00base.defconf
+++ b/config.d/00base.defconf
@@ -86,7 +86,7 @@ defconf SYSTEM_DISK_CACHE "writeback" \
"default|none|writeback|writethrough" "system disk cache type"
defconf SYSTEM_DISK_FORMAT "qcow2" \
- "qcow2|raw|none" "system disk image format"
+ "qcow2|raw|reflink|none" "system disk image format"
system_disk_mounts ()
{