Project

General

Profile

Fix #10877

CLI error numbers are not described anywhere

Added by Alfredo Deza over 5 years ago. Updated over 5 years ago.

Status:
In Progress
Priority:
Normal
Assignee:
Category:
ceph cli
Target version:
-
% Done:

60%

Source:
other
Tags:
Backport:
Reviewed:
Affected Versions:
ceph-qa-suite:
Pull request ID:
Crash signature:

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.

Associated revisions

Revision 98a2e5c5 (diff)
Added by Kefu Chai over 5 years ago

rados: translate errno to str in CLI

  • and print detailed error message when monmap or keyring fails to
    load from specified file.

Fixes: #10877
Signed-off-by: Kefu Chai <>

History

#1 Updated by Josh Durgin over 5 years ago

These are pretty much always errno numbers, which should be translated by the cli via strerror_r().

#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.

#3 Updated by Greg Farnum over 5 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...

#4 Updated by Alfredo Deza over 5 years ago

I would say anything that is possible to identify (and get back to the user) would be better than the current output.

#5 Updated by Dan Mick over 5 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.

#6 Updated by Kefu Chai over 5 years ago

  • Assignee set to Kefu Chai

#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

#8 Updated by Kefu Chai over 5 years ago

adding the Exception will change the signature of the interface of Rados. so will print the error message to log.

#9 Updated by Kefu Chai over 5 years ago

  • Status changed from New to Fix Under Review

PR posted at https://github.com/ceph/ceph/pull/3873, pending on review.

#10 Updated by Kefu Chai over 5 years ago

  • % Done changed from 0 to 60

#11 Updated by Alfredo Deza over 5 years ago

it would be fantastic to understand what is it that it expected and couldn't find (besides the actual error)

#12 Updated by Kefu Chai over 5 years ago

yeah, i will print the path of file when ceph server/client is trying to open it but fails to do so.=)

#13 Updated by Loic Dachary over 5 years ago

  • Status changed from Fix Under Review to Resolved
  • % Done changed from 60 to 100

#14 Updated by Loic Dachary over 5 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 ;-)

Also available in: Atom PDF