nova usage-list returns wrong usage

Bug #1043999 reported by Joe Gordon on 2012-08-30
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
High
Rongze Zhu
Essex
Undecided
Unassigned
nova (Ubuntu)
Undecided
Unassigned
Precise
Undecided
Unassigned

Bug Description

nova usage-list (os-simple-tenant-usage) does not return correct results. the os-simple-tenant-usage extension only gives correct results as called by horizon.

This bug exists in both Essex and Folsom

From devstack:

$ nova usage-list
Usage from 2012-08-02 to 2012-08-31:
+----------------------------------+-----------+--------------+-----------+---------------+
| Tenant ID | Instances | RAM MB-Hours | CPU Hours | Disk GB-Hours |
+----------------------------------+-----------+--------------+-----------+---------------+
| 089a61fd160c474d979849905613428f | 1 | 12699.23 | 24.80 | 0.00 |
+----------------------------------+-----------+--------------+-----------+---------------+

$ nova show 328cb611-28c2-4993-b08b-da505e826700
+-------------------------------------+----------------------------------------------------------------+
| Property | Value |
+-------------------------------------+----------------------------------------------------------------+
| OS-DCF:diskConfig | MANUAL |
| OS-EXT-SRV-ATTR:host | precise |
| OS-EXT-SRV-ATTR:hypervisor_hostname | precise. |
| OS-EXT-SRV-ATTR:instance_name | instance-00000001 |
| OS-EXT-STS:power_state | 1 |
| OS-EXT-STS:task_state | None |
| OS-EXT-STS:vm_state | active |
| accessIPv4 | |
| accessIPv6 | |
| config_drive | |
| created | 2012-08-30T17:48:28Z |
| flavor | m1.tiny (1) |
| hostId | 34d14cb95a830630d9e83b7362ef2505e81f6cb9c4a128f8eaf69f98 |
| id | 328cb611-28c2-4993-b08b-da505e826700 |
| image | cirros-0.3.0-x86_64-uec (c3f27bf5-1201-4431-be06-e4006c2ba2eb) |
| key_name | None |
| metadata | {} |
| name | Server 328cb611-28c2-4993-b08b-da505e826700 |
| private network | 10.0.0.2 |
| progress | 0 |
| security_groups | [{u'name': u'default'}] |
| status | ACTIVE |
| tenant_id | 089a61fd160c474d979849905613428f |
| updated | 2012-08-30T17:48:38Z |
| user_id | a2cd4f25d69d4910a910d80faf541d4a |
+-------------------------------------+----------------------------------------------------------------+

$ nova flavor-list
+----+-----------+-----------+------+-----------+------+-------+-------------+-----------+
| ID | Name | Memory_MB | Disk | Ephemeral | Swap | VCPUs | RXTX_Factor | Is_Public |
+----+-----------+-----------+------+-----------+------+-------+-------------+-----------+
| 1 | m1.tiny | 512 | 0 | 0 | | 1 | 1.0 | True |
| 2 | m1.small | 2048 | 20 | 0 | | 1 | 1.0 | True |
| 3 | m1.medium | 4096 | 40 | 0 | | 2 | 1.0 | True |
| 4 | m1.large | 8192 | 80 | 0 | | 4 | 1.0 | True |
| 5 | m1.xlarge | 16384 | 160 | 0 | | 8 | 1.0 | True |
+----+-----------+-----------+------+-----------+------+-------+-------------+-----------+

Joe Gordon (jogo) on 2012-08-30
description: updated
Russell Bryant (russellb) wrote :

Confirmed. I started a tiny instance on devstack and the values don't seem to make sense. This instance had been up for less than 5 minutes.

[rbryant@f17-devstack devstack]$ nova usage-list
Usage from 2012-08-02 to 2012-08-31:
+----------------------------------+-----------+--------------+-----------+---------------+
| Tenant ID | Instances | RAM MB-Hours | CPU Hours | Disk GB-Hours |
+----------------------------------+-----------+--------------+-----------+---------------+
| 2d1ddbdc656b4106aa52d9916671f472 | 1 | 10254.78 | 20.03 | 0.00 |
+----------------------------------+-----------+--------------+-----------+---------------+

Changed in nova:
status: New → Confirmed
importance: Undecided → Medium
Joe Gordon (jogo) wrote :

Russell, Do you think this should be targeted for folsom-rc1? Without a fix we ship a unusable command

