]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/cephadm: Give warning for moving last nvmeof host to maintainance mode 62681/head
authorShweta Bhosale <Shweta.Bhosale1@ibm.com>
Fri, 4 Apr 2025 12:39:59 +0000 (18:09 +0530)
committerShweta Bhosale <Shweta.Bhosale1@ibm.com>
Tue, 8 Apr 2025 09:49:28 +0000 (15:19 +0530)
Fixes: https://tracker.ceph.com/issues/70800
Signed-off-by: Shweta Bhosale <Shweta.Bhosale1@ibm.com>
src/pybind/mgr/cephadm/services/nvmeof.py

index 9e5e2fa81bd805e355eda6fe0276a8b39c4731e7..277ec6ce0648adbd0ceac4c53ad357c2d3211102 100644 (file)
@@ -192,10 +192,14 @@ class NvmeofService(CephService):
             return HandleCommandResult(-errno.EBUSY, '', warn_message)
 
         # if reached here, there is > 1 nvmeof daemon. make sure none are down
-        warn_message = ('ALERT: 1 nvmeof daemon is already down. Please bring it back up before stopping this one')
-        nvmeof_daemons = self.mgr.cache.get_daemons_by_type(self.TYPE)
-        for i in nvmeof_daemons:
-            if i.status != DaemonDescriptionStatus.running:
+        if not force:
+            warn_message = ('WARNING: Only one nvmeof daemon is running. Please bring another nvmeof daemon up before stopping the current one.')
+            unreachable_hosts = [h.hostname for h in self.mgr.cache.get_unreachable_hosts()]
+            running_nvmeof_daemons = [
+                d for d in self.mgr.cache.get_daemons_by_type(self.TYPE)
+                if d.status == DaemonDescriptionStatus.running and d.hostname not in unreachable_hosts
+            ]
+            if len(running_nvmeof_daemons) < 2:
                 return HandleCommandResult(-errno.EBUSY, '', warn_message)
 
         names = [f'{self.TYPE}.{d_id}' for d_id in daemon_ids]