summaryrefslogtreecommitdiffstats
path: root/qa/client/common.sh
blob: d06368e6ea758a52960d66b8ebc7923f12ba64a8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# defaults
[ -z "$bindir" ] && bindir=$PWD       # location of init-ceph
[ -z "$conf" ] && conf="$basedir/ceph.conf"
[ -z "$mnt" ] && mnt="/c"
[ -z "$monhost" ] && monhost="cosd0"

set -e

mydir=`hostname`_`echo $0 | sed 's/\//_/g'`

client_mount()
{
    /bin/mount -t ceph $monhost:/ $mnt
}

client_umount()
{
    /bin/umount $mnt
    # look for VFS complaints
    if dmesg | tail -n 50 | grep -c "VFS: Busy inodes" ; then
	echo "looks like we left inodes pinned"
	exit 1
    fi
}

ceph_start()
{
    $bindir/init-ceph -c $conf start ${1}
}

ceph_stop()
{
    $bindir/init-ceph -c $conf stop ${1}
}

ceph_restart()
{
    $bindir/init-ceph -c $conf restart ${1}
}

ceph_command()
{
    $bindir/ceph -c $conf $*
}

client_enter_mydir()
{
    pushd .
    test -d $mnt/$mydir && rm -r $mnt/$mydir
    mkdir $mnt/$mydir
    cd $mnt/$mydir
}

client_leave_mydir()
{
    popd
}