mgr/cephadm: add orch ok-to-stop commands#36232
Conversation
|
|
Hm. do we really need a |
src/pybind/mgr/cephadm/module.py
Outdated
| if not self.cephadm_services[daemon_type].ok_to_stop(daemon_ids): | ||
| raise orchestrator.OrchestratorError( | ||
| f'It is NOT safe to stop host {hostname}') |
There was a problem hiding this comment.
we should probably return the error string returned by ceph * ok-to-stop here.
src/pybind/mgr/cephadm/module.py
Outdated
| @trivial_completion | ||
| def ok_to_stop(self, | ||
| daemon_type: str, | ||
| daemon_ids: List[str]): | ||
| names = [f'{daemon_type}.{d_id}' for d_id in daemon_ids] | ||
|
|
||
| if daemon_type not in ServiceSpec.KNOWN_SERVICE_TYPES: | ||
| raise orchestrator.OrchestratorError( | ||
| f'unknown daemon_type "{daemon_type}"') | ||
|
|
||
| if not self.cephadm_services[daemon_type].ok_to_stop(daemon_ids): | ||
| raise orchestrator.OrchestratorError( | ||
| f'It is NOT safe to stop {names}') | ||
|
|
||
| msg = f'It is presumed safe to stop {names}' | ||
| self.log.info(msg) | ||
| return msg |
There was a problem hiding this comment.
ok now I see the point. for e.g. NFS etc. Hm.
There was a problem hiding this comment.
Hm. do we really need a
ceph orch ok-to-stop $daemon? I mean, we already haveceph osd ok-to-stop.
it's useful if we implement logic like this for NFS, iscsi etc, but it's also useful in case we'd decide to extend the existing ok-to-stop logic with Orchestrator specific logic ...
| if ret: | ||
| logger.info(f'It is NOT safe to stop {names}: {err}') | ||
| logger.error(f'It is NOT safe to stop {names}: {err}') | ||
| return False |
There was a problem hiding this comment.
can we also return err here?
There was a problem hiding this comment.
I've added a commit to return an HandleCommandResult from the ok-to-stop command.
|
great stuff, just adding my thoughts here: I can imagine the following commands being useful for various tools/users:
This will probably always return false.. It's probably nonsensical to implement this.
|
12b7ef9 to
079dab5
Compare
apparently This should now use the errno (and stderr) returned by ok-to-stop: |
079dab5 to
d5d6bcd
Compare
|
jenkins test make check |
|
jenkins test dashboard backend |
|
|
||
| @_cli_write_command( | ||
| 'orch ok-to-stop', | ||
| "name=daemon_type,type=CephString " | ||
| "name=daemon_ids,type=CephString,n=N", | ||
| desc='Check if the specified daemons can be safely stopped without reducing availability') | ||
| def _ok_to_stop(self, daemon_type: str, daemon_ids: List[str]): | ||
| completion = self.ok_to_stop(daemon_type, daemon_ids) | ||
| self._orchestrator_wait([completion]) | ||
| raise_if_exception(completion) | ||
| return HandleCommandResult(stdout=completion.result_str()) |
There was a problem hiding this comment.
It still feels odd. I mean, looking at https://docs.ceph.com/docs/master/api/mon_command_api/ we have:
Woudn't it make more sense to provide commands in a similar fashion? Like
ceph nfs ok-to-stopceph rgw ok-to-stop
etc?
I mean, what's the point in aliasing ceph osd ok-to-stop 0 1 2 with ceph orch ok-to-stop osd 0 1?
There was a problem hiding this comment.
yeah that's redundant. I've dropped the per service type orch ok-to-stop command.
if we want to add orchestrator specific logic we should probably extend the the existing mds/mon/osd commands or add new nfs/rgw ones etc.
d5d6bcd to
45bdcf6
Compare
|
jenkins test make check |
|
jenkins test dashboard backend |
|
add errno to OrchestratorError and ServiceSpecValidationError exceptions Signed-off-by: Michael Fritch <mfritch@suse.com>
- return output from the result of the ok_to_stop command - log ok-to-stop result during all invocations Signed-off-by: Michael Fritch <mfritch@suse.com>
$ ceph orch host ok-to-stop host1 It is presumed safe to stop host host1 Signed-off-by: Michael Fritch <mfritch@suse.com>
45bdcf6 to
d6fa2e2
Compare
Adds a per daemon ok-to-stop command:
Also adds a per host ok-to-stop command:
Signed-off-by: Michael Fritch mfritch@suse.com
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