Hediberto C Silva d5a84a1dbc Adds support for 3 monitors on AIO-DX
Adding two fixed Ceph monitors for controllers when deploying an
AIO-DX to improve HA.

Includes:
 - Creates a new shell script to manage the fixed monitors
 - Creates a new patch to include the mon_data parameter in
   the mon.pp puppet manifest.
 - Creates the ceph-storage-network script that is used by the
   storage-networking SM service to stop Ceph services in case
   of a network outage.
 - Alters the script used by the ceph-mds pmon file to
   ceph-init-wrapper.
 - Adjusts the ceph-init-wrapper to accept commands from pmon service.
 - Adjusts the ceph-init-wrapper to accept the forcestop command.
 - Stopping Ceph services using ceph-init-wrapper, it is checked
   if the pid exists before trying.
 - Stopping ceph-mon service using ceph-init-wrapper,
   the ceph-mds is stopped right before to force a re-peering.
 - Starting ceph-mon service using ceph-init-wrapper,
   the ceph-mds is stopped right before to force a re-peering.
 - Starting ceph-mds, it is checked if the ceph-mon is operational.
 - The forcestop command uses a TERM signal first before
   attempting a KILL signal after 5 seconds.

Test Plan:
  PASS: Fresh install AIO-DX and check 3 Ceph monitors are running.
  PASS: Fresh install all other setups and check if Ceph is working as
expected.
  PASS: Reboots the standby controller and check if Ceph is still
running.
  PASS: Reboots the active controller. Ceph will stop responding, but
it will recover after both controllers are running.
  PASS: Verify Ceph is working after a DOR test with PODs writting
to the cephfs and rbd pools.
  PASS: Verify Ceph is resilient to switch reboots

Story: 2011122
Task: 50129

Change-Id: I18d7ab9da3303265da34bc13c8be4baa23c2a7be
Signed-off-by: Hediberto C Silva <hediberto.cavalcantedasilva@windriver.com>
Signed-off-by: Felipe Sanches Zanoni <Felipe.SanchesZanoni@windriver.com>
2024-07-29 17:42:29 -03:00

111 lines
3.9 KiB
Diff

From e6f5d2cd267564ee97f53447ba1419d1ace641a1 Mon Sep 17 00:00:00 2001
From: Hediberto C Silva <hediberto.cavalcantedasilva@windriver.com>
Date: Tue, 19 Mar 2024 17:17:10 -0300
Subject: [PATCH] Add mon_data parameter
If supplied, the mon_data parameter defines where the ceph-mon data
will be located.
Signed-off-by: Hediberto C Silva <hediberto.cavalcantedasilva@windriver.com>
---
manifests/mon.pp | 33 ++++++++++++++++++++++++++-------
1 file changed, 26 insertions(+), 7 deletions(-)
diff --git a/manifests/mon.pp b/manifests/mon.pp
index 6d1294e..4615d3c 100644
--- a/manifests/mon.pp
+++ b/manifests/mon.pp
@@ -60,6 +60,7 @@
define ceph::mon (
$ensure = present,
$mon_enable = true,
+ $mon_data = '',
$public_addr = undef,
$cluster = undef,
$authentication_type = 'cephx',
@@ -139,7 +140,10 @@ chmod 0444 ${keyring_path}
",
unless => "/bin/true # comment to satisfy puppet syntax requirements
set -ex
-mon_data=\$(ceph-mon ${cluster_option} --id ${id} --show-config-value mon_data) || exit 1
+mon_data=\"${mon_data}\"
+if [ -z \${mon_data} ]; then
+ mon_data=\$(ceph-mon ${cluster_option} --id ${id} --show-config-value mon_data) || exit 1
+fi
# if ceph-mon fails then the mon is probably not configured yet
test -e \$mon_data/done
",
@@ -178,7 +182,10 @@ test -e /etc/ceph/${cluster_name}.client.admin.keyring",
-> exec { $ceph_mkfs:
command => "/bin/true # comment to satisfy puppet syntax requirements
set -ex
-mon_data=\$(ceph-mon ${cluster_option} --id ${id} --show-config-value mon_data)
+mon_data=\"${mon_data}\"
+if [ -z \${mon_data} ]; then
+ mon_data=\$(ceph-mon ${cluster_option} --id ${id} --show-config-value mon_data)
+fi
if [ ! -d \$mon_data ] ; then
mkdir -p \$mon_data
if getent passwd ceph >/dev/null 2>&1; then
@@ -188,7 +195,8 @@ if [ ! -d \$mon_data ] ; then
--mkfs \
--id ${id} \
--keyring ${keyring_path} \
- ${fsid_option} ; then
+ ${fsid_option} \
+ --mon-data \$mon_data ; then
touch \$mon_data/done \$mon_data/${init} \$mon_data/keyring
chown -h ceph:ceph \$mon_data/done \$mon_data/${init} \$mon_data/keyring
else
@@ -199,7 +207,8 @@ if [ ! -d \$mon_data ] ; then
--mkfs \
--id ${id} \
--keyring ${keyring_path} \
- ${fsid_option} ; then
+ ${fsid_option} \
+ --mon-data \$mon_data ; then
touch \$mon_data/done \$mon_data/${init} \$mon_data/keyring
else
rm -fr \$mon_data
@@ -209,7 +218,10 @@ fi
",
unless => "/bin/true # comment to satisfy puppet syntax requirements
set -ex
-mon_data=\$(ceph-mon ${cluster_option} --id ${id} --show-config-value mon_data)
+mon_data=\"${mon_data}\"
+if [ -z \${mon_data} ]; then
+ mon_data=\$(ceph-mon ${cluster_option} --id ${id} --show-config-value mon_data)
+fi
test -d \$mon_data
",
logoutput => true,
@@ -244,13 +256,19 @@ test ! -e ${keyring_path}
-> exec { "remove-mon-${id}":
command => "/bin/true # comment to satisfy puppet syntax requirements
set -ex
-mon_data=\$(ceph-mon ${cluster_option} --id ${id} --show-config-value mon_data)
+mon_data=\"${mon_data}\"
+if [ -z \${mon_data} ]; then
+ mon_data=\$(ceph-mon ${cluster_option} --id ${id} --show-config-value mon_data)
+fi
rm -fr \$mon_data
",
unless => "/bin/true # comment to satisfy puppet syntax requirements
set -ex
which ceph-mon || exit 0 # if ceph-mon is not available we already uninstalled ceph and there is nothing to do
-mon_data=\$(ceph-mon ${cluster_option} --id ${id} --show-config-value mon_data)
+mon_data=\"${mon_data}\"
+if [ -z \${mon_data} ]; then
+ mon_data=\$(ceph-mon ${cluster_option} --id ${id} --show-config-value mon_data)
+fi
test ! -d \$mon_data
",
logoutput => true,
@@ -263,3 +281,4 @@ test ! -d \$mon_data
fail('Ensure on MON must be either present or absent')
}
}
+
--
2.34.1