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

F #6333: Fix path for multiple disks (2/2)

Update attach-disk action to resolve symlinks for file disks.
This commit is contained in:
Ruben S. Montero 2023-11-14 18:40:45 +01:00
parent 248bc50e16
commit c2af378c6a
No known key found for this signature in database
GPG Key ID: A0CEA6FA880A1D87

View File

@ -96,6 +96,22 @@ XML+="<driver name='qemu' type='$(xml_esc "${DRIVER}")'"
[ -n "${VIRTIO_BLK_QUEUES}" ] && XML+=" queues='$(xml_esc "${VIRTIO_BLK_QUEUES}")'"
XML+="/>"
if [ "${TYPE_SOURCE}" == "file" ]; then
f=$(echo ${SOURCE} | sed 's/[[:space:]]*$//')
if [[ "${f}" =~ .*/disk\.[0-9]+$ && -L "${f}" ]]; then
rl=$(readlink ${f})
if [ "${rl:0:1}" != "/" ]; then
rl="$(dirname ${f})/${rl}"
fi
if [ -e "${rl}" ]; then
SOURCE="${rl}"
fi
fi
fi
XML+="<source ${TYPE_SOURCE}='$(xml_esc "${SOURCE}")' ${SOURCE_ARGS}>"
XML+="${SOURCE_HOST}"
XML+="</source>"