Feature #2556: Refactor Vladislav Gorbunov's contribution

This commit is contained in:
Jaime Melis committed 2014-02-07 12:17:00 +01:00
1 parent d1dc27167f
commit 7ca6b0d78a
1 file changed
+11 -11
+11 -11
View File
@@ -88,9 +88,6 @@ if [ "$FSTYPE" = "save_as" ]; then
exit 0
fi
if [ "$FSTYPE" = "raw" ]; then
REGISTER_CMD="$QEMU_IMG create rbd:$RBD_SOURCE ${SIZE}M"
else
# ------------ Create the image in the repository ------------
MKFS_CMD=`mkfs_command $TMP_DST $FSTYPE $SIZE`
@@ -99,18 +96,21 @@ REGISTER_CMD=$(cat <<EOF
set -e
export PATH=/usr/sbin:/sbin:\$PATH
# create and format
$DD if=/dev/zero of=$TMP_DST bs=1 count=1 seek=${SIZE}M
$MKFS_CMD
if [ "$FSTYPE" = "raw" ]; then
$QEMU_IMG create rbd:$RBD_SOURCE ${SIZE}M
else
# create and format
$DD if=/dev/zero of=$TMP_DST bs=1 count=1 seek=${SIZE}M
$MKFS_CMD
# create rbd
$QEMU_IMG convert $QEMU_IMG_CONVERT_ARGS $TMP_DST rbd:$RBD_SOURCE
# create rbd
$QEMU_IMG convert $QEMU_IMG_CONVERT_ARGS $TMP_DST rbd:$RBD_SOURCE
# remove original
$RM -f $TMP_DST
# remove original
$RM -f $TMP_DST
fi
EOF
)
fi
ssh_exec_and_log "$DST_HOST" "$REGISTER_CMD" \
"Error registering $RBD_SOURCE in $DST_HOST"