Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.

Bug 1103490

Summary: [REST API]: Missing VM statistics field.
Product: Red Hat Enterprise Virtualization Manager Reporter: Ilanit Stein <istein>
Component: ovirt-engine-restapiAssignee: Tomas Jelinek <tjelinek>
Status: CLOSED ERRATA QA Contact: Ilanit Stein <istein>
Severity: high Docs Contact:
Priority: unspecified    
Version: 3.5.0CC: adahms, bazulay, eedri, gklein, iheim, juan.hernandez, juwu, mavital, michal.skrivanek, oramraz, rbalakri, Rhev-m-bugs, tjelinek, yeylon
Target Milestone: ---Keywords: AutomationBlocker, Regression, Triaged
Target Release: 3.5.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: virt
Fixed In Version: ovirt-3.5.0-alpha2 Doc Type: Bug Fix
Doc Text:
An exception was thrown when the virtual machine statistics was accessed using the REST API, and it was not possible to retrieve the statistics. With this update, users can now access the statistics using the REST API.
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-02-11 18:02:43 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Bug Depends On:    
Bug Blocks: 1142923, 1156165    

Description Ilanit Stein 2014-06-01 13:24:24 UTC
Description of problem:

Automatic test on CI fail on GET VM statistics:

request content is --  url:/ovirt-engine/api/vms/ac65d66b-18b0-4289-8ba1-3dd0e40e7a1e/statistics 
2014-05-29 19:03:41,156 - MainThread - vms - ERROR - Response code is not valid, expected is: [200, 201], actual is: 500 

Jenkins job:
http://jenkins-ci.eng.lab.tlv.redhat.com/view/0%20Unstable%203.5/job/rhevm_3.5_automation_coretools_two_hosts_restapi_vms_nfs_rest_factory/127/
 
Version-Release number of selected component (if applicable):
rhevm-3.5.0-0.1000.1552.4bf744d.master.el6ev.noarch.rpm

How reproducible:
100%

Comment 1 Juan Hernández 2014-06-03 18:08:46 UTC
This happens because we don't check if the migration progress value returned by the backend is null, just call the "setDatum" method. Before that call the JVM will try to unbox the value and thus generate a NPE.

Comment 3 Ilanit Stein 2014-08-07 08:27:06 UTC
Verified on rhevm-3.5,
on the same test.
last commit (origin/master): 541546ecbbe5d1465c17aea03b8b75ed8b87dfbb 

http://jenkins-ci.eng.lab.tlv.redhat.com/view/0%20Unstable%203.5/job/rhevm_3.5_automation_coretools_two_hosts_restapi_vms_nfs_rest_factory/380/

