mgr/cephadm: move ok_to_stop to CephadmService #35503
mgr/cephadm: move ok_to_stop to CephadmService #35503sebastian-philipp merged 4 commits intoceph:masterfrom
Conversation
eb41156 to
94c8999
Compare
|
todo for tomorrow: |
mgfritch
left a comment
There was a problem hiding this comment.
👍 generally moving these to a CephadmService is much cleaner ... I’m just a little worried about some of the edge cases where service_type doesn’t agree with TYPE...
94c8999 to
8f69936
Compare
8f69936 to
a897858
Compare
a897858 to
1dae421
Compare
src/pybind/mgr/cephadm/module.py
Outdated
| self._remove_daemon(d.name(), d.hostname) | ||
| r = True | ||
| to_remove = [d for d in daemons if d.hostname not in target_hosts] | ||
| while to_remove and not self.cephadm_services[daemon_type].ok_to_stop([d.daemon_id for d in to_remove]): |
There was a problem hiding this comment.
Is there any sense to use list construction instead of iterator?
| new_mons = [m for m in mons if m != mon_id] | ||
| new_quorum = [m for m in j['quorum_names'] if m != mon_id] | ||
| if len(new_quorum) > len(new_mons) / 2: | ||
| logger.info('Safe to remove mon.%s: new quorum should be %s (from %s)' % (mon_id, new_quorum, new_mons)) |
There was a problem hiding this comment.
Since this is a logger.info, then it is better to right?
logger.info('Safe to remove mon.%s: new quorum should be %s (from %s)', mon_id, new_quorum, new_mons)
Otherwise, why not keep the same style using f' ' strings?
| self._check_safe_to_destroy(daemon_id) | ||
|
|
||
| # remove mon from quorum before we destroy the daemon | ||
| logger.info('Removing monitor %s from monmap...' % daemon_id) |
| if len(new_quorum) > len(new_mons) / 2: | ||
| logger.info('Safe to remove mon.%s: new quorum should be %s (from %s)' % (mon_id, new_quorum, new_mons)) | ||
| return | ||
| raise OrchestratorError('Removing %s would break mon quorum (new quorum %s, new mons %s)' % (mon_id, new_quorum, new_mons)) |
| ok = self.mgr.cephadm_services[s.daemon_type].ok_to_stop([s.daemon_id]) | ||
|
|
||
| if ok: | ||
| logger.info('Upgrade: It is presumed safe to stop %s.%s' % |
There was a problem hiding this comment.
See comment above regarding logger.info
| logger.info('Upgrade: It is presumed safe to stop %s.%s' % | ||
| (s.daemon_type, s.daemon_id)) | ||
| return True | ||
| logger.info('Upgrade: It is NOT safe to stop %s.%s' % |
There was a problem hiding this comment.
See comment above regarding logger.info
| # To backpopulate the .hosts attribute when using labels or count | ||
| # in the orchestrator backend. | ||
| self.hosts = hosts | ||
| if all([isinstance(host, HostPlacementSpec) for host in hosts]): |
There was a problem hiding this comment.
there is no need to construct a list
| names = [f'{self.TYPE}.{d_id}' for d_id in daemon_ids] | ||
|
|
||
| if self.TYPE not in ['mon', 'osd', 'mds']: | ||
| logger.info('Upgrade: It is presumed safe to stop %s' % names) |
Signed-off-by: Sebastian Wagner <sebastian.wagner@suse.com>
Signed-off-by: Sebastian Wagner <sebastian.wagner@suse.com>
Signed-off-by: Sebastian Wagner <sebastian.wagner@suse.com>
Signed-off-by: Sebastian Wagner <sebastian.wagner@suse.com>
1dae421 to
5c91f1b
Compare
mgfritch
left a comment
There was a problem hiding this comment.
lgtm, this structure will make future PRs much cleaner!
|
unfortunately, I think this is blocked, till the upgrade test is working again. |
|
jenkins test docs |
This PR is on the edge of being unnecessary. MDS is the only service that will benefit from this. Still:
Checklist
Show available Jenkins commands
jenkins retest this pleasejenkins test classic perfjenkins test crimson perfjenkins test signedjenkins test make checkjenkins test make check arm64jenkins test submodulesjenkins test dashboardjenkins test dashboard backendjenkins test docsjenkins render docsjenkins test ceph-volume alljenkins test ceph-volume tox