Bug 1909826

Summary: [cephadm] 5.0 - Ceph orch apply command throws traceback message instead of helping users with closest match or help commands
Product: [Red Hat Storage] Red Hat Ceph Storage Reporter: Preethi <pnataraj>
Component: CephadmAssignee: Adam King <adking>
Status: CLOSED ERRATA QA Contact: Vasishta <vashastr>
Severity: high Docs Contact: Karen Norteman <knortema>
Priority: high    
Version: 5.0CC: adking, kdreyer, sewagner, vereddy
Target Milestone: ---   
Target Release: 5.0   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: ceph-16.1.0-486.el8cp Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-08-30 08:27:34 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Preethi 2020-12-21 18:45:29 UTC
Description of problem:[cephadm] 5.0 - Ceph orch apply command throws traceback message instead of helping users with closest match or help commands


Version-Release number of selected component (if applicable):
[root@magna106 ubuntu]# sudo cephadm version
Using recent ceph image registry.redhat.io/rhceph-alpha/rhceph-5-rhel8:latest
ceph version 16.0.0-7953.el8cp (aac7c5c7d5f82d2973c366730f65255afd66e515) pacific (dev)

How reproducible:


Steps to Reproduce:
1. Install 5.0 cluster
2. enter cephadm shell
3. perform "ceph orch apply" command and check the behaviour

Actual results:

Below traceback message seen instead of help options for users

[ceph: root@magna094 /]# ceph orch apply
Error EINVAL: Traceback (most recent call last):
  File "/usr/share/ceph/mgr/mgr_module.py", line 1195, in _handle_command
    return self.handle_command(inbuf, cmd)
  File "/usr/share/ceph/mgr/orchestrator/_interface.py", line 141, in handle_command
    return dispatch[cmd['prefix']].call(self, cmd, inbuf)
  File "/usr/share/ceph/mgr/mgr_module.py", line 332, in call
    return self.func(mgr, **kwargs)
  File "/usr/share/ceph/mgr/orchestrator/_interface.py", line 103, in <lambda>
    wrapper_copy = lambda *l_args, **l_kwargs: wrapper(*l_args, **l_kwargs)
  File "/usr/share/ceph/mgr/orchestrator/_interface.py", line 92, in wrapper
    return func(*args, **kwargs)
  File "/usr/share/ceph/mgr/orchestrator/module.py", line 1080, in _apply_misc
    assert service_type
AssertionError



Expected results: We need "ceph orch apply" option to display similar like below
[ceph: root@magna094 /]# ceph orch      
no valid command found; 10 closest matches:
orch host add <hostname> [<addr>] [<labels>...]
orch host rm <hostname>
orch host set-addr <hostname> <addr>
orch host ls [plain|json|json-pretty|yaml]
orch host label add <hostname> <label>
orch host label rm <hostname> <label>
orch host ok-to-stop <hostname>
orch device ls [<hostname>...] [plain|json|json-pretty|yaml] [--refresh] [--wide]
orch device zap <hostname> <path> [--force]
orch ls [<service_type>] [<service_name>] [--export] [plain|json|json-pretty|yaml] [--refresh]
Error EINVAL: invalid command
[ceph: root@magna094 /]# 














Additional info:

Comment 1 Juan Miguel Olmo 2021-02-01 18:55:52 UTC
Also an upstream bug related with this:
https://tracker.ceph.com/issues/49056

Comment 2 Adam King 2021-02-02 23:34:24 UTC
Actually getting the closest matching commands to appear would be quite difficult as it would require "ceph orch apply" to actually not find a match. An error message like


Error EINVAL: Improper use of 'ceph orch apply'. No valid service type provided.
Usage:
  ceph orch apply -i <yaml spec> [--dry-run]
  ceph orch apply <service_type> [--placement=<placement_string>] [--unmanaged]
        where <service_type> can be: mon|mgr|rbd-mirror|crash|alertmanager|grafana|node-exporter|prometheus|mds|rgw|nfs|iscsi|cephadm-exporter



that gives the context that no valid service type was provided to the apply command would be fairly straightforward. Would that be a sufficient fix?

Comment 3 Preethi 2021-02-03 10:50:32 UTC
@Adam, Yes. Something like that will help.

Comment 4 Adam King 2021-02-03 17:08:24 UTC
upstream change

https://github.com/ceph/ceph/pull/39261

Comment 8 Preethi 2021-03-08 13:12:03 UTC
@Adam, Issue is fixed in latest alpha

[ceph: root@ceph-sangadi-5-0-1614674044401-node1-mon-mgr-installer-node-exp /]# ceph orch apply
Error EINVAL: Usage:
  ceph orch apply -i <yaml spec> [--dry-run]
  ceph orch apply <service_type> [--placement=<placement_string>] [--unmanaged]
        
[ceph: root@ceph-sangadi-5-0-1614674044401-node1-mon-mgr-installer-node-exp /]#

Comment 10 errata-xmlrpc 2021-08-30 08:27:34 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Red Hat Ceph Storage 5.0 bug fix and enhancement), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2021:3294