mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-30 22:50:10 +03:00
* Datastores (fs/shared) can set QCOW2_STANDALONE to create disk images without backing files. This will increase clone times but will not have any dependencies.
This commit is contained in:
parent
45f28e15d3
commit
8f1d95040c
@ -1077,6 +1077,7 @@ INHERIT_DATASTORE_ATTR = "GLUSTER_VOLUME"
|
||||
|
||||
INHERIT_DATASTORE_ATTR = "DISK_TYPE"
|
||||
INHERIT_DATASTORE_ATTR = "ALLOW_ORPHANS"
|
||||
INHERIT_DATASTORE_ATTR = "QCOW2_STANDALONE"
|
||||
|
||||
INHERIT_DATASTORE_ATTR = "VCENTER_ADAPTER_TYPE"
|
||||
INHERIT_DATASTORE_ATTR = "VCENTER_DISK_TYPE"
|
||||
|
@ -67,11 +67,13 @@ while IFS= read -r -d '' element; do
|
||||
done < <(onevm show -x $VMID| $XPATH \
|
||||
/VM/TEMPLATE/DISK\[DISK_ID=$DISK_ID\]/SIZE \
|
||||
/VM/TEMPLATE/DISK\[DISK_ID=$DISK_ID\]/FORMAT \
|
||||
/VM/TEMPLATE/DISK\[DISK_ID=$DISK_ID\]/ORIGINAL_SIZE)
|
||||
/VM/TEMPLATE/DISK\[DISK_ID=$DISK_ID\]/ORIGINAL_SIZE \
|
||||
/VM/TEMPLATE/DISK\[DISK_ID=$DISK_ID\]/QCOW2_STANDALONE)
|
||||
|
||||
SIZE="${XPATH_ELEMENTS[j++]}"
|
||||
FORMAT="${XPATH_ELEMENTS[j++]}"
|
||||
ORIGINAL_SIZE="${XPATH_ELEMENTS[j++]}"
|
||||
QCOW2_STANDALONE="${XPATH_ELEMENTS[j++]}"
|
||||
|
||||
ssh_make_path $DST_HOST $DST_DIR
|
||||
disable_local_monitoring $DST_HOST $DST_DIR
|
||||
@ -84,7 +86,9 @@ if [ -n "$ORIGINAL_SIZE" ] && [ "$SIZE" -gt "$ORIGINAL_SIZE" ]; then
|
||||
RESIZE_CMD="qemu-img resize ${DST_PATH} ${SIZE}M"
|
||||
fi
|
||||
|
||||
if [ "$FORMAT" = "qcow2" ]; then
|
||||
if [ "$FORMAT" = "qcow2" ] && is_yes "${QCOW2_STANDALONE}"; then
|
||||
CLONE_CMD=$(qcow_dir_cmd "$SRC_PATH" "$DST_PATH" "convert")
|
||||
elif [ "$FORMAT" = "qcow2" ]; then
|
||||
CLONE_CMD=$(qcow_dir_cmd $SRC_PATH $DST_PATH "create")
|
||||
else
|
||||
CLONE_CMD="cp $SRC_PATH $DST_PATH"
|
||||
|
@ -254,3 +254,9 @@ function qcow_dir_cmd
|
||||
echo "ln -sf ${DST_FILE}.snap/0 $DST_PATH"
|
||||
echo "popd"
|
||||
}
|
||||
|
||||
# To allow more positive parameters options
|
||||
function is_yes
|
||||
{
|
||||
[[ "$1" =~ ^(yes|YES|true|TRUE)$ ]]
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user