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

mon/OSDMonitor: fix dividing by zero in OSDUtilizationDumper #13531

Merged
merged 1 commit into from Feb 27, 2017

Conversation

LiumxNL
Copy link
Contributor

@LiumxNL LiumxNL commented Feb 20, 2017

Signed-off-by: Mingxin Liu mingxin@xsky.com

@LiumxNL LiumxNL changed the title osd/OSDMonitor: fix deviding by zero in OSDUtilizationDumper mon/OSDMonitor: fix deviding by zero in OSDUtilizationDumper Feb 20, 2017
@@ -641,7 +641,10 @@ class OSDUtilizationDumper : public CrushTreeDumper::Dumper<F> {
int64_t kb = 0, kb_used = 0, kb_avail = 0;
double util = 0;
if (get_bucket_utilization(qi.id, &kb, &kb_used, &kb_avail))
if (kb_used) {
assert(kb > 0);
Copy link
Contributor

Choose a reason for hiding this comment

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

this does not fix the divide by zero issue. if kb is 0, monitor crashes as before.

@tchaikov tchaikov added the mon label Feb 20, 2017
Signed-off-by: Mingxin Liu <mingxin@xsky.com>
@Daveweco
Copy link

LGTM

@LiumxNL
Copy link
Contributor Author

LiumxNL commented Feb 21, 2017

@tchaikov updated

@tchaikov tchaikov self-assigned this Feb 21, 2017
@tchaikov tchaikov changed the title mon/OSDMonitor: fix deviding by zero in OSDUtilizationDumper mon/OSDMonitor: fix dividing by zero in OSDUtilizationDumper Feb 21, 2017
@tchaikov
Copy link
Contributor

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