← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1282702] Re: Division by 0 error in CPU monitor

 

Canceling this defect since the scenario is using an out-of-tree compute
virt driver (PowerVM).

** Changed in: nova
       Status: In Progress => Invalid

** Changed in: nova
     Assignee: Joe Cropper (jwcroppe) => (unassigned)

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Compute (nova).
https://bugs.launchpad.net/bugs/1282702

Title:
  Division by 0 error in CPU monitor

Status in OpenStack Compute (Nova):
  Invalid

Bug description:
  When enabling the CPU monitor, the code calculcates cputime as cputime
  = float(stats["total"] - self._cpu_stats.get("total", 0)) ... under
  normal scenarios, this is fine.

  However, if the underlying stats haven't changed since the previous
  call, the cputime can be 0 if the underlying stats haven't changed,
  which results in nova-compute errors such as:

  2014-02-20 12:29:48.949 81658 ERROR nova.compute.resource_tracker [-] float division
  2014-02-20 12:29:48.949 81658 TRACE nova.compute.resource_tracker Traceback (most recent call last):
  2014-02-20 12:29:48.949 81658 TRACE nova.compute.resource_tracker   File "/usr/lib/python2.6/site-packages/nova/compute/resource_tracker.py", line 277, in _get_host_metrics
  2014-02-20 12:29:48.949 81658 TRACE nova.compute.resource_tracker     metrics += monitor.get_metrics(nodename=nodename)
  2014-02-20 12:29:48.949 81658 TRACE nova.compute.resource_tracker   File "/usr/lib/python2.6/site-packages/nova/compute/monitors/__init__.py", line 100, in get_metrics
  2014-02-20 12:29:48.949 81658 TRACE nova.compute.resource_tracker     ret = func(self, **kwargs)
  2014-02-20 12:29:48.949 81658 TRACE nova.compute.resource_tracker   File "/usr/lib/python2.6/site-packages/nova/compute/monitors/virt/cpu_monitor.py", line 74, in wrapper
  2014-02-20 12:29:48.949 81658 TRACE nova.compute.resource_tracker     self._update_cpustat()
  2014-02-20 12:29:48.949 81658 TRACE nova.compute.resource_tracker   File "/usr/lib/python2.6/site-packages/nova/compute/monitors/virt/cpu_monitor.py", line 151, in _update_cpustat
  2014-02-20 12:29:48.949 81658 TRACE nova.compute.resource_tracker     perc = (stats["user"] - self._cpu_stats.get("user", 0)) / cputime
  2014-02-20 12:29:48.949 81658 TRACE nova.compute.resource_tracker ZeroDivisionError: float division

  The fix for this is probably to ensure that cputime is non-zero before
  continuing the logic.

To manage notifications about this bug go to:
https://bugs.launchpad.net/nova/+bug/1282702/+subscriptions


References