Bug 1686281

Summary: The "VMs with Volume Free Space <= 20%" report showing VMs which has volume free space more than 20% also.
Product: Red Hat CloudForms Management Engine Reporter: Nikhil Gupta <ngupta>
Component: ReportingAssignee: Keenan Brock <kbrock>
Status: CLOSED CURRENTRELEASE QA Contact: Parthvi Vala <pvala>
Severity: medium Docs Contact: Red Hat CloudForms Documentation <cloudforms-docs>
Priority: medium    
Version: 5.10.1CC: dmetzger, jprause, kbrock, mshriver, obarenbo, simaishi
Target Milestone: GAKeywords: TestOnly, ZStream
Target Release: 5.11.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: 5.11.0.1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1696420 (view as bug list) Environment:
Last Closed: 2019-12-13 15:16:27 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: Bug
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: CFME Core Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1692488, 1696420    
Attachments:
Description Flags
VMs with Volume Free Space <= 20% report none

Description Nikhil Gupta 2019-03-07 07:36:22 UTC
Description of problem:
When we create a report from "VMs with Volume Free Space <= 20%" default report to get all VMs details which has volume free space less than or equal to 20%. However, it is reporting some Vms which has volume free space more than 20%.


Version-Release number of selected component (if applicable):
cfme-5.10

How reproducible:
Always

Steps to Reproduce:
1. Go to Cloud Intel -> Reports -> All Reports -> Configuration Management -> Virtual Machines
2. Click on "VMs with Volume Free Space <= 20%" default report.
3. Queue it.

Actual results:
It is reporting VMs which has volume free space more than 20%.

Expected results:
It should report only those VMs which has volume free space less than or equal to 20%.

Comment 2 Nikhil Gupta 2019-03-07 23:10:01 UTC
Created attachment 1541986 [details]
VMs with Volume Free Space <= 20% report

Comment 4 Keenan Brock 2019-04-03 18:33:51 UTC
It looks like the miq expression is getting confused when there is no disk usage number for a volume.

I put together a few disk volumes to test:

NO:  v1
     vol_v1: 7516192768 (70.0%)  of 10737418240
RPT: v2
     vol_v2: 8589934592 (80.0%)  of 10737418240
RPT: v3
     vol_v3: 9663676416 (90.0%)  of 10737418240
RPT: v4 (will hide this)
     vol_v4: NIL (NIL%)  of NIL
RPT: v5 (will hide this)
     vol_v5: NIL (NIL%)  of 0
RPT: v6 (will hide this)
     vol_v6: 0 (NIL%)  of NIL
RPT: v7
     vol_v7: 0 (0.0%)  of 10737418240
     vol_v7_1: 9663676416 (90.0%)  of 10737418240
RPT: v8 (will hide this)
     vol_v8: 0 (0.0%)  of 10737418240
     vol_v8_1: 5368709120 (50.0%)  of 10737418240
     vol_v8_2: NIL (NIL%)  of 10737418240
NO:  v9
     vol_v9: 0 (0.0%)  of 10737418240
     vol_v9_1: 5368709120 (50.0%)  of 10737418240
     vol_v9_2: 0 (0.0%)  of 10737418240


vm #8 has plenty of disk space, but the "swap" volume, with the nil disk usage, is showing up as 0% free, and causing the vm to show up in the report.

I will changing the procedure to say used_space_percent >= 80% - this will not show vms that have volumes with unknown disk space

Comment 6 CFME Bot 2019-04-03 19:35:55 UTC
New commit detected on ManageIQ/manageiq/master:

https://github.com/ManageIQ/manageiq/commit/0daf0d2a4c940e43079a81263ea91c097898df6a
commit 0daf0d2a4c940e43079a81263ea91c097898df6a
Author:     Keenan Brock <keenan>
AuthorDate: Wed Apr  3 14:57:12 2019 -0400
Commit:     Keenan Brock <keenan>
CommitDate: Wed Apr  3 14:57:12 2019 -0400

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

    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
 product/reports/100_Configuration Management - Virtual Machines/028_VMs with Volume Free Space -= 20%.yaml | 6 +-
 1 file changed, 3 insertions(+), 3 deletions(-)

Comment 8 Parthvi Vala 2019-05-06 10:46:55 UTC
FIXED. Verified on 5.11.0.2.20190430174828_0e34dea.