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

Feature #4217: Return error in the export action when needed

This commit is contained in:
Jaime Melis 2016-03-14 17:30:04 +01:00
parent 0e73f866f3
commit 9c69143c18
2 changed files with 9 additions and 3 deletions

View File

@ -115,6 +115,10 @@ else
CHECKSUM="$MD5"
fi
if [ -z "\$CHECKSUM" ]; then
exit 1
fi
cat <<EOT
<MD5><![CDATA[\$CHECKSUM]]></MD5>
<SIZE><![CDATA[$SIZE]]></SIZE>

View File

@ -56,15 +56,17 @@ BRIDGE_LIST="${XPATH_ELEMENTS[i++]}"
#-------------------------------------------------------------------------------
INFO_SCRIPT=$(cat <<EOF
CHECKSUM=\$(${MD5SUM} ${SRC} | cut -f1 -d' ')
SIZE=\$(${DU} -Lm ${SRC} | cut -f1)
FORMAT=\$(${QEMU_IMG} info ${SRC} 2>/dev/null | grep -Po '(?<=file format: )\w+')
if [ -z "\$CHECKSUM" -o -z "\$SIZE" ]; then
exit 1
fi
echo "<MD5><![CDATA[\$CHECKSUM]]></MD5>"
echo "<SIZE><![CDATA[\$SIZE]]></SIZE>"
echo "<FORMAT><![CDATA[\${FORMAT-"unknown"}]]></FORMAT>"
echo "<FORMAT><![CDATA[\${FORMAT:-unknown}]]></FORMAT>"
EOF
)