Skip to content

Commit

Permalink
B OpenNebula#4164: Use xmllint to test disk target device (OpenNebula…
Browse files Browse the repository at this point in the history
…#4168)

Signed-off-by: Anton Todorov <a.todorov@storpool.com>
(cherry picked from commit 4b17b1f)
  • Loading branch information
atodorov-storpool committed Feb 20, 2020
1 parent ba59622 commit 5da5c5d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/vmm_mad/remotes/kvm/detach_disk
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 5da5c5d

Please sign in to comment.