Skip to content

Commit 40f2d5e

Browse files
mgr/cephadm: Give warning for moving last nvmeof host to maintainance mode
Fixes: https://tracker.ceph.com/issues/70800 Signed-off-by: Shweta Bhosale <[email protected]>
1 parent 7a4d7c5 commit 40f2d5e

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/pybind/mgr/cephadm/services/nvmeof.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -192,10 +192,14 @@ def ok_to_stop(self,
192192
return HandleCommandResult(-errno.EBUSY, '', warn_message)
193193

194194
# if reached here, there is > 1 nvmeof daemon. make sure none are down
195-
warn_message = ('ALERT: 1 nvmeof daemon is already down. Please bring it back up before stopping this one')
196-
nvmeof_daemons = self.mgr.cache.get_daemons_by_type(self.TYPE)
197-
for i in nvmeof_daemons:
198-
if i.status != DaemonDescriptionStatus.running:
195+
if not force:
196+
warn_message = ('WARNING: Only one nvmeof daemon is running. Please bring another nvmeof daemon up before stopping the current one.')
197+
unreachable_hosts = [h.hostname for h in self.mgr.cache.get_unreachable_hosts()]
198+
running_nvmeof_daemons = [
199+
d for d in self.mgr.cache.get_daemons_by_type(self.TYPE)
200+
if d.status == DaemonDescriptionStatus.running and d.hostname not in unreachable_hosts
201+
]
202+
if len(running_nvmeof_daemons) < 2:
199203
return HandleCommandResult(-errno.EBUSY, '', warn_message)
200204

201205
names = [f'{self.TYPE}.{d_id}' for d_id in daemon_ids]

0 commit comments

Comments
 (0)