Mark McLoughlin (markmc) on 2012-08-30
Changed in nova:
milestone: none → folsom-rc1
Changed in nova:
importance: Medium → High
Rongze Zhu (zrzhit) on 2012-09-03
Changed in nova:
assignee: nobody → Rongze Zhu (zrzhit)

Fix proposed to branch: master
Review: https://review.openstack.org/12304

Changed in nova:
status: Confirmed → In Progress
Mark McLoughlin (markmc) wrote :

Russell's result of 20 hours for a new instance shows another bug ...

It should actually be 24 hours because of the problem fixed in https://review.openstack.org/12304 but because novaclient is sending the start/end in localtime and Russell is utc-4, we get 20 hours

I've filed bug #1045445 about that problem

Reviewed: https://review.openstack.org/12304
Committed: http://github.com/openstack/nova/commit/869443f41c8826c9a4de1dcc65c5a5354b623a04
Submitter: Jenkins
Branch: master

commit 869443f41c8826c9a4de1dcc65c5a5354b623a04
Author: RongzeZhu <email address hidden>
Date: Sun Sep 2 18:43:56 2012 +0800

    Fix simple_tenant_usage's handing of future end times

    Fixes bug #1043999

    simple_tenant_usage returns the usage in the range between the supplied
    start and end query parameters. The _hours_for() method calculates the
    number of hours the instance was running in this range, even if the end time
    is in the future.

    By default, python-novaclient requests usage between 4 weeks ago and tomorrow.
    This means we a report which accounts for 24 hours of extra running time for
    each currently running instance. Fix this by clamping the period of the
    returned report at the current time.

    Change-Id: I61c211fd85b729aaeaac6ef24644ee19eb5bb6b0

Changed in nova:
status: In Progress → Fix Committed
Joe Gordon (jogo) wrote :

Mark, I cannot find bug #1045445.

Mark McLoughlin (markmc) wrote :

Sorry, I meant bug #1045456

Reviewed: https://review.openstack.org/12479
Committed: http://github.com/openstack/nova/commit/4ac2dcc36bb4e737e486ef86930c023b403a3f3a
Submitter: Jenkins
Branch: stable/essex

commit 4ac2dcc36bb4e737e486ef86930c023b403a3f3a
Author: RongzeZhu <email address hidden>
Date: Sun Sep 2 18:43:56 2012 +0800

    Fix simple_tenant_usage's handing of future end times

    Fixes bug #1043999

    simple_tenant_usage returns the usage in the range between the supplied
    start and end query parameters. The _hours_for() method calculates the
    number of hours the instance was running in this range, even if the end time
    is in the future.

    By default, python-novaclient requests usage between 4 weeks ago and tomorrow.
    This means we a report which accounts for 24 hours of extra running time for
    each currently running instance. Fix this by clamping the period of the
    returned report at the current time.

    Change-Id: I61c211fd85b729aaeaac6ef24644ee19eb5bb6b0
    (cherry picked from commit 869443f41c8826c9a4de1dcc65c5a5354b623a04)

Thierry Carrez (ttx) on 2012-09-19
Changed in nova:
status: Fix Committed → Fix Released
Thierry Carrez (ttx) on 2012-09-27
Changed in nova:
milestone: folsom-rc1 → 2012.2
Changed in nova (Ubuntu):
status: New → Fix Released

Hello Joe, or anyone else affected,

Accepted nova into precise-proposed. The package will build now and be available at http://launchpad.net/ubuntu/+source/nova/2012.1.3+stable-20130423-e52e6912-0ubuntu1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, and change the tag from verification-needed to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

Changed in nova (Ubuntu Precise):
status: New → Fix Committed
tags: added: verification-needed

Please find the attached test log from the Ubuntu Server Team's CI infrastructure. As part of the verification process for this bug, Nova has been deployed and configured across multiple nodes using precise-proposed as an installation source. After successful bring-up and configuration of the cluster, a number of exercises and smoke tests have be invoked to ensure the updated package did not introduce any regressions. A number of test iterations were carried out to catch any possible transient errors.

Please Note the list of installed packages at the top and bottom of the report.

For records of upstream test coverage of this update, please see the Jenkins links in the comments of the relevant upstream code-review(s):

Trunk review: https://review.openstack.org/12304
Stable review: https://review.openstack.org/12479

