Project

General

Profile

Actions

Bug #11220

closed

Ceph Clis should return better error codes, by which one can identify the issue

Added by Rajesh Nambiar about 9 years ago. Updated almost 9 years ago.

Status:
Rejected
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
% Done:

0%

Source:
Community (dev)
Tags:
Backport:
Regression:
No
Severity:
5 - suggestion
Reviewed:
Affected Versions:
ceph-qa-suite:
Pull request ID:
Crash signature (v1):
Crash signature (v2):

Description

I believe the beauty and power of the CLIs lies in the fact that how well it can be used with the scripts to make some meaning task out of it.

One of the important aspect of it the error code which is returned by Ceph Clis. For example in case of rbd I see that it returns 0(as success), 1(as failure) or sometimes negative values.If a user is using rbd in its script he may not be able to come to any conclusion from those return codes.
Rather it will be great if some published error codes are returned by the clis, hence when in script user sees that error code he knows the cause of the error and hence he may take necessary action in his script.

Also by having the error codes which are common for all ceph clis they can be mapped to a common error message.So error messages can be standardized.

I feel there wont be much change needed for it

Algorithm
---------
1) Rename the current main() function to some other name say CliMain()
2) Call this CliMain() from main()
3) RbdMain() returns appropriate error code
4) Map this error code to its error message

typedef enum ceph_cli_status {
CEPH_CLI_SUCCESS
CEPH_CLI_FAIL,
CEPH_CLI_INVALID_OPTION_VALUE,
....
....
}CEPH_CLI_STATUS

int main() {
CEPH_CLI_STATUS errCode = CliMain();
Map this error code errCode from CliMain() to Error message
Display the message in some format say <module name>: Error message
return errCode
}

CliMain() {
do the complete processing
}

Actions #1

Updated by Loïc Dachary almost 9 years ago

  • Status changed from New to Rejected
  • Regression set to No

It looks like you suggest an extensive change that would be better discussed as a blueprint in the next CDS. Would you like to submit one at http://tracker.ceph.com/projects/ceph/wiki/Jewel ?

Actions

Also available in: Atom PDF