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

mgr: fix 'ceph fs status' output divided by zero error #25337

Closed
wants to merge 1 commit into from

Conversation

gmayyyha
Copy link
Contributor

@gmayyyha gmayyyha commented Nov 30, 2018

Error EINVAL: Traceback (most recent call last):
  File "/home/tiger/ceph/src/pybind/mgr/status/module.py", line 314, in handle_command
    return self.handle_fs_status(cmd)
  File "/home/tiger/ceph/src/pybind/mgr/status/module.py", line 174, in handle_fs_status
    ) + "/s"
  File "/home/tiger/ceph/src/pybind/mgr/status/module.py", line 113, in get_rate
    return (data[-1][1] - data[-2][1]) / float(data[-1][0] - data[-2][0])
ZeroDivisionError: float division by zero
  • References tracker ticket
  • Updates documentation if necessary
  • Includes tests for new functionality or reproducer for bug

@sebastian-philipp
Copy link
Contributor

EAFP. what about just catching ZeroDivisionError?

Copy link
Contributor

@sebastian-philipp sebastian-philipp left a 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 .

@LenzGr
Copy link
Contributor

LenzGr commented Nov 30, 2018

Btw, these are also broken then [...]

@gmayyyha , @sebastian-philipp - would it make sense to fix these in this PR as well?

@gmayyyha
Copy link
Contributor Author

gmayyyha commented Dec 1, 2018

EAFP. what about just catching ZeroDivisionError?

@sebastian-philipp mds subtree migration.

@gmayyyha
Copy link
Contributor Author

gmayyyha commented Dec 1, 2018

Btw, these are also broken then [...]

@gmayyyha , @sebastian-philipp - would it make sense to fix these in this PR as well?

@LenzGr @sebastian-philipp define a common function to solve all of these?

@gmayyyha
Copy link
Contributor Author

gmayyyha commented Dec 3, 2018

@sebastian-philipp done all.

@sebastian-philipp
Copy link
Contributor

sebastian-philipp commented Dec 3, 2018

needs rebase. diskprediction was renamed to diskprediction_cloud.

@@ -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])
Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done.

@sebastian-philipp
Copy link
Contributor

Relates to #25360

Signed-off-by: Yanhu Cao <gmayyyha@gmail.com>
@stale
Copy link

stale bot commented Feb 3, 2019

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.
If you are a maintainer or core committer, please follow-up on this issue to identify what steps should be taken by the author to move this proposed change forward.
If you are the author of this pull request, thank you for your proposed contribution. If you believe this change is still appropriate, please ensure that any feedback has been addressed and ask for a code review.

@sebastian-philipp
Copy link
Contributor

replaced with #26270

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants