Skip to content

Commit 7763f48

Browse files
committed
Add support for ceph replication
This patch adds support to enable replication on ceph side by executing the following two steps: 1. Enable image level mirroring 2. Configure mirror peers via bootstrap It also extends the rbd-mirror service enablement done in patch[1] to be configured for the secondary cluster when ``MULTI_CEPH`` is True. [1] https://review.opendev.org/c/openstack/devstack-plugin-ceph/+/948768 Change-Id: I8746018e93e77e5c9c6708ed3d9628d81cec2130 Signed-off-by: Rajat Dhasmana <rajatdhasmana@gmail.com>
1 parent c5a7886 commit 7763f48

1 file changed

Lines changed: 34 additions & 0 deletions

File tree

devstack/lib/cephadm

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -588,6 +588,12 @@ function rbd_mirror {
588588
$SUDO "$CEPHADM" shell --fsid "$FSID" --config "$CEPH_CONFIG" \
589589
--keyring $CEPH_KEYRING -- ceph orch apply rbd-mirror \
590590
"--placement=$HOSTNAME count:1"
591+
592+
if [[ "$MULTI_CEPH" == 'True' ]]; then
593+
$SUDO "$CEPHADM" shell --fsid "$CEPH2_FSID" --config "$CEPH2_CONFIG" \
594+
--keyring $CEPH2_KEYRING -- ceph orch apply rbd-mirror \
595+
"--placement=$HOSTNAME count:1"
596+
fi
591597
}
592598

593599
# Install ceph: add RGW
@@ -910,6 +916,11 @@ function configure_ceph {
910916
if [[ "$DISABLE_CEPHADM_POST_DEPLOY" == "True" ]]; then
911917
disable_cephadm
912918
fi
919+
920+
if [[ "$MULTI_CEPH" == "True" && "$ENABLE_CEPH_RBD_MIRROR" == "True" ]]; then
921+
enable_mirror image
922+
bootstrap_peers
923+
fi
913924
}
914925

915926
# Hack: remove this function at some point
@@ -918,6 +929,29 @@ function configure_ceph_manila {
918929
:
919930
}
920931

932+
function enable_mirror {
933+
local MODE=$1
934+
$SUDO "$CEPHADM" shell --fsid "$FSID" --config "$CEPH_CONFIG" \
935+
--keyring $CEPH_KEYRING -- rbd mirror pool enable \
936+
$CINDER_CEPH_POOL $MODE
937+
938+
if [[ "$MULTI_CEPH" == 'True' ]]; then
939+
$SUDO "$CEPHADM" shell --fsid "$CEPH2_FSID" --config "$CEPH2_CONFIG" \
940+
--keyring $CEPH2_KEYRING -- rbd mirror pool enable \
941+
$CINDER_CEPH_POOL $MODE
942+
fi
943+
}
944+
945+
function bootstrap_peers {
946+
$SUDO "$CEPHADM" shell --fsid "$FSID" --config "$CEPH_CONFIG" \
947+
--keyring $CEPH_KEYRING -- rbd mirror pool peer bootstrap create \
948+
--site-name $FSID $CINDER_CEPH_POOL | awk 'END{print}' \
949+
> "$HOME/token_file"
950+
$SUDO "$CEPHADM" shell --fsid "$CEPH2_FSID" --config "$CEPH2_CONFIG" \
951+
--keyring $CEPH2_KEYRING -- rbd mirror pool peer bootstrap import \
952+
--site-name $CEPH2_FSID $CINDER_CEPH_POOL - < "$HOME/token_file"
953+
}
954+
921955
function cleanup_ceph {
922956
# Cleanup the service.
923957
if [[ "$REMOTE_CEPH" == "True" ]]; then

0 commit comments

Comments
 (0)