Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ceph.in: do not throw on unknown errno #4375

Merged
1 commit merged into from May 13, 2015

Conversation

tchaikov
Copy link
Contributor

some of the errnos are not listed in errno.errorcode, if we happen
to run into them print 'Unknown' instead.

Fixes: #11354
Signed-off-by: Kefu Chai kchai@redhat.com

@tchaikov tchaikov added the tools label Apr 16, 2015
@tchaikov tchaikov force-pushed the wip-ceph-unrecognized-exception branch from bdfaa2e to 9d1b8a6 Compare April 17, 2015 03:42

# just a couple of globals

# in case some errno is not recognized.
errorcode = defaultdict(lambda: 'N/A')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps "Unknown" would be a more literal statement here? N/A to me sounds like we're saying an error doesn't matter.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for your review, @jcsp updated according to your suggestion.

@tchaikov tchaikov force-pushed the wip-ceph-unrecognized-exception branch 2 times, most recently from 989962f to 9e9b3a3 Compare April 21, 2015 02:09
@ghost
Copy link

ghost commented May 12, 2015

it looks good, will test is manually. Out of curiosity: why not use errno.errorcode.get(ret, 'Unknown') ?

@tchaikov
Copy link
Contributor Author

@dachary , you are right. will update it to use the vanilla dict.

oh, i just recalled that i wanted to minimize the code churn introduced by this change. and there are three places we are using errnor[ret], so i replaced the errno.errorcode with the defaultdict. sorry, it's been a while and i forgot why i used defaultdict instead of errno.errorcode.get(ret, 'Unknown') when i was reading your comment.

@ghost
Copy link

ghost commented May 12, 2015

@tchaikov ok. How do you suggest I test that manually ? I tried

$ ./ceph 
*** DEVELOPER MODE: setting PATH, PYTHONPATH and LD_LIBRARY_PATH ***
Error initializing cluster client: Error('error calling conf_read_file: errno EINVAL',)

but creating the conditions for the 'Unknown' errno to show seems a little tricky.

@tchaikov
Copy link
Contributor Author

@dachary yeah, it's tricky. how about

  1. replace "crushtool" with a shell script which returns 125 (ECANCEL) and
  2. run "ceph osd setcrushmap" ?

@ghost
Copy link

ghost commented May 12, 2015

@tchaikov of course !

@ghost
Copy link

ghost commented May 12, 2015

@tchaikov I manually set a wrong ret code in the code and saw

ceph> auth list
Error: 230948 Unknown

@ghost
Copy link

ghost commented May 12, 2015

ceph.in is quite difficult to test, even manually :-)

@ghost ghost self-assigned this May 12, 2015
@tchaikov
Copy link
Contributor Author

true. actually, i was testing by whipping up a wrapper around json_command, and hardwired an unknown errcode for a certain command to be tested.

thanks for the review and testing =)

@ghost
Copy link

ghost commented May 13, 2015

@tchaikov just to be sure there is no misunderstanding: you're going to amend the current patch ?

@tchaikov tchaikov force-pushed the wip-ceph-unrecognized-exception branch from 9e9b3a3 to 16f8a4f Compare May 13, 2015 14:09
@tchaikov
Copy link
Contributor Author

@dachary just updated this patch. thought that defaultdict could avoid repeating "Unknown", but seems get(ret, "Unknown") is simpler.

some of the errnos are not listed in errno.errorcode. if we happen
to run into them, print 'Unknown' instead.

Fixes: ceph#11354
Signed-off-by: Kefu Chai <kchai@redhat.com>
@tchaikov tchaikov force-pushed the wip-ceph-unrecognized-exception branch from 16f8a4f to 53514ad Compare May 13, 2015 14:43
@tchaikov
Copy link
Contributor Author

@dachary fixed. could you take a look again? thanks.

@ghost
Copy link

ghost commented May 13, 2015

as soon as the bot comes back green

Reviewed-by: Loic Dachary <ldachary@redhat.com>

ghost pushed a commit that referenced this pull request May 13, 2015
ceph.in: do not throw on unknown errno

Reviewed-by: Loic Dachary <ldachary@redhat.com>
@ghost ghost merged commit b98a921 into ceph:master May 13, 2015
@tchaikov tchaikov deleted the wip-ceph-unrecognized-exception branch May 14, 2015 01:54
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants