Bug #55117
closed`cephadm unit status` prints backtrace if service is stopped
0%
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-a513cede-9c55-11ec-9477-52540073e111@osd.5.service - 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 /run/ceph-a513cede-9c55-11ec-9477-52540073e111@osd.5.service-pid /run/ceph-a513cede-9c55-11ec-9477-52540073e111@osd.5.service-cid (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 /run/ceph-a513cede-9c55-11ec-9477-52540073e111@osd.5.service-pid /run/ceph-a513cede-9c55-11ec-9477-52540073e111@osd.5.service-cid (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 ceph-a513cede-9c55-11ec-9477-52540073e111@osd.5
```
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.
Updated by Michael Fritch about 2 years ago
- Status changed from New to Fix Under Review
- Pull request ID set to 45765
Updated by Redouane Kachach Elhichou almost 2 years ago
- Status changed from Fix Under Review to Pending Backport
Do we need to backport this fix?
Updated by Moritz Roehrich almost 2 years ago
It's fixed in master. But as far as I can tell it's not in quincy or older releases. It would probably be a good idea to backport it to quincy and pacific. I'd be happy to do it, help me by outlining roughly what needs to be done?
Updated by Redouane Kachach Elhichou almost 2 years ago
Thanks, after some checks it seems this PR is already included into Quincy backport https://github.com/ceph/ceph/pull/46055.
Updated by Moritz Roehrich almost 2 years ago
That sounds great.
I'd really like to see it be backported to pacific too if possible. Is there going to be a batch backport to pacific too or should I create a separate PR for that. If there is a batch backport, how can I make sure this change will be picked up.
Updated by Redouane Kachach Elhichou almost 2 years ago
Thanks Moritz, there are already plans to backport the change to pacific as well so just stay tuned for it.
Updated by Redouane Kachach Elhichou almost 2 years ago
- Status changed from Pending Backport to Resolved