As per the provisional Micro Release Exception granted to this package by the Technical Board, we hope this contributes toward verification of this update.

Yolanda Robla (yolanda.robla) wrote :

Test coverage log.

Yolanda Robla (yolanda.robla) wrote :

Please find the attached test log from the Ubuntu Server Team's CI infrastructure. As part of the verification process for this bug, Nova has been deployed and configured across multiple nodes using precise-proposed as an installation source. After successful bring-up and configuration of the cluster, a number of exercises and smoke tests have be invoked to ensure the updated package did not introduce any regressions. A number of test iterations were carried out to catch any possible transient errors.

Please Note the list of installed packages at the top and bottom of the report.

For records of upstream test coverage of this update, please see the Jenkins links in the comments of the relevant upstream code-review(s):

Trunk review: https://review.openstack.org/12304
Stable review: https://review.openstack.org/12479

As per the provisional Micro Release Exception granted to this package by the Technical Board, we hope this contributes toward verification of this update.

Yolanda Robla (yolanda.robla) wrote :

Test coverage log.

tags: added: verification-done
removed: verification-needed
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package nova - 2012.1.3+stable-20130423-e52e6912-0ubuntu1

---------------
nova (2012.1.3+stable-20130423-e52e6912-0ubuntu1) precise-proposed; urgency=low

  * Resynchronize with stable/essex (e52e6912) (LP: #1089488):
    - [48e81f1] VNC proxy can be made to connect to wrong VM LP: 1125378
    - [3bf5a58] snat rule too broad for some network configurations LP: 1048765
    - [efaacda] DOS by allocating all fixed ips LP: 1125468
    - [b683ced] Add nosehtmloutput as a test dependency.
    - [45274c8] Nova unit tests not running, but still passing for stable/essex
      LP: 1132835
    - [e02b459] vnc unit-test fixes
    - [87361d3] Jenkins jobs fail because of incompatibility between sqlalchemy-
      migrate and the newest sqlalchemy-0.8.0b1 (LP: #1073569)
    - [e98928c] VNC proxy can be made to connect to wrong VM LP: 1125378
    - [c0a10db] DoS through XML entity expansion (CVE-2013-1664) LP: 1100282
    - [243d516] No authentication on block device used for os-volume_boot
      LP: 1069904
    - [80fefe5] use_single_default_gateway does not function correctly
      (LP: #1075859)
    - [bd10241] Essex 2012.1.3 : Error deleting instance with 2 Nova Volumes
      attached (LP: #1079745)
    - [86a5937] do_refresh_security_group_rules in nova.virt.firewall is very
      slow (LP: #1062314)
    - [ae9c5f4] deallocate_fixed_ip attempts to update an already deleted
      fixed_ip (LP: #1017633)
    - [20f98c5] failed to allocate fixed ip because old deleted one exists
      (LP: #996482)
    - [75f6922] snapshot stays in saving state if the vm base image is deleted
      (LP: #921774)
    - [1076699] lock files may be removed in error dues to permissions issues
      (LP: #1051924)
    - [40c5e94] ensure_default_security_group() does not call sgh (LP: #1050982)
    - [4eebe76] At termination, LXC rootfs is not always unmounted before
      rmtree() is called (LP: #1046313)
    - [47dabb3] Heavily loaded nova-compute instances don't sent reports
      frequently enough (LP: #1045152)
    - [b375b4f] When attach volume lost attach when node restart (LP: #1004791)
    - [4ac2dcc] nova usage-list returns wrong usage (LP: #1043999)
    - [014fcbc] Bridge port's hairpin mode not set after resuming a machine
      (LP: #1040537)
    - [2f35f8e] Nova flavor ephemeral space size reported incorrectly
      (LP: #1026210)
  * Dropped, superseeded by new snapshot:
    - debian/patches/CVE-2013-0335.patch: [48e81f1]
    - debian/patches/CVE-2013-1838.patch: [efaacda]
    - debian/patches/CVE-2013-1664.patch: [c0a10db]
    - debian/patches/CVE-2013-0208.patch: [243d516]
 -- Yolanda <email address hidden> Mon, 22 Apr 2013 12:37:08 +0200

Changed in nova (Ubuntu Precise):
status: Fix Committed → Fix Released

The verification of this Stable Release Update has completed successfully and the package has now been released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regresssions.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers