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

Signed-off-by: Anton Todorov <a.todorov@storpool.com>
(cherry picked from commit 4b17b1f6e8)
This commit is contained in:
Anton Todorov authored and Ruben S. Montero committed 2020-02-19 11:47:20 +01:00
1 parent e5e13b29c3
commit 67defe8da6
1 file changed
+3 -2
+3 -2
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