Merge pull request #42400 from adk3798/offline-daemon-removal

mgr/cephadm: don't remove daemons from offline hosts

Reviewed-by: Daniel Pivonka <dpivonka@redhat.com>
This commit is contained in:
Kefu Chai 2021-07-31 16:35:37 +08:00 committed by GitHub
commit 84425c8de6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 2 deletions

View File

@ -1390,6 +1390,7 @@ class CephadmOrchestrator(orchestrator.Orchestrator, MgrModule,
if (
self.cache.host_had_daemon_refresh(h.hostname)
and h.status.lower() not in ['maintenance', 'offline']
and h.hostname not in self.offline_hosts
and '_no_schedule' not in h.labels
)
]

View File

@ -692,7 +692,7 @@ class CephadmServe:
try:
all_slots, slots_to_add, daemons_to_remove = ha.place()
daemons_to_remove = [d for d in daemons_to_remove if (d.hostname and self.mgr.inventory._inventory[d.hostname].get(
'status', '').lower() not in ['maintenance', 'offline'])]
'status', '').lower() not in ['maintenance', 'offline'] and d.hostname not in self.mgr.offline_hosts)]
self.log.debug('Add %s, remove %s' % (slots_to_add, daemons_to_remove))
except OrchestratorError as e:
self.log.error('Failed to apply %s spec %s: %s' % (

View File

@ -1108,7 +1108,7 @@ spec:
assert len(cephadm_module.cache.get_daemons_by_type('mgr')) == 3
# put one host in offline state and one host in maintenance state
cephadm_module.inventory._inventory['test2']['status'] = 'offline'
cephadm_module.offline_hosts = {'test2'}
cephadm_module.inventory._inventory['test3']['status'] = 'maintenance'
cephadm_module.inventory.save()