Skip to content

Commit 0ff8117

Browse files
authored
Merge pull request ceph#62681 from ShwetaBhosale1/fix_issue_70800_moving_last_host_having_nvmeof_to_maintainance_mode_should_not_be_allowed
mgr/cephadm: Give warning for moving last nvmeof host to maintainane mode Reviewed-by: Adam King <[email protected]> Reviewed-by: Kushal Deb <[email protected]>
2 parents 2bd32f7 + 40f2d5e commit 0ff8117

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)