forked from ceph/ceph
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Yehuda Sadeh
committed
Oct 28, 2010
1 parent
66e1d9f
commit b6ffdf1
Showing
2 changed files
with
82 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
|
||
error_exit() { | ||
echo "$*" | ||
exit 1 | ||
} | ||
|
||
# defaults | ||
[ -z "$bindir" ] && bindir=$PWD # location of init-ceph | ||
if [ -z "$conf" ]; then | ||
conf="$basedir/ceph.conf" | ||
[ -e $conf ] || conf="/etc/ceph/ceph.conf" | ||
fi | ||
[ -e $conf ] || error_exit "conf file not found" | ||
|
||
CCONF="cconf -c $conf" | ||
|
||
[ -z "$mnt" ] && mnt="/c" | ||
[ -z "$monhost" ] && monhost="`$CCONF -t mon -i 0 'mon addr'`" | ||
[ -z "$imgsize" ] && imgsize=1024 | ||
[ -z "$user" ] && user=admin | ||
[ -z "$keyring" ] && keyring="`$CCONF keyring`" | ||
[ -z "$secret" ] && secret="`cauthtool $keyring -n client.$user -p`" | ||
|
||
|
||
monip="`echo $monhost | sed 's/:/ /g' | awk '{print $1}'`" | ||
monport="`echo $monhost | sed 's/:/ /g' | awk '{print $2}'`" | ||
|
||
[ -z "$monip" ] && error_exit "bad mon address" | ||
|
||
[ -z "$monport" ] && monport=6789 | ||
|
||
set -e | ||
|
||
mydir=`hostname`_`echo $0 | sed 's/\//_/g'` | ||
|
||
img_name=test.`hostname`.$$ | ||
|
||
|
||
rbd_load() { | ||
modprobe rbd | ||
} | ||
|
||
rbd_create_image() { | ||
rbd create $img_name --size=$imgsize | ||
} | ||
|
||
rbd_add() { | ||
id=$1 | ||
echo "$monip:$monport name=$user,secret=$secret rbd $img_name" > /sys/class/rbd/add | ||
sleep 1 | ||
export rbd$id="`tail -1 /sys/class/rbd/list | cut -f1`" | ||
} | ||
|
||
rbd_test_init() { | ||
rbd_load | ||
rbd_create_image | ||
} | ||
|
||
|
||
rbd_remove() { | ||
echo $1 > /sys/class/rbd/remove | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/bin/bash -x | ||
|
||
basedir=`echo $0 | sed 's/[^/]*$//g'`. | ||
. $basedir/common.sh | ||
|
||
rbd_test_init | ||
|
||
rbd_add 0 | ||
|
||
devname=/dev/rbd$rbd0 | ||
|
||
mkfs -t ext3 $devname | ||
mount -t ext3 $devname /mnt | ||
|
||
dbench -D /mnt -t 30 5 | ||
sync | ||
|
||
umount /mnt | ||
rbd_remove $rbd0 | ||
|