Comment 2 for bug 1490837

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/219153
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=7fe05a8ca45b36c173458b92aa6ad6d9df861736
Submitter: Jenkins
Branch: master

commit 7fe05a8ca45b36c173458b92aa6ad6d9df861736
Author: Joe Cropper <email address hidden>
Date: Tue Sep 1 01:18:15 2015 -0500

    Ensure Nova metrics derived from a set of metrics

    This patch addresses a problem in which the current Nova metrics can
    yield a set of incoherent results. For example, prior to this patch,
    it is possible that a collection of metrics sent in a single RPC
    notification message can contain values such as the following:

    {'cpu.user.percent': A, 'cpu.kernel.percent': B,
     'cpu.idle.percent': C, 'cpu.iowait.percent': D} such that you can
    end up with A + B + C + D != 100, which does not make any sense
    from an end consumer perspective.

    The root cause of this problem stems from the fact that each
    individual metric retrieval (i.e., via get_metric(name)) could
    result in the driver.get_host_cpu_stats() function being called,
    which leads to the incoherent results mentioned above.

    To solve this, we only refresh the metric data once per collection
    cycle. Additionally, the `Monitor` base class uses get_metrics()
    instead of get_metric() and returns a 3-tuple of the form
    (metric_name, metric_value, timestamp).

    This patch also removes some code from the CPU virt_driver's
    _update_data() method that checked whether the last call was
    less than 1 second ago, which seemed to try to solve this
    coherency issue, but didn't really work all of the time (and hence
    how this defect was encountered to begin with). Given we use the
    [more appropriate] metric set approach now, this code no longer
    serves any purpose.

    Unit tests updated to work with the new framework.

    Change-Id: Ia23783f2e6b92b3af2e9acf09f95a9eeacd8eb3b
    Closes-Bug: 1490837
    Co-authored-by: Jay Pipes <email address hidden>