]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr: handle SIGTERM/SIGINT in standby mgr to avoid CEPHADM_FAILED_DAEMON 69456/head
authorNitzan Mordechai <nmordech@ibm.com>
Sun, 14 Jun 2026 07:55:36 +0000 (07:55 +0000)
committerNitzan Mordechai <nmordech@ibm.com>
Sun, 14 Jun 2026 08:07:10 +0000 (08:07 +0000)
MgrStandby only registered SIGHUP, leaving SIGTERM/SIGINT at OS defaults.
When a standby is stopped via `ceph orch daemon stop`, SIGTERM terminates
it with exit code 143, causing systemd to mark the unit as failed instead
of stopped, which triggers CEPHADM_FAILED_DAEMON.

Mirror the handler already used in Mgr::init() for the active mgr.

Fixes: https://tracker.ceph.com/issues/77116
Signed-off-by: Nitzan Mordechai <nmordech@ibm.com>
src/mgr/MgrStandby.cc

index b0cfedbcc0210460b5012e3ee4fe821072680662..70db213596652ac17c3addfb0b00ce8470fceaa8 100644 (file)
@@ -153,11 +153,18 @@ int MgrStandby::asok_command(std::string_view cmd, const cmdmap_t& cmdmap, Forma
   }
 }
 
+static void handle_standby_mgr_signal(int signum)
+{
+  derr << " *** Got signal " << sig_str(signum) << " ***" << dendl;
+  _exit(0);
+}
+
 int MgrStandby::init()
 {
   init_async_signal_handler();
   register_async_signal_handler(SIGHUP, sighup_handler);
-
+  register_async_signal_handler_oneshot(SIGTERM, handle_standby_mgr_signal);
+  register_async_signal_handler_oneshot(SIGINT, handle_standby_mgr_signal);
   cct->_conf.add_observer(this);
 
   std::lock_guard l(lock);
@@ -495,6 +502,8 @@ int MgrStandby::main(vector<const char *> args)
 
   // Disable signal handlers
   unregister_async_signal_handler(SIGHUP, sighup_handler);
+  unregister_async_signal_handler(SIGTERM, handle_standby_mgr_signal);
+  unregister_async_signal_handler(SIGINT, handle_standby_mgr_signal);
   shutdown_async_signal_handler();
 
   return 0;