1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-01-27 14:03:40 +03:00

B #4164: Use xmllint to test disk target device (#4168)

Signed-off-by: Anton Todorov <a.todorov@storpool.com>
(cherry picked from commit 4b17b1f6e81fb598733ef3038f53985698798749)
This commit is contained in:
Anton Todorov 2020-02-19 12:45:18 +02:00 committed by Ruben S. Montero
parent e5e13b29c3
commit 67defe8da6
No known key found for this signature in database
GPG Key ID: A0CEA6FA880A1D87

View File

@ -29,9 +29,10 @@ DETACH_PARAMS="--domain $DOMAIN --target $TARGET"
exec_and_log "virsh --connect $LIBVIRT_URI detach-disk $DETACH_PARAMS" \
"Could not detach $TARGET from $DOMAIN"
virsh --connect $LIBVIRT_URI dumpxml $DOMAIN | grep $TARGET > /dev/null 2>&1
virsh --connect $LIBVIRT_URI dumpxml $DOMAIN | \
xmllint -xpath "//disk/target[@dev='$TARGET']" - >/dev/null 2>&1
if [ $? -eq 0 ] ; then
if [ $? -ne 0 ] ; then
error_message "Could not detach $TARGET from $DOMAIN"
exit -1
fi