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

fix: swap makes vms out of disk space report false positive #18623

Merged
merged 1 commit into from
Apr 3, 2019

Conversation

kbrock
Copy link
Member

@kbrock kbrock commented Apr 3, 2019

MiqExpressions convert nil to a floating point number. In ruby this is a 0.

nil <= 20
nil.to_f ==> 0
0 <= 20 == true

Swap partitions have a nil free_space / free_space_percentage.

so free_space_percentage <= 20 shows true for swap

So any vm with a swap partition will say it is low on disk space.

Fix is to ask if used space is over 80%

nil >= 80
nil.to_f ==> 0
0 >= 80 == false

Now, there are no false positives for running out of disk space.

https://bugzilla.redhat.com/show_bug.cgi?id=1686281

MiqExpressions convert nil to a floating point number (which is 0)

nil <= 20 == true
nil.to_f ==> 0
0 <= 20 == true

Swap partitions have a nil free_space / free_space_percentage.

so free_space_percentage <= 20 shows true for swap

So any vm with a swap partition will say it is low on disk space.

Fix is to ask if used space is over 80%

nil >= 80 == false
nil.to_f ==> 0
0 >= 80 == false

https://bugzilla.redhat.com/show_bug.cgi?id=1686281
@miq-bot
Copy link
Member

miq-bot commented Apr 3, 2019

Checked commit kbrock@0daf0d2 with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0
0 files checked, 0 offenses detected
Everything looks fine. 👍

@Fryguy Fryguy merged commit 629474c into ManageIQ:master Apr 3, 2019
@Fryguy Fryguy added this to the Sprint 109 Ending Apr 15, 2019 milestone Apr 3, 2019
@Fryguy Fryguy self-assigned this Apr 3, 2019
@kbrock kbrock deleted the disk_usage_report branch April 4, 2019 15:24
simaishi pushed a commit that referenced this pull request Apr 5, 2019
fix: swap makes vms out of disk space report false positive
(cherry picked from commit 629474c)

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1696420
@simaishi
Copy link
Contributor

simaishi commented Apr 5, 2019

Hammer backport details:

$ git log -1
commit 331132f8c8821c8d1042047aa36f6c63ea9241b6
Author: Jason Frey <fryguy9@gmail.com>
Date:   Wed Apr 3 15:32:44 2019 -0400

    Merge pull request #18623 from kbrock/disk_usage_report
    
    fix: swap makes vms out of disk space report false positive
    (cherry picked from commit 629474ca44471d34b19f0ec4682eaece5f79394e)
    
    Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1696420

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

Successfully merging this pull request may close these issues.

4 participants