← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1715570] [NEW] simple tenant usage api calculating disk usages incorrectly

 

Public bug reported:

As of now on current master the simple tenant usage api is calculating
disk usages information incorrectly in case in instance is booted from
volume.

If user boots the instance from volume then the disk usages should not
be considered but it's taking the flavor.root_gb as local_gb used.

Steps to reproduce:

1. Create bootable volume

$ cinder create 1 --name bootable_volume --image 33a7f2aa-
5e48-4545-a484-b598abdee1e3

+--------------------------------------+-----------+-----------------+------+-------------+----------+-------------+
| ID                                   | Status    | Name            | Size | Volume Type | Bootable | Attached to |
+--------------------------------------+-----------+-----------------+------+-------------+----------+-------------+
| 0399f203-5f36-4b9a-b76f-bada8b9afdc6 | available | bootable_volume | 1    | lvmdriver-1 | true     |             |
+--------------------------------------+-----------+-----------------+------+-------------+----------+-------------+

2. Flavor details:

$ nova flavor-show 1
+----------------------------+---------+
| Property                   | Value   |
+----------------------------+---------+
| OS-FLV-DISABLED:disabled   | False   |
| OS-FLV-EXT-DATA:ephemeral  | 0       |
| disk                       | 1       |
| extra_specs                | {}      |
| id                         | 1       |
| name                       | m1.tiny |
| os-flavor-access:is_public | True    |
| ram                        | 512     |
| rxtx_factor                | 1.0     |
| swap                       |         |
| vcpus                      | 1       |
+----------------------------+---------+

3. Create instance from volume:

$ nova boot --flavor 1 --boot-volume 0399f203-5f36-4b9a-b76f-
bada8b9afdc6 boot-from-volume

+--------------------------------------+------------------+--------+------------+-------------+---------------------------------+
| ID                                   | Name             | Status | Task State | Power State | Networks                        |
+--------------------------------------+------------------+--------+------------+-------------+---------------------------------+
| c46243b7-9034-4847-a9c5-480f5e60f59f | boot-from-volume | ACTIVE | -          | Running     | public=172.24.4.11, 2001:db8::8 |
+--------------------------------------+------------------+--------+------------+-------------+---------------------------------+

4. Check the simple tenant usage:

$ nova usage --tenant f77f8f0f6f1b46fe8a43b27a5372f427 --start 2017-09-07
																																																								   
Usage from 2017-09-07 to 2017-09-08:
+---------+--------------+-----------+---------------+
| Servers | RAM MB-Hours | CPU Hours | Disk GB-Hours |
+---------+--------------+-----------+---------------+
| 2       | 3602.99      | 7.04      | 7.04          |
+---------+--------------+-----------+---------------+

Note: You can see the more details of resource usage below for individual instances under tenant:
See the second indtsnce usages there it's showing local_gb as 1 that means flavor.root_gb is used
even if the instance is booted from volume.

$ curl -g -i -X GET "http://10.232.48.200/compute/v2.1/os-simple-tenant-
usage/f77f8f0f6f1b46fe8a43b27a5372f427?start=2017-09-07T00:00:00&end=2017-09-08T06:58:01.961267"
-H "OpenStack-API-Version: compute 2.53" -H "User-Agent: python-
novaclient" -H "Accept: application/json" -H "X-OpenStack-Nova-API-
Version: 2.53" -H "X-Auth-Token: 51a6cb7d32b14bb7b22827f517e3d544"

HTTP/1.1 200 OK
Date: Thu, 07 Sep 2017 07:00:29 GMT
Server: Apache/2.4.18 (Ubuntu)
Content-Length: 993
Content-Type: application/json
OpenStack-API-Version: compute 2.53
X-OpenStack-Nova-API-Version: 2.53
Vary: OpenStack-API-Version,X-OpenStack-Nova-API-Version
x-openstack-request-id: req-b5f88549-1908-47ad-ba02-f3b174e6ca22
x-compute-request-id: req-b5f88549-1908-47ad-ba02-f3b174e6ca22
Connection: close

{
"tenant_usage": {"total_memory_mb_usage": 3591.7622866488887, "total_vcpus_usage": 7.015160716111111, "start": "2017-09-07T00:00:00.000000", "tenant_id": "f77f8f0f6f1b46fe8a43b27a5372f427", "stop": "2017-09-07T07:00:29.578578", "server_usages": [

{"instance_id": "0280c4ff-6401-477d-93d6-c22077c9f8f1", "uptime": 64741,
"started_at": "2017-09-06T12:56:09.000000", "ended_at":
"2017-09-07T06:55:10.000000", "memory_mb": 512, "tenant_id":
"f77f8f0f6f1b46fe8a43b27a5372f427", "state": "terminated", "hours":
6.919444444444444, "vcpus": 1, "flavor": "m1.tiny", "local_gb": 1,
"name": "test"},

{"instance_id": "c46243b7-9034-4847-a9c5-480f5e60f59f", "uptime": 344, "started_at": "2017-09-07T06:54:45.000000", "ended_at": null, "memory_mb": 512, "tenant_id": "f77f8f0f6f1b46fe8a43b27a5372f427", "state": "active", "hours": 0.09571627166666666, "vcpus": 1, "flavor": "m1.tiny", "local_gb": 1, "name": "boot-from-volume"}], "total_hours": 7.015160716111111, "total_local_gb_usage": 7.015160716111111}
}

** Affects: nova
     Importance: Undecided
     Assignee: Bhagyashri Shewale (bhagyashri-shewale)
         Status: New

** Changed in: nova
     Assignee: (unassigned) => Bhagyashri Shewale (bhagyashri-shewale)

-- 
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/1715570

Title:
  simple tenant usage api calculating disk usages incorrectly

Status in OpenStack Compute (nova):
  New

Bug description:
  As of now on current master the simple tenant usage api is calculating
  disk usages information incorrectly in case in instance is booted from
  volume.

  If user boots the instance from volume then the disk usages should not
  be considered but it's taking the flavor.root_gb as local_gb used.

  Steps to reproduce:

  1. Create bootable volume

  $ cinder create 1 --name bootable_volume --image 33a7f2aa-
  5e48-4545-a484-b598abdee1e3

  +--------------------------------------+-----------+-----------------+------+-------------+----------+-------------+
  | ID                                   | Status    | Name            | Size | Volume Type | Bootable | Attached to |
  +--------------------------------------+-----------+-----------------+------+-------------+----------+-------------+
  | 0399f203-5f36-4b9a-b76f-bada8b9afdc6 | available | bootable_volume | 1    | lvmdriver-1 | true     |             |
  +--------------------------------------+-----------+-----------------+------+-------------+----------+-------------+

  2. Flavor details:

  $ nova flavor-show 1
  +----------------------------+---------+
  | Property                   | Value   |
  +----------------------------+---------+
  | OS-FLV-DISABLED:disabled   | False   |
  | OS-FLV-EXT-DATA:ephemeral  | 0       |
  | disk                       | 1       |
  | extra_specs                | {}      |
  | id                         | 1       |
  | name                       | m1.tiny |
  | os-flavor-access:is_public | True    |
  | ram                        | 512     |
  | rxtx_factor                | 1.0     |
  | swap                       |         |
  | vcpus                      | 1       |
  +----------------------------+---------+

  3. Create instance from volume:

  $ nova boot --flavor 1 --boot-volume 0399f203-5f36-4b9a-b76f-
  bada8b9afdc6 boot-from-volume

  +--------------------------------------+------------------+--------+------------+-------------+---------------------------------+
  | ID                                   | Name             | Status | Task State | Power State | Networks                        |
  +--------------------------------------+------------------+--------+------------+-------------+---------------------------------+
  | c46243b7-9034-4847-a9c5-480f5e60f59f | boot-from-volume | ACTIVE | -          | Running     | public=172.24.4.11, 2001:db8::8 |
  +--------------------------------------+------------------+--------+------------+-------------+---------------------------------+

  4. Check the simple tenant usage:

  $ nova usage --tenant f77f8f0f6f1b46fe8a43b27a5372f427 --start 2017-09-07
  																																																								   
  Usage from 2017-09-07 to 2017-09-08:
  +---------+--------------+-----------+---------------+
  | Servers | RAM MB-Hours | CPU Hours | Disk GB-Hours |
  +---------+--------------+-----------+---------------+
  | 2       | 3602.99      | 7.04      | 7.04          |
  +---------+--------------+-----------+---------------+

  Note: You can see the more details of resource usage below for individual instances under tenant:
  See the second indtsnce usages there it's showing local_gb as 1 that means flavor.root_gb is used
  even if the instance is booted from volume.

  $ curl -g -i -X GET "http://10.232.48.200/compute/v2.1/os-simple-
  tenant-
  usage/f77f8f0f6f1b46fe8a43b27a5372f427?start=2017-09-07T00:00:00&end=2017-09-08T06:58:01.961267"
  -H "OpenStack-API-Version: compute 2.53" -H "User-Agent: python-
  novaclient" -H "Accept: application/json" -H "X-OpenStack-Nova-API-
  Version: 2.53" -H "X-Auth-Token: 51a6cb7d32b14bb7b22827f517e3d544"

  HTTP/1.1 200 OK
  Date: Thu, 07 Sep 2017 07:00:29 GMT
  Server: Apache/2.4.18 (Ubuntu)
  Content-Length: 993
  Content-Type: application/json
  OpenStack-API-Version: compute 2.53
  X-OpenStack-Nova-API-Version: 2.53
  Vary: OpenStack-API-Version,X-OpenStack-Nova-API-Version
  x-openstack-request-id: req-b5f88549-1908-47ad-ba02-f3b174e6ca22
  x-compute-request-id: req-b5f88549-1908-47ad-ba02-f3b174e6ca22
  Connection: close

  {
  "tenant_usage": {"total_memory_mb_usage": 3591.7622866488887, "total_vcpus_usage": 7.015160716111111, "start": "2017-09-07T00:00:00.000000", "tenant_id": "f77f8f0f6f1b46fe8a43b27a5372f427", "stop": "2017-09-07T07:00:29.578578", "server_usages": [

  {"instance_id": "0280c4ff-6401-477d-93d6-c22077c9f8f1", "uptime":
  64741, "started_at": "2017-09-06T12:56:09.000000", "ended_at":
  "2017-09-07T06:55:10.000000", "memory_mb": 512, "tenant_id":
  "f77f8f0f6f1b46fe8a43b27a5372f427", "state": "terminated", "hours":
  6.919444444444444, "vcpus": 1, "flavor": "m1.tiny", "local_gb": 1,
  "name": "test"},

  {"instance_id": "c46243b7-9034-4847-a9c5-480f5e60f59f", "uptime": 344, "started_at": "2017-09-07T06:54:45.000000", "ended_at": null, "memory_mb": 512, "tenant_id": "f77f8f0f6f1b46fe8a43b27a5372f427", "state": "active", "hours": 0.09571627166666666, "vcpus": 1, "flavor": "m1.tiny", "local_gb": 1, "name": "boot-from-volume"}], "total_hours": 7.015160716111111, "total_local_gb_usage": 7.015160716111111}
  }

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