summaryrefslogtreecommitdiff
path: root/common/ceph
blob: d6f24df177e7b305deed1c90cfc7f4200b83672e (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
#
# CephFS specific common functions.
#

# _ceph_create_file_layout <filename> <stripe unit> <stripe count> <object size>
# This function creates a new empty file and sets the file layout according to
# parameters.  It will exit if the file already exists.
_ceph_create_file_layout()
{
	local fname=$1
	local stripe_unit=$2
	local stripe_count=$3
	local obj_size=$4

	if [ -e $fname ]; then
		echo "File $fname already exists."
		exit 1
	fi
	touch $fname
	$SETFATTR_PROG -n ceph.file.layout \
		-v "stripe_unit=$objsz stripe_count=1 object_size=$objsz" \
		$fname
}

# this test requires to access file capabilities through vxattr 'ceph.caps'.
_require_ceph_vxattr_caps()
{
	$GETFATTR_PROG -n "ceph.caps" $TEST_DIR >/dev/null 2>&1 \
	  || _notrun "ceph.caps vxattr not supported"
}

_ceph_get_cluster_fsid()
{
	$GETFATTR_PROG --only-values -n "ceph.cluster_fsid" $TEST_DIR 2>/dev/null
}

_ceph_get_client_id()
{
	$GETFATTR_PROG --only-values -n "ceph.client_id" $TEST_DIR 2>/dev/null
}