1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-21 14:50:08 +03:00

Shared and qcow2 drivers removes targets disks before creating new disks

This commit is contained in:
Ruben S. Montero 2016-10-13 11:16:26 +02:00
parent 1d613a98a9
commit 4f9a86bf23
3 changed files with 16 additions and 3 deletions

View File

@ -104,12 +104,21 @@ else
CLONE_CMD=$(cat <<EOF
cd $DST_DIR
rm -rf $DST_PATH{,.snap}
mkdir -p ${DST_PATH}.snap
rm -rf "${DST_PATH}.snap"
mkdir -p "${DST_PATH}.snap"
$QEMU_IMG create -b $SRC_PATH -f qcow2 $QCOW2_OPTIONS ${DST_PATH}.snap/0
rm -f "${DST_PATH}"
ln -s ${DST_FILE}.snap/0 ${DST_PATH}
cd ${DST_PATH}.snap
ln -s . ${DST_PATH}.snap/${DST_FILE}.snap
${RESIZE_CMD}
EOF
)

View File

@ -109,9 +109,12 @@ if [ -z "\${SNAP}" ]; then
ln -sf "$SRC_PATH" "$SNAP_DIR/0"
fi
rm -f "${DST_PATH}"
ln -sf "$SNAP_DIR/\$SNAP" "$DST_PATH"
$RM -rf "${DST_PATH}.snap"
rm -rf "${DST_PATH}.snap"
ln -sf "$SNAP_DIR" "${DST_PATH}.snap"
EOT
)

View File

@ -98,6 +98,7 @@ fi
log "Cloning $SRC_PATH in $DST"
CLONE_CMD="cd ${DST_DIR}; \
rm -f ${DST_PATH}; \
cp ${SRC_PATH} ${DST_PATH} \
${RESIZE_CMD}"