]> git.apps.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
ceph-handler: restart existed rgw daemons
authorSeena Fallah <seenafallah@gmail.com>
Fri, 16 Feb 2024 13:58:10 +0000 (14:58 +0100)
committerGuillaume Abrioux <gabrioux@ibm.com>
Thu, 7 Mar 2024 20:03:33 +0000 (21:03 +0100)
This is needed for new instances are the restart might trigger before the deployment

Signed-off-by: Seena Fallah <seenafallah@gmail.com>
roles/ceph-handler/templates/restart_rgw_daemon.sh.j2

index 93eda64b8bb8547f7082116c7427153da88fafbe..416213782c4dc887f60f5f5e8dfa9a880b69a64b 100644 (file)
@@ -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