Fix #10877
openCLI error numbers are not described anywhere
60%
Description
While trying to run the following command:
rados lspools
I got this as the last line of the output:
couldn't connect to cluster! error -2
The man page doesn't list error numbers and searching around I saw mailing list threads that showed `-1` as well.
I understand that there is an error connecting to the cluster, but if the CLI is using error numbers, those should be
listed/explained somewhere, if possible in the man page too.
Updated by Josh Durgin about 9 years ago
These are pretty much always errno numbers, which should be translated by the cli via strerror_r().
Updated by Alfredo Deza about 9 years ago
I wasn't aware that `-2` or `-1` where common values (couldn't find any references to it in the docs I searched).
However, the problem is that, as a user, I don't understand what the problem is so I can correct whatever step is needed.
When I first opened this ticket, the problem was that there was no keyring in the host where I was running the command. And yet,
the I get the same output when I don't have sufficient permissions:
$ rados lspools 2015-02-16 06:23:32.768509 7fd06a1df7c0 -1 monclient(hunting): ERROR: missing keyring, cannot use cephx for authentication 2015-02-16 06:23:32.768514 7fd06a1df7c0 0 librados: client.admin initialization error (2) No such file or directory couldn't connect to cluster! error -2 [ubuntu@magna123 ~]$ sudo !! sudo rados lspools rbd data metadata
The error should attempt to identify what is wrong so that the user can amend the mistake.
For the first case it could be:
Could not find any keyrings for current user in $PATHS Failed to authenticate to the cluster.
For the second scenario where I don't have enough permissions:
Cannot read keyring in $PATH: Permission denied.
Which makes it crystal clear to what the problem is and with a format that mimics what happens when
running a command (like `ls`) on a directory that the current user doesn't have permissions.
Updated by Greg Farnum about 9 years ago
You want to get different errors when you're not allowed to read a keyring versus when it doesn't exist?
I guess in some cases that can be identified, but quite often you're just denied access to the directory...
Updated by Alfredo Deza about 9 years ago
I would say anything that is possible to identify (and get back to the user) would be better than the current output.
Updated by Dan Mick about 9 years ago
See #5634, too. Sigh.
Negative errnos are the convention back from kernel calls, so Ceph uses them internally too. See cpp_strerror() for the handling convention.
Updated by Kefu Chai about 9 years ago
can we enclose the errno along with the path name into an exception and catch it in the caller? that would be very handy, IMO. and the error message from bufferlist is swallowed by MonMap::read()
. so an Exception with a str and an errno is what we want. right?
but at this moment, i will translate the errno using cpp_strerror() in the up-most caller in CLI. so we will have something like:
$ rados lspools couldn't connect to cluster: (2) No such file or directory
Updated by Kefu Chai about 9 years ago
adding the Exception will change the signature of the interface of Rados. so will print the error message to log.
Updated by Kefu Chai about 9 years ago
- Status changed from New to Fix Under Review
PR posted at https://github.com/ceph/ceph/pull/3873, pending on review.
Updated by Alfredo Deza about 9 years ago
it would be fantastic to understand what is it that it expected and couldn't find (besides the actual error)
Updated by Kefu Chai about 9 years ago
yeah, i will print the path of file when ceph server/client is trying to open it but fails to do so.=)
Updated by Loïc Dachary about 9 years ago
- Status changed from Fix Under Review to Resolved
- % Done changed from 60 to 100
Updated by Loïc Dachary about 9 years ago
- Status changed from Resolved to In Progress
- % Done changed from 100 to 60
Hum, it looks like this might be more than https://github.com/ceph/ceph/pull/3873, back to in progress ;-)