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
mgr: fix 'ceph fs status' output divided by zero error #25337
Conversation
gmayyyha
commented
Nov 30, 2018
•
edited
edited
- References tracker ticket
- Updates documentation if necessary
- Includes tests for new functionality or reproducer for bug
EAFP. what about just catching |
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.
Btw, these are also broken then: dashboard.services.ceph_service.differentiate
and diskprediction_cloud.common.clusterdata.differentiate
and status.module.Module#get_rate
.
@gmayyyha , @sebastian-philipp - would it make sense to fix these in this PR as well? |
@sebastian-philipp mds subtree migration. |
@LenzGr @sebastian-philipp define a common function to solve all of these? |
a23ca81
to
dc12e39
Compare
@sebastian-philipp done all. |
needs rebase. |
@@ -30,6 +30,8 @@ def differentiate(data1, data2): | |||
# >>> differentiate(*zip(times, values)) | |||
0.5 | |||
""" | |||
if float(data2[0] - data1[0]) == 0: | |||
return 0 | |||
return (data2[1] - data1[1]) / float(data2[0] - data1[0]) |
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.
Would be nice if you could merge both copies of differentiate
into a new common file: src/pybind/mgr/mgr_util.py
. Let's fight code duplication inside mgr modules.
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.
done.
Relates to #25360 |
Signed-off-by: Yanhu Cao <gmayyyha@gmail.com>
dc12e39
to
e82dfab
Compare
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
replaced with #26270 |