CLI error numbers are not described anywhere
While trying to run the following command:
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.
#2 Updated by Alfredo Deza over 5 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.
#7 Updated by Kefu Chai over 5 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