7 script_dir
=$
(readlink
-f $
(dirname $0))
11 mon_dir
=${base_dir}/mon.a
/
12 pid_dir
=${base_dir}/pid
13 ceph_conf
=${base_dir}/ceph.conf
14 mnt_dir
=${base_dir}/mnt
16 image
=/var
/tmp
/ceph_raw.img
20 losetup
-d $dev_backend || true
23 if [ -d $base_dir ]; then
27 cp ${script_dir}/ceph.conf
$ceph_conf
29 if [ ! -e $image ]; then
30 fallocate
-l 10G
$image
33 mknod
${dev_backend} b
7 200 || true
34 losetup
${dev_backend} ${image} || true
39 echo "Partitioning ${dev}"
40 ${PARTED} ${dev} mktable gpt
42 ${PARTED} ${dev} mkpart primary
0% 5GiB
43 ${PARTED} ${dev} mkpart primary
5GiB
100%
47 echo "Setting name on ${dev}"
48 ${SGDISK} -c 1:osd-device-${partno}-journal ${dev}
49 ${SGDISK} -c 2:osd-device-${partno}-data ${dev}
54 mnt_pt
=${mnt_dir}/osd-device-0-data
/
56 mkfs.xfs
-f /dev
/disk
/by-partlabel
/osd-device-0-data
57 mount
/dev
/disk
/by-partlabel
/osd-device-0-data
${mnt_pt}
58 echo -e "\tosd data = ${mnt_pt}" >> "$ceph_conf"
59 echo -e "\tosd journal = /dev/disk/by-partlabel/osd-device-0-journal" >> "$ceph_conf"
62 echo -e "\t[mon.a]" >> "$ceph_conf"
63 echo -e "\tmon addr = ${mon_ip}:12046" >> "$ceph_conf"
70 ceph-authtool
--create-keyring --gen-key --name=mon.
${base_dir}/keyring
--cap mon
'allow *'
71 ceph-authtool
--gen-key --name=client.admin
--set-uid=0 --cap mon
'allow *' --cap osd
'allow *' --cap mds
'allow *' --cap mgr
'allow *' ${base_dir}/keyring
73 monmaptool
--create --clobber --add a
${mon_ip}:12046 --print ${base_dir}/monmap
75 sh
-c "ulimit -c unlimited && exec ceph-mon --mkfs -c ${ceph_conf} -i a --monmap=${base_dir}/monmap --keyring=${base_dir}/keyring --mon-data=${mon_dir}"
77 cp ${base_dir}/keyring
${mon_dir}/keyring
79 cp $ceph_conf /etc
/ceph
/ceph.conf
81 cp ${base_dir}/keyring
/etc
/ceph
/keyring
83 ceph-run sh
-c "ulimit -n 16384 && ulimit -c unlimited && exec ceph-mon -c ${ceph_conf} -i a --keyring=${base_dir}/keyring --pid-file=${base_dir}/pid/root@`hostname`.pid --mon-data=${mon_dir}" || true
92 ceph
-c ${ceph_conf} osd create
${uuid} $i
93 ceph-osd
-c ${ceph_conf} -i $i --mkfs --mkkey --osd-uuid ${uuid}
94 ceph
-c ${ceph_conf} osd crush add osd.
${i} 1.0 host=`hostname` root
=default
95 ceph
-c ${ceph_conf} -i ${mnt_dir}/osd-device-${i}-data/keyring auth add osd.${i} osd
"allow *" mon
"allow profile osd" mgr
"allow"
98 pkill
-9 ceph-osd || true
102 env
-i TCMALLOC_MAX_TOTAL_THREAD_CACHE_BYTES
=134217728 ceph-osd
-c ${ceph_conf} -i 0 --pid-file=${pid_dir}/ceph-osd
.0.pid