local journal_p=$4
local uuid=$5
local juuid=$6
+ local plain=$7
$mkdir -p $OSD_DATA
- ./ceph-disk $CEPH_DISK_ARGS \
- prepare --dmcrypt --dmcrypt-key-dir $DIR/keys --osd-uuid=$uuid --journal-uuid=$juuid $to_prepare $journal || return 1
-
- /sbin/cryptsetup --key-file $DIR/keys/$uuid.luks.key luksOpen $to_activate $uuid
- /sbin/cryptsetup --key-file $DIR/keys/$juuid.luks.key luksOpen ${journal}${journal_p} $juuid
-
- $timeout $TIMEOUT ./ceph-disk $CEPH_DISK_ARGS \
- activate \
- --mark-init=none \
- /dev/mapper/$uuid || 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 weight=1
- ./ceph osd crush add osd.$id $weight root=default host=localhost || return 1
- echo FOO > $DIR/BAR
- $timeout $TIMEOUT ./rados --pool $TEST_POOL put BAR $DIR/BAR || return 1
- $timeout $TIMEOUT ./rados --pool $TEST_POOL get BAR $DIR/BAR.copy || return 1
- $diff $DIR/BAR $DIR/BAR.copy || return 1
-}
-
-function test_activate_dmcrypt_plain() {
- local to_prepare=$1
- local to_activate=$2
- local journal=$3
- local journal_p=$4
- local uuid=$5
- local juuid=$6
-
- $mkdir -p $OSD_DATA
-
- echo "osd_dmcrypt_type=plain" > $DIR/ceph.conf
+ if test $plain = plain ; then
+ echo "osd_dmcrypt_type=plain" > $DIR/ceph.conf
+ fi
./ceph-disk $CEPH_DISK_ARGS \
prepare --dmcrypt --dmcrypt-key-dir $DIR/keys --osd-uuid=$uuid --journal-uuid=$juuid $to_prepare $journal || return 1
- /sbin/cryptsetup --key-file $DIR/keys/$uuid --key-size 256 create $uuid $to_activate
- /sbin/cryptsetup --key-file $DIR/keys/$juuid --key-size 256 create $juuid $journal
+ if test $plain = plain ; then
+ /sbin/cryptsetup --key-file $DIR/keys/$uuid --key-size 256 create $uuid $to_activate
+ /sbin/cryptsetup --key-file $DIR/keys/$juuid --key-size 256 create $juuid $journal
+ else
+ /sbin/cryptsetup --key-file $DIR/keys/$uuid.luks.key luksOpen $to_activate $uuid
+ /sbin/cryptsetup --key-file $DIR/keys/$juuid.luks.key luksOpen ${journal}${journal_p} $juuid
+ fi
$timeout $TIMEOUT ./ceph-disk $CEPH_DISK_ARGS \
activate \
setup
run_mon
- test_activate_dmcrypt $disk ${disk}p1 $journal p1 $uuid $juuid|| return 1
+ test_activate_dmcrypt $disk ${disk}p1 $journal p1 $uuid $juuid not_plain || return 1
kill_daemons
umount /dev/mapper/$uuid || return 1
teardown
setup
run_mon
- test_activate_dmcrypt_plain $disk ${disk}p1 $journal p1 $uuid $juuid|| return 1
+ test_activate_dmcrypt $disk ${disk}p1 $journal p1 $uuid $juuid plain || return 1
kill_daemons
umount /dev/mapper/$uuid || return 1
teardown