mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-22 18:50:08 +03:00
B #3778: Fail on non-KVM host for live cpds
(cherry picked from commit ec5c2c68a8b8c815561d00e328091ab6eb8f1aba)
This commit is contained in:
parent
050938658d
commit
dd584baf82
@ -122,6 +122,33 @@ EOF
|
||||
log_error "Exporting failed"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
# if SRC is qcow2 with backing chain, convert it to tmp path
|
||||
CPDS_CMD_EXPORT=$(cat <<EOF
|
||||
set -e -o pipefail
|
||||
if [ -L $SRC_PATH ] && file -L $SRC_PATH | grep -q 'has backing file'; then
|
||||
$QEMU_IMG convert -O qcow2 $SRC_PATH $SRC_TEMP_PATH;
|
||||
exit 42;
|
||||
fi
|
||||
EOF
|
||||
)
|
||||
|
||||
ssh_exec_and_log_no_error $SRC_HOST "$CPDS_CMD_EXPORT" "$CPDS_CMD_ERR" "100"
|
||||
RC=$?
|
||||
if [ $RC = 0 ]; then
|
||||
# no export needed
|
||||
true
|
||||
elif [ $RC = 42 ]; then
|
||||
# qcow2 detected and exported, re-point SRC and other vars
|
||||
SRC="${SRC_HOST}:${SRC_TEMP_PATH}"
|
||||
set_src_dst_vars
|
||||
|
||||
# Always try delete temp export
|
||||
trap "ssh_exec_and_log $SRC_HOST \"$RM ${SRC_TEMP_PATH}\"" EXIT
|
||||
else
|
||||
error_message "cpds: Can not convert qcow2 chain $SRC_PATH"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
log "Moving $SRC to datastore as $DST"
|
||||
|
Loading…
x
Reference in New Issue
Block a user