]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
qa/workunits/rbd: fixed rbd-mirror snapshot comparison loop
authorJason Dillaman <dillaman@redhat.com>
Tue, 15 May 2018 20:13:16 +0000 (16:13 -0400)
committerJason Dillaman <dillaman@redhat.com>
Sat, 19 May 2018 12:17:54 +0000 (08:17 -0400)
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
(cherry picked from commit 917f8a037cf2e9e8795fd4bedeffc8655b515bac)

qa/workunits/rbd/rbd_mirror_helpers.sh

index 5901dc0b91611d1d30cd0b29367281718ceb5d08..e019de5a12f77d131ad54e324a4981461289cb86 100755 (executable)
 #     ../qa/workunits/rbd/rbd_mirror.sh cleanup
 #
 
+if type xmlstarlet > /dev/null 2>&1; then
+    XMLSTARLET=xmlstarlet
+elif type xml > /dev/null 2>&1; then
+    XMLSTARLET=xml
+else
+    echo "Missing xmlstarlet binary!"
+    exit 1
+fi
+
 RBD_MIRROR_INSTANCES=${RBD_MIRROR_INSTANCES:-2}
 
 CLUSTER1=cluster1
@@ -886,7 +895,8 @@ compare_image_snapshots()
     local rmt_export=${TEMPDIR}/${CLUSTER2}-${pool}-${image}.export
     local loc_export=${TEMPDIR}/${CLUSTER1}-${pool}-${image}.export
 
-    for snap_name in $(rbd --cluster ${CLUSTER1} -p ${pool} snap list ${image}); do
+    for snap_name in $(rbd --cluster ${CLUSTER1} -p ${pool} --format xml \
+                           snap list ${image} | $XMLSTARLET sel -t -v "//snapshot/name"); do
         rm -f ${rmt_export} ${loc_export}
         rbd --cluster ${CLUSTER2} -p ${pool} export ${image}@${snap_name} ${rmt_export}
         rbd --cluster ${CLUSTER1} -p ${pool} export ${image}@${snap_name} ${loc_export}