]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
tests: ceph-disk.sh can be confused if there are two OSDs
authorLoic Dachary <ldachary@redhat.com>
Sat, 7 Mar 2015 15:10:15 +0000 (16:10 +0100)
committerLoic Dachary <ldachary@redhat.com>
Tue, 10 Mar 2015 16:50:29 +0000 (17:50 +0100)
Replace the fragile extaction of the whoami file with an explicit uuid
set for a given OSD. It can conveniently be translated back into an osd
id with ceph osd create uuid if needed.

Signed-off-by: Loic Dachary <ldachary@redhat.com>
src/test/ceph-disk.sh

index 28be510ea4b6da1612f6a7c1cdae887bfd98efc3..ac876ddc36bb436adcaea2f609113a2f0af6ae5a 100755 (executable)
@@ -202,11 +202,12 @@ function test_activate() {
     local to_prepare=$1
     local to_activate=$2
     local journal=$3
+    local osd_uuid=$(uuidgen)
 
     $mkdir -p $OSD_DATA
 
     ./ceph-disk $CEPH_DISK_ARGS \
-        prepare $to_prepare $journal || return 1
+        prepare --osd-uuid $osd_uuid $to_prepare $journal || return 1
 
     $timeout $TIMEOUT ./ceph-disk $CEPH_DISK_ARGS \
         activate \
@@ -214,7 +215,7 @@ function test_activate() {
         $to_activate || return 1
     $timeout $TIMEOUT ./ceph osd pool set $TEST_POOL size 1 || return 1
 
-    local id=$($cat $OSD_DATA/ceph-?/whoami || $cat $to_activate/whoami)
+    local id=$(ceph osd create $osd_uuid)
     local weight=1
     ./ceph osd crush add osd.$id $weight root=default host=localhost || return 1
     echo FOO > $DIR/BAR