2014-08-06 19:20:11,373 - MainThread - vms - DEBUG - GET request content is --  url:/ovirt-engine/api/vms/787f3b91-c0b5-47e0-b14f-f8c01577073a/statistics 
2014-08-06 19:20:11,641 - MainThread - vms - DEBUG - Response code is valid: [200, 201] 
2014-08-06 19:20:11,673 - MainThread - vms - DEBUG - Response body for GET request is: 
<statistics>
    <statistic href="/ovirt-engine/api/vms/787f3b91-c0b5-47e0-b14f-f8c01577073a/statistics/5a89a1d2-32be-33f7-a0d1-f8b5bc974ff6" id="5a89a1d2-32be-33f7-a0d1-f8b5bc974ff6">
        <name>memory.installed</name>
        <description>Total memory configured</description>
        <values type="INTEGER">
            <value>
                <datum>1073741824</datum>
            </value>
        </values>
        <type>GAUGE</type>
        <unit>BYTES</unit>
        <vm href="/ovirt-engine/api/vms/787f3b91-c0b5-47e0-b14f-f8c01577073a" id="787f3b91-c0b5-47e0-b14f-f8c01577073a"/>
    </statistic>
    <statistic href="/ovirt-engine/api/vms/787f3b91-c0b5-47e0-b14f-f8c01577073a/statistics/b7499508-c1c3-32f0-8174-c1783e57bb08" id="b7499508-c1c3-32f0-8174-c1783e57bb08">
        <name>memory.used</name>
        <description>Memory used (agent)</description>
        <values type="INTEGER">
            <value>
                <datum>0</datum>
            </value>
        </values>
        <type>GAUGE</type>
        <unit>BYTES</unit>
        <vm href="/ovirt-engine/api/vms/787f3b91-c0b5-47e0-b14f-f8c01577073a" id="787f3b91-c0b5-47e0-b14f-f8c01577073a"/>
    </statistic>
    <statistic href="/ovirt-engine/api/vms/787f3b91-c0b5-47e0-b14f-f8c01577073a/statistics/ef802239-b74a-329f-9955-be8fea6b50a4" id="ef802239-b74a-329f-9955-be8fea6b50a4">
        <name>cpu.current.guest</name>
        <description>CPU used by guest</description>
        <values type="DECIMAL">
            <value>
                <datum>0</datum>
            </value>
        </values>
        <type>GAUGE</type>
        <unit>PERCENT</unit>
        <vm href="/ovirt-engine/api/vms/787f3b91-c0b5-47e0-b14f-f8c01577073a" id="787f3b91-c0b5-47e0-b14f-f8c01577073a"/>
    </statistic>
    <statistic href="/ovirt-engine/api/vms/787f3b91-c0b5-47e0-b14f-f8c01577073a/statistics/d849a55f-0049-36f8-ae65-face541473ac" id="d849a55f-0049-36f8-ae65-face541473ac">
        <name>cpu.current.hypervisor</name>
        <description>CPU overhead</description>
        <values type="DECIMAL">
            <value>
                <datum>0</datum>
            </value>
        </values>
        <type>GAUGE</type>
        <unit>PERCENT</unit>
        <vm href="/ovirt-engine/api/vms/787f3b91-c0b5-47e0-b14f-f8c01577073a" id="787f3b91-c0b5-47e0-b14f-f8c01577073a"/>
    </statistic>
    <statistic href="/ovirt-engine/api/vms/787f3b91-c0b5-47e0-b14f-f8c01577073a/statistics/2ec286fe-4bec-32f5-8d63-dba7bed58763" id="2ec286fe-4bec-32f5-8d63-dba7bed58763">
        <name>cpu.current.total</name>
        <description>Total CPU used</description>
        <values type="DECIMAL">
            <value>
                <datum>0</datum>
            </value>
        </values>
        <type>GAUGE</type>
        <unit>PERCENT</unit>
        <vm href="/ovirt-engine/api/vms/787f3b91-c0b5-47e0-b14f-f8c01577073a" id="787f3b91-c0b5-47e0-b14f-f8c01577073a"/>
    </statistic>
    <statistic href="/ovirt-engine/api/vms/787f3b91-c0b5-47e0-b14f-f8c01577073a/statistics/892b69a7-41ca-36b1-9a2e-ae5177ef21bb" id="892b69a7-41ca-36b1-9a2e-ae5177ef21bb">
        <name>migration.progress</name>
        <description>Migration Progress</description>
        <values type="DECIMAL">
            <value>
                <datum>0</datum>
            </value>
        </values>
        <type>GAUGE</type>
        <unit>PERCENT</unit>
        <vm href="/ovirt-engine/api/vms/787f3b91-c0b5-47e0-b14f-f8c01577073a" id="787f3b91-c0b5-47e0-b14f-f8c01577073a"/>
    </statistic>
</statistics>
 
2014-08-06 19:20:11,675 - MainThread - rhevm_api.tests_lib.low_level.vms - INFO - Correct value for memory.installed: 1073741824.0
2014-08-06 19:20:11,675 - MainThread - rhevm_api.tests_lib.low_level.vms - INFO - Correct value for memory.used: 0.0
2014-08-06 19:20:11,675 - MainThread - rhevm_api.tests_lib.low_level.vms - INFO - Correct value for cpu.current.guest: 0.0
2014-08-06 19:20:11,676 - MainThread - rhevm_api.tests_lib.low_level.vms - INFO - Correct value for cpu.current.hypervisor: 0.0
2014-08-06 19:20:11,676 - MainThread - rhevm_api.tests_lib.low_level.vms - INFO - Correct value for cpu.current.total: 0.0
2014-08-06 19:20:11,676 - MainThread - rhevm_api.tests_lib.low_level.vms - INFO - Correct value for migration.progress: 0.0
2014-08-06 19:20:11,677 - MainThread - rhevm_api.tests_lib.low_level.vms - INFO - All 5 statistics appear

Comment 5 errata-xmlrpc 2015-02-11 18:02:43 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHSA-2015-0158.html