]>
git.proxmox.com Git - ceph.git/blob - ceph/qa/standalone/mon/mkfs.sh
3 # Copyright (C) 2013 Cloudwatt <libre.licensing@cloudwatt.com>
4 # Copyright (C) 2014 Red Hat <contact@redhat.com>
6 # Author: Loic Dachary <loic@dachary.org>
8 # This program is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU Library Public License as published by
10 # the Free Software Foundation; either version 2, or (at your option)
13 # This program is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU Library Public License for more details.
19 PS4
='${BASH_SOURCE[0]}:$LINENO: ${FUNCNAME[0]}: '
23 export CEPH_CONF
=/dev
/null
27 CEPH_MON
=127.0.0.1:7110 # git grep '\<7110\>' : there must be only one
31 if [ -n "$CEPH_LIB" ]; then
32 EXTRAOPTS
+=" --erasure-code-dir $CEPH_LIB"
33 EXTRAOPTS
+=" --plugin-dir $CEPH_LIB"
34 EXTRAOPTS
+=" --osd-class-dir $CEPH_LIB"
56 --mon-initial-members=$MON_ID \
57 --mon-host=$CEPH_MON \
65 --mon-osd-full-ratio=.99 \
66 --mon-data-avail-crit=1 \
69 --log-file=$MON_DIR/log \
70 --mon-cluster-log-file=$MON_DIR/log \
72 --pid-file=$MON_DIR/pidfile \
73 --public-addr $CEPH_MON \
77 function kill_daemons
() {
78 for pidfile
in $
(find $DIR -name pidfile
) ; do
80 for try
in 0 1 1 1 2 3 ; do
87 function auth_none
() {
88 mon_mkfs
--auth-supported=none
92 --mon-osd-full-ratio=.99 \
93 --mon-data-avail-crit=1 \
96 --extract-monmap $MON_DIR/monmap
98 [ -f $MON_DIR/monmap
] ||
return 1
100 [ ! -f $MON_DIR/keyring
] ||
return 1
102 mon_run
--auth-supported=none
104 timeout
$TIMEOUT ceph
--mon-host $CEPH_MON mon stat ||
return 1
107 function auth_cephx_keyring
() {
108 cat > $DIR/keyring
<<EOF
110 key = AQDUS79S0AF9FRAA2cgRLFscVce0gROn/s9WMg==
114 mon_mkfs
--keyring=$DIR/keyring
116 [ -f $MON_DIR/keyring
] ||
return 1
120 timeout
$TIMEOUT ceph \
122 --keyring $MON_DIR/keyring \
123 --mon-host $CEPH_MON mon stat ||
return 1
126 function auth_cephx_key
() {
127 if [ -f /etc
/ceph
/keyring
] ; then
128 echo "Please move /etc/ceph/keyring away for testing!"
132 local key
=$
(ceph-authtool
--gen-print-key)
134 if mon_mkfs
--key='corrupted key' ; then
137 rm -fr $MON_DIR/store.db
138 rm -fr $MON_DIR/kv_backend
143 [ -f $MON_DIR/keyring
] ||
return 1
144 grep $key $MON_DIR/keyring
148 timeout
$TIMEOUT ceph \
150 --keyring $MON_DIR/keyring \
151 --mon-host $CEPH_MON mon stat ||
return 1
155 local toodeep
=$MON_DIR/toodeep
157 # fail if recursive directory creation is needed
160 --mon-osd-full-ratio=.99 \
161 --mon-data-avail-crit=1 \
164 --mon-data=$toodeep 2>&1 |
tee $DIR/makedir.log
165 grep 'toodeep.*No such file' $DIR/makedir.log
> /dev
/null
168 # an empty directory does not mean the mon exists
170 mon_mkfs
--auth-supported=none
2>&1 |
tee $DIR/makedir.log
171 ! grep "$MON_DIR already exists" $DIR/makedir.log ||
return 1
174 function idempotent
() {
175 mon_mkfs
--auth-supported=none
176 mon_mkfs
--auth-supported=none
2>&1 |
tee $DIR/makedir.log
177 grep "'$MON_DIR' already exists" $DIR/makedir.log
> /dev
/null ||
return 1
183 actions
+="idempotent "
184 actions
+="auth_cephx_key "
185 actions
+="auth_cephx_keyring "
186 actions
+="auth_none "
187 for action
in $actions ; do
197 # compile-command: "cd ../.. ; make TESTS=test/mon/mkfs.sh check"