-
Notifications
You must be signed in to change notification settings - Fork 524
/
start_rbd_mirror.sh
executable file
·32 lines (25 loc) · 1.05 KB
/
start_rbd_mirror.sh
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
#!/bin/bash
set -e
function start_rbd_mirror {
get_config
check_config
if [ "${CEPH_GET_ADMIN_KEY}" -eq 1 ]; then
# ensure we have the admin key
get_admin_key
check_admin_key
fi
if [ ! -e "$RBD_MIRROR_KEYRING" ]; then
if [ ! -e "$RBD_MIRROR_BOOTSTRAP_KEYRING" ]; then
log "ERROR- $RBD_MIRROR_BOOTSTRAP_KEYRING must exist. You can extract it from your current monitor by running 'ceph auth get client.bootstrap-rbd -o $RBD_MIRROR_BOOTSTRAP_KEYRING'"
exit 1
fi
ceph_health client.bootstrap-rbd-mirror "$RBD_MIRROR_BOOTSTRAP_KEYRING"
# Generate the rbd mirror key
ceph "${CLI_OPTS[@]}" --name client.bootstrap-rbd-mirror --keyring "$RBD_MIRROR_BOOTSTRAP_KEYRING" auth get-or-create client.rbd-mirror."${RBD_MIRROR_NAME}" mon 'profile rbd-mirror' osd 'profile rbd' -o "$RBD_MIRROR_KEYRING"
chown "${CHOWN_OPT[@]}" ceph. "$RBD_MIRROR_KEYRING"
chmod 0600 "$RBD_MIRROR_KEYRING"
fi
log "SUCCESS"
# start rbd-mirror
exec /usr/bin/rbd-mirror "${DAEMON_OPTS[@]}" -n client.rbd-mirror."${RBD_MIRROR_NAME}"
}