pybind/ceph_argparse: Fix error message for ceph tell command#51332
pybind/ceph_argparse: Fix error message for ceph tell command#51332
Conversation
|
After experimenting with all the classes inheriting |
src/pybind/ceph_argparse.py
Outdated
| t, i = s.split('.', 1) | ||
| if t not in ('osd', 'mon', 'client', 'mds', 'mgr'): | ||
| raise ArgumentValid('unknown type ' + t) | ||
| raise JsonFormat('unknown type ' + t) |
There was a problem hiding this comment.
in addition to the outcome of the fix, please explain the reason why this change fixes the symptom you were seeing in the commit message. and a test case would be great.
There was a problem hiding this comment.
per the docstring of JsonFormat
some syntactic or semantic issue with the JSON
but this is not a JSON related error. so i am inclined not using JsonFormat here.
There was a problem hiding this comment.
Yes, I'm left confused by this as well. Perhaps ArgumentValid was caught up the stack and this JsonFormat avoids that? This looks hacky.
There was a problem hiding this comment.
Yup! I went through the code again and re-debugged each flows, where I found that when find_cmd_target() is trying to validate the command by calling CephName and CephPgid, it is failing in the valid() of CephPgid where it is trying to access a variable poolid in the except clause, which isn't assigned yet due to error there. Now, the code works as expected and we are getting the proper error message for wrong cephname type i.e. unknown type ....
|
jenkins retest this please |
tchaikov
left a comment
There was a problem hiding this comment.
$ceph tell cephfs_1.magna023.yvyxvl client ls
error handling command target: local variable 'poolid' referenced before assignmentthe error message
local variable 'poolid' referenced before assignmentlooks not descriptive.
The exception was not getting raised by the usage ofArgumentValidand hence code asks for poolid which is
what's the connection between ArgumentValid and poolid?
i still don't get why / where poolid is referenced
src/pybind/ceph_argparse.py
Outdated
| t, i = s.split('.', 1) | ||
| if t not in ('osd', 'mon', 'client', 'mds', 'mgr'): | ||
| raise ArgumentValid('unknown type ' + t) | ||
| raise JsonFormat('unknown type ' + t) |
There was a problem hiding this comment.
per the docstring of JsonFormat
some syntactic or semantic issue with the JSON
but this is not a JSON related error. so i am inclined not using JsonFormat here.
src/pybind/ceph_argparse.py
Outdated
| int(i) | ||
| except ValueError: | ||
| raise ArgumentFormat(f'osd id {i} not integer') | ||
| raise JsonFormat(f'osd id {i} not integer') |
the title of the commit message reads like a bug report. ideally, the title of the commit message should use the imperative mood. see also https://github.com/ceph/ceph/blob/master/SubmittingPatches.rst#3-describe-your-changes . please use |
d04de87 to
72da79f
Compare
| validate_command(sigdict, ['tell', 'cephfs.c', 'something']) | ||
| except JsonFormat as er: | ||
| pass | ||
| self._assert_valid_command(['tell', 'mon.a', 'something']) |
There was a problem hiding this comment.
This should be a separate test.
src/pybind/ceph_argparse.py
Outdated
| t, i = s.split('.', 1) | ||
| if t not in ('osd', 'mon', 'client', 'mds', 'mgr'): | ||
| raise ArgumentValid('unknown type ' + t) | ||
| raise JsonFormat('unknown type ' + t) |
There was a problem hiding this comment.
Yes, I'm left confused by this as well. Perhaps ArgumentValid was caught up the stack and this JsonFormat avoids that? This looks hacky.
72da79f to
2dd6578
Compare
|
jenkins test make check |
|
This pull request has been automatically marked as stale because it has not had any activity for 60 days. It will be closed if no further activity occurs for another 30 days. |
|
jenkins test make check |
|
Talked with Venky about this PR, he wants approval from core before merging. |
Tagging @ljflores |
|
This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved |
|
@neesingh-rh could you please rebase this change? |
Fixes: https://tracker.ceph.com/issues/59624 Signed-off-by: Neeraj Pratap Singh <neesingh@redhat.com>
Fixes: https://tracker.ceph.com/issues/59624 Signed-off-by: Neeraj Pratap Singh <neesingh@redhat.com>
|
rebased!! |
@rishabh-d-dave We do have an approval from @tchaikov ,it is ready to merge. |
Since RADOS will also be affected by this change, I suppose it's better to do RADOS QA as well? cc @vshankar @ljflores |
@rishabh-d-dave Can we priotize this PR for testing, as we do have BZ targeting 6.1z7 and for this blocker only is tomorrow. If we can by today, otherwise let me know. I will have reply there? |
From CephFS side it's already tested successfully, that's all I can do. Venky and core team are better position to tell whether to merge this or proceed for RADOS QA run. |
@vshankar @ljflores This has BZ associated with this, please check if this can be merged. |
@neesingh-rh mentioned that @tchaikov has approved this, so IMO this is good to merge. |
|
@vshankar Had a chat with Venky about this PR, we need to run other QA suites as well. |
Had a conversation with @neesingh-rh regarding this change. This started out as a different change, but ended up just as a fix in the error message. IMO, this is good to merge. |
$ceph tell cephfs_1.magna023.yvyxvl client ls
error handling command target: local variable 'poolid' referenced before assignment
The error message
local variable 'poolid' referenced before assignmentlooks not descriptive. The exception was not getting raised by the usage ofArgumentValidwhich was getting bypassed and hence code asks for poolid when no type has been provided in tell commands.Now after this fix, we are getting the proper error message as type is unknown for above example.
Fixes: https://tracker.ceph.com/issues/59624
Signed-off-by: Neeraj Pratap Singh neesingh@redhat.com
Contribution Guidelines
To sign and title your commits, please refer to Submitting Patches to Ceph.
If you are submitting a fix for a stable branch (e.g. "pacific"), please refer to Submitting Patches to Ceph - Backports for the proper workflow.
Checklist
Show available Jenkins commands
jenkins retest this pleasejenkins test classic perfjenkins test crimson perfjenkins test signedjenkins test make checkjenkins test make check arm64jenkins test submodulesjenkins test dashboardjenkins test dashboard cephadmjenkins test apijenkins test docsjenkins render docsjenkins test ceph-volume alljenkins test ceph-volume toxjenkins test windows