From bed3f86fbd826d49973757c08c2b95ec7342fbb3 Mon Sep 17 00:00:00 2001 From: Seena Fallah Date: Fri, 16 Feb 2024 14:58:10 +0100 Subject: [PATCH] ceph-handler: restart existed rgw daemons This is needed for new instances are the restart might trigger before the deployment Signed-off-by: Seena Fallah (cherry picked from commit 7142321bc3b69283d75d798956aa6597b74a5985) --- roles/ceph-handler/templates/restart_rgw_daemon.sh.j2 | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/roles/ceph-handler/templates/restart_rgw_daemon.sh.j2 b/roles/ceph-handler/templates/restart_rgw_daemon.sh.j2 index 93eda64b8b..416213782c 100644 --- a/roles/ceph-handler/templates/restart_rgw_daemon.sh.j2 +++ b/roles/ceph-handler/templates/restart_rgw_daemon.sh.j2 @@ -74,7 +74,16 @@ check_rest() { for ((i=0; i<${RGW_NUMS}; i++)); do # First, restart the daemon - systemctl restart ceph-radosgw@rgw.${HOST_NAME}.${INSTANCES_NAME[i]} + + # Check if systemd unit exists + # This is needed for new instances are the restart might trigger before the deployment + if systemctl list-units --full --all | grep -q "ceph-radosgw@rgw.${HOST_NAME}.${INSTANCES_NAME[i]}"; then + systemctl restart ceph-radosgw@rgw.${HOST_NAME}.${INSTANCES_NAME[i]} + else + echo "Systemd unit ceph-radosgw@rgw.${HOST_NAME}.${INSTANCES_NAME[i]} does not exist." + continue + fi + # Check socket files check_socket ${i} # Check rest