]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
test: Handle object removals in a non-racey way
authorDavid Zafman <dzafman@redhat.com>
Wed, 15 Jun 2016 03:09:15 +0000 (20:09 -0700)
committerDavid Zafman <dzafman@redhat.com>
Fri, 28 Oct 2016 05:42:11 +0000 (22:42 -0700)
Signed-off-by: David Zafman <dzafman@redhat.com>
src/test/osd/osd-scrub-repair.sh

index 498f8e3c9482cc9785ef22aaf2f7a35b03c31920..c3fc8c4158acee68fcec0c0bd0cc14f2e4a6744f 100755 (executable)
@@ -314,27 +314,35 @@ function TEST_list_missing_erasure_coded() {
 
     # Put an object and remove the two shards (including primary)
     add_something $dir $poolname MOBJ0 || return 1
-    local -a osds=($(get_osds $poolname MOBJ0))
-
-    pids=""
-    run_in_background pids objectstore_tool $dir ${osds[0]} MOBJ0 remove
-    run_in_background pids objectstore_tool $dir ${osds[1]} MOBJ0 remove
-    wait_background pids
-    return_code=$?
-    if [ $return_code -ne 0 ]; then return $return_code; fi
-
+    local -a osds0=($(get_osds $poolname MOBJ0))
 
     # Put another object and remove two shards (excluding primary)
     add_something $dir $poolname MOBJ1 || return 1
-    local -a osds=($(get_osds $poolname MOBJ1))
+    local -a osds1=($(get_osds $poolname MOBJ1))
 
-    pids=""
-    run_in_background pids objectstore_tool $dir ${osds[1]} MOBJ1 remove
-    run_in_background pids objectstore_tool $dir ${osds[2]} MOBJ1 remove
-    wait_background pids
-    return_code=$?
-    if [ $return_code -ne 0 ]; then return $return_code; fi
+    # Stop all osd daemons
+    for id in $(seq 0 2) ; do
+        kill_daemons $dir TERM osd.$id >&2 < /dev/null || return 1
+    done
 
+    id=${osds0[0]}
+    ceph-objectstore-tool --data-path $dir/$id --journal-path $dir/$id/journal \
+        MOBJ0 remove || return 1
+    id=${osds0[1]}
+    ceph-objectstore-tool --data-path $dir/$id --journal-path $dir/$id/journal \
+        MOBJ0 remove || return 1
+
+    id=${osds1[1]}
+    ceph-objectstore-tool --data-path $dir/$id --journal-path $dir/$id/journal \
+        MOBJ1 remove || return 1
+    id=${osds1[2]}
+    ceph-objectstore-tool --data-path $dir/$id --journal-path $dir/$id/journal \
+        MOBJ1 remove || return 1
+
+    for id in $(seq 0 2) ; do
+        activate_osd $dir $id >&2 || return 1
+    done
+    wait_for_clean >&2
 
     # Get get - both objects should in the same PG
     local pg=$(get_pg $poolname MOBJ0)