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
osd: fix the "heap" admin cmd printing always to error stream #47650
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks Radoslaw! I saw your PR a bit late, actually I was working on similar approach. We need similar fix for MDS as well.
Agree with @pdvian, this looks good. Just need to be applied to MDS as well. |
Working on that. However, when experimenting, I encountered a broader difference between |
Before the patch `ceph::osd_cmds::heap()` was confusing the concepts of _stderr_ and _stdout_. This was the direct cause of the differences in output between `ceph tell` and `ceph daeamon`. Thanks to Laura Flores who made the extremely useful observation noted in https://tracker.ceph.com/issues/57119#note-3. Fixes: https://tracker.ceph.com/issues/57119 Signed-off-by: Radoslaw Zarzynski <rzarzyns@redhat.com>
8c15e54
to
9443647
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the fix.
jenkins test make check |
|
jenkins retest this please |
1 similar comment
jenkins retest this please |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was initially worried about how this PR might change how mgr modules can access heap command output, i.e. Telemetry. Currently, Telemetry accesses heap stats output via the "error" stream, which is a bug as pointed out in this PR. But we still need to maintain this connection between the heap admin command and the mgr module.
After a conversation with @rzarzynski, we found that manager modules will still be able to access heap stats output despite it not being sent in the error stream. Instead, it will be accessible via outbl
, as the out stream is appended there.
For example, Telemetry's current implementation for accessing heap stats is:
https://github.com/ceph/ceph/blob/main/src/pybind/mgr/telemetry/module.py#L478-L483
cmd_dict = {
'prefix': 'heap',
'heapcmd': 'stats',
'id': str(osd_id),
}
r, outb, outs = self.osd_command(cmd_dict)
Where r
is the ret value, outb
contains JSON where applicable, and outs
is the error stream which would contain heap stats string output.
With Radek's change, the heap stats output would be accessible via outb
instead of outs
. I previously thought that outb
only held JSON output, but per Radek's PR, the result from the outstream is also appended there. This means that we can still access heap stats that way, simply by referencing outb
instead of outs
.
It is important to me that this communication between the heap admin command and the mgr is maintained, and now I see that it is.
@jdurgin this is was I was explaining to you earlier today; we have sorted it out! :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great! Glad all the output is still available for the mgr too!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rzarzynski can we leave a note here under send_command
to clarify how output is received?
ceph/src/pybind/mgr/mgr_module.py
Lines 1652 to 1653 in 9a5e897
Called by the plugin to send a command to the mon | |
cluster. |
Called by the plugin to send a command to the mon
cluster.
+
+ Result contains three values:
+ 1. status int
+ 2. out std (can be used to load JSON output or receive standard string output)
+ 3. err str (receives error string output)
Something like this to clarify how output can be processed in the manager module.
Following the merge of ceph#47650, which fixes the confusion between std out and std err in admin socket commands, we will need to reference the out stream (outb) instead of the error stream (outs) when we parse heap stats. Signed-off-by: Laura Flores <lflores@redhat.com>
Gonna get started on testing this: https://shaman.ceph.com/builds/ceph/rzarzynski-wip-bug-57119/94436475c4c9a11a94dd21c619c9ae0014ac393d/default/315415/ |
QA run for CephFS was successful - https://tracker.ceph.com/projects/cephfs/wiki/Main#2022-Aug-26 |
Following the merge of #47650, which fixes the confusion between std out and std err in admin socket commands, we will need to reference the out stream (outb) instead of the error stream (outs) when we parse heap stats. Signed-off-by: Laura Flores <lflores@redhat.com> (cherry picked from commit 025f810)
jenkins test make check arm64 |
jenkins test windows |
Unrelated failure:
tracked by: |
jenkins test make check |
jenkins test make check |
Following the merge of #47650, which fixes the confusion between std out and std err in admin socket commands, we will need to reference the out stream (outb) instead of the error stream (outs) when we parse heap stats. Signed-off-by: Laura Flores <lflores@redhat.com>
Following the merge of #47650, which fixes the confusion between std out and std err in admin socket commands, we will need to reference the out stream (outb) instead of the error stream (outs) when we parse heap stats. Signed-off-by: Laura Flores <lflores@redhat.com>
Before the patch
ceph::osd_cmds::heap()
was confusing the concepts of stderr and stdout. This was the direct cause of the differences in output betweenceph tell
andceph daeamon
.Thanks to Laura Flores who made the extremely useful observation noted in https://tracker.ceph.com/issues/57119#note-3.
Fixes: https://tracker.ceph.com/issues/57119
Signed-off-by: Radoslaw Zarzynski rzarzyns@redhat.com
CC: @ljflores.
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 please
jenkins test classic perf
jenkins test crimson perf
jenkins test signed
jenkins test make check
jenkins test make check arm64
jenkins test submodules
jenkins test dashboard
jenkins test dashboard cephadm
jenkins test api
jenkins test docs
jenkins render docs
jenkins test ceph-volume all
jenkins test ceph-volume tox
jenkins test windows