]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
qa/workunits/rbd: do not test --export-format unless supported 15764/head
authorKefu Chai <kchai@redhat.com>
Thu, 22 Jun 2017 04:16:52 +0000 (12:16 +0800)
committerKefu Chai <kchai@redhat.com>
Thu, 22 Jun 2017 04:19:01 +0000 (12:19 +0800)
in 55edd81, test for `--export-format` was added to exercise this
option. but this option is only supported on luminous, so we need to
check if it's avaialble before using it.

Signed-off-by: Kefu Chai <kchai@redhat.com>
qa/workunits/rbd/import_export.sh

index 35509642ae5de5d821a7352065752b40a7c8abb7..41585f2843b15b495e7fd3f444bc9c01b62e3c89 100755 (executable)
@@ -74,70 +74,72 @@ cmp ${TMPDIR}/img ${TMPDIR}/img3
 
 rm ${TMPDIR}/img ${TMPDIR}/img2 ${TMPDIR}/img3
 
-# try with --export-format for snapshots
-dd if=/bin/dd of=${TMPDIR}/img bs=1k count=10 seek=100
-rbd import $RBD_CREATE_ARGS ${TMPDIR}/img testimg
-rbd snap create testimg@snap
-rbd export --export-format 2 testimg ${TMPDIR}/img_v2
-rbd import --export-format 2 ${TMPDIR}/img_v2 testimg_import
-rbd info testimg_import
-rbd info testimg_import@snap
-
-# compare the contents between testimg and testimg_import
-rbd export testimg_import ${TMPDIR}/img_import
-compare_files_and_ondisk_sizes ${TMPDIR}/img ${TMPDIR}/img_import
-
-rbd export testimg@snap ${TMPDIR}/img_snap
-rbd export testimg_import@snap ${TMPDIR}/img_snap_import
-compare_files_and_ondisk_sizes ${TMPDIR}/img_snap ${TMPDIR}/img_snap_import
-
-rm ${TMPDIR}/img_v2
-rm ${TMPDIR}/img_import
-rm ${TMPDIR}/img_snap
-rm ${TMPDIR}/img_snap_import
-
-rbd snap rm testimg_import@snap
-rbd remove testimg_import
-rbd snap rm testimg@snap
-rbd rm testimg
-
-# order
-rbd import --order 20 ${TMPDIR}/img testimg
-rbd export --export-format 2 testimg ${TMPDIR}/img_v2
-rbd import --export-format 2 ${TMPDIR}/img_v2 testimg_import
-rbd info testimg_import|grep order|awk '{print $2}'|grep 20
-
-rm ${TMPDIR}/img_v2
-
-rbd remove testimg_import
-rbd remove testimg
-
-# features
-rbd import --image-feature layering ${TMPDIR}/img testimg
-FEATURES_BEFORE=`rbd info testimg|grep features`
-rbd export --export-format 2 testimg ${TMPDIR}/img_v2
-rbd import --export-format 2 ${TMPDIR}/img_v2 testimg_import
-FEATURES_AFTER=`rbd info testimg_import|grep features`
-if [ "$FEATURES_BEFORE" != "$FEATURES_AFTER" ]; then
-  false
-fi
+if rbd help export | grep -q export-format; then
+    # try with --export-format for snapshots
+    dd if=/bin/dd of=${TMPDIR}/img bs=1k count=10 seek=100
+    rbd import $RBD_CREATE_ARGS ${TMPDIR}/img testimg
+    rbd snap create testimg@snap
+    rbd export --export-format 2 testimg ${TMPDIR}/img_v2
+    rbd import --export-format 2 ${TMPDIR}/img_v2 testimg_import
+    rbd info testimg_import
+    rbd info testimg_import@snap
+
+    # compare the contents between testimg and testimg_import
+    rbd export testimg_import ${TMPDIR}/img_import
+    compare_files_and_ondisk_sizes ${TMPDIR}/img ${TMPDIR}/img_import
+
+    rbd export testimg@snap ${TMPDIR}/img_snap
+    rbd export testimg_import@snap ${TMPDIR}/img_snap_import
+    compare_files_and_ondisk_sizes ${TMPDIR}/img_snap ${TMPDIR}/img_snap_import
+
+    rm ${TMPDIR}/img_v2
+    rm ${TMPDIR}/img_import
+    rm ${TMPDIR}/img_snap
+    rm ${TMPDIR}/img_snap_import
+
+    rbd snap rm testimg_import@snap
+    rbd remove testimg_import
+    rbd snap rm testimg@snap
+    rbd rm testimg
+
+    # order
+    rbd import --order 20 ${TMPDIR}/img testimg
+    rbd export --export-format 2 testimg ${TMPDIR}/img_v2
+    rbd import --export-format 2 ${TMPDIR}/img_v2 testimg_import
+    rbd info testimg_import|grep order|awk '{print $2}'|grep 20
+    
+    rm ${TMPDIR}/img_v2
+
+    rbd remove testimg_import
+    rbd remove testimg
+
+    # features
+    rbd import --image-feature layering ${TMPDIR}/img testimg
+    FEATURES_BEFORE=`rbd info testimg|grep features`
+    rbd export --export-format 2 testimg ${TMPDIR}/img_v2
+    rbd import --export-format 2 ${TMPDIR}/img_v2 testimg_import
+    FEATURES_AFTER=`rbd info testimg_import|grep features`
+    if [ "$FEATURES_BEFORE" != "$FEATURES_AFTER" ]; then
+        false
+    fi
 
-rm ${TMPDIR}/img_v2
+    rm ${TMPDIR}/img_v2
 
-rbd remove testimg_import
-rbd remove testimg
+    rbd remove testimg_import
+    rbd remove testimg
 
-# stripe
-rbd import --stripe-count 1000 --stripe-unit 4096 ${TMPDIR}/img testimg
-rbd export --export-format 2 testimg ${TMPDIR}/img_v2
-rbd import --export-format 2 ${TMPDIR}/img_v2 testimg_import
-rbd info testimg_import|grep "stripe unit"|awk '{print $3}'|grep 4096
-rbd info testimg_import|grep "stripe count"|awk '{print $3}'|grep 1000
+    # stripe
+    rbd import --stripe-count 1000 --stripe-unit 4096 ${TMPDIR}/img testimg
+    rbd export --export-format 2 testimg ${TMPDIR}/img_v2
+    rbd import --export-format 2 ${TMPDIR}/img_v2 testimg_import
+    rbd info testimg_import|grep "stripe unit"|awk '{print $3}'|grep 4096
+    rbd info testimg_import|grep "stripe count"|awk '{print $3}'|grep 1000
 
-rm ${TMPDIR}/img_v2
+    rm ${TMPDIR}/img_v2
 
-rbd remove testimg_import
-rbd remove testimg
+    rbd remove testimg_import
+    rbd remove testimg
+fi
 
 tiered=0
 if ceph osd dump | grep ^pool | grep "'rbd'" | grep tier; then