From: Shweta Bhosale Date: Fri, 4 Apr 2025 12:39:59 +0000 (+0530) Subject: mgr/cephadm: Give warning for moving last nvmeof host to maintainance mode X-Git-Tag: v20.3.0~56^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=40f2d5e7a0c25ae4b14c0eba0c20252e5ee93121;p=ceph.git mgr/cephadm: Give warning for moving last nvmeof host to maintainance mode Fixes: https://tracker.ceph.com/issues/70800 Signed-off-by: Shweta Bhosale --- diff --git a/src/pybind/mgr/cephadm/services/nvmeof.py b/src/pybind/mgr/cephadm/services/nvmeof.py index 9e5e2fa81bd..277ec6ce064 100644 --- a/src/pybind/mgr/cephadm/services/nvmeof.py +++ b/src/pybind/mgr/cephadm/services/nvmeof.py @@ -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]