Project

General

Profile

Actions

Bug #55117

closed

`cephadm unit status` prints backtrace if service is stopped

Added by Moritz Roehrich about 2 years ago. Updated almost 2 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
-
Category:
cephadm
Target version:
-
% Done:

0%

Source:
Tags:
pacific,quincy
Backport:
Regression:
No
Severity:
4 - irritation
Reviewed:
Affected Versions:
ceph-qa-suite:
Pull request ID:
Crash signature (v1):
Crash signature (v2):

Description

Tested on: v16.2.7.558

```
node1:~ # cephadm unit stop --name osd.5
Inferring fsid a513cede-9c55-11ec-9477-52540073e111
node1:~ # cephadm unit status --name osd.5
Inferring fsid a513cede-9c55-11ec-9477-52540073e111
- Ceph osd.5 for a513cede-9c55-11ec-9477-52540073e111
Loaded: loaded (/etc/systemd/system/ceph-a513cede-9c55-11ec-9477-52540073e111@.service; enabled; vendor preset: disabled)
Active: inactive (dead) since Sat 2022-03-05 09:19:51 CET; 5s ago
Process: 49884 ExecStartPre=/bin/rm -f (code=exited, status=0/SUCCESS)
Process: 49885 ExecStart=/bin/bash /var/lib/ceph/a513cede-9c55-11ec-9477-52540073e111/osd.5/unit.run (code=exited, status=0/SUCCESS)
Process: 58151 ExecStop=/bin/bash -c /usr/bin/podman stop ceph-a513cede-9c55-11ec-9477-52540073e111-osd.5 ; bash /var/lib/ceph/a513cede-9c55-11ec-9477-52540073e111/osd.5/unit.stop (code=exited, status=0/SUCCESS)
Process: 58298 ExecStopPost=/bin/bash /var/lib/ceph/a513cede-9c55-11ec-9477-52540073e111/osd.5/unit.poststop (code=exited, status=0/SUCCESS)
Process: 58520 ExecStopPost=/bin/rm -f (code=exited, status=0/SUCCESS)
Main PID: 50273 (code=exited, status=0/SUCCESS)
...
Traceback (most recent call last):
File "/usr/sbin/cephadm", line 8859, in <module>
main()
File "/usr/sbin/cephadm", line 8847, in main
r = ctx.func(ctx)
File "/usr/sbin/cephadm", line 1888, in _infer_config
return func(ctx)
File "/usr/sbin/cephadm", line 1858, in _infer_fsid
return func(ctx)
File "/usr/sbin/cephadm", line 5104, in command_unit
desc=''
File "/usr/sbin/cephadm", line 1618, in call_throws
raise RuntimeError('Failed command: %s' % ' '.join(command))
RuntimeError: Failed command: systemctl status
```

So, `systemctl status` returns a non zero status (because the service is not running), which I assume is expected behavior.

It would be good if cephadm does not treat is as a RuntimeError, as it makes output confusing.

Actions

Also available in: Atom PDF