Bug 1460202 - openstack usage list produces an error when flavor is deleted
openstack usage list produces an error when flavor is deleted
Status: CLOSED INSUFFICIENT_DATA
Product: Red Hat OpenStack
Classification: Red Hat
Component: openstack-nova (Show other bugs)
10.0 (Newton)
Unspecified Unspecified
unspecified Severity low
: ---
: ---
Assigned To: Rajesh Tailor
Joe H. Rahme
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2017-06-09 07:09 EDT by Eduardas
Modified: 2017-07-11 07:23 EDT (History)
11 users (show)

See Also:
Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2017-07-11 07:23:27 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Eduardas 2017-06-09 07:09:04 EDT
Description of problem:
If instance existed within usage listing period and was deleted, also flavor it was using was deleted openstack usage listing produces 'unknown nova api error'

Version-Release number of selected component (if applicable):
openstack-nova-api-14.0.3-8.el7ost.noarch

How reproducible:
Can be reproduced by creating instance with a flavor, deleting instance, deleting flavor.

Steps to Reproduce:
1. Create flavor
2. Create intance
3. Delete instance
4. Delete flavor

Actual results:
Horizon produces error message 'Error: Unable to retrieve usage information.'
openstack usage list produces error message: nexpected API Error. Please report this at http://bugs.launchpad.net/nova/ and attach the Nova API log if possible.
<class 'nova.exception.InstanceNotFound'> (HTTP 500)

Expected results:
Usage information is provided.

Additional info:

Error in nova-api.log:

2017-06-09 09:22:29.339 115528 ERROR nova.api.openstack.extensions [req-6b546481-9c0a-4add-b654-9c305b8c19c7 90a9e21eb123445a8e6bd4c62aaedbf7 00a0bed8529e4454aa0c50c24320a453 - default default] Unexpected exception in API method
2017-06-09 09:22:29.339 115528 ERROR nova.api.openstack.extensions Traceback (most recent call last):
2017-06-09 09:22:29.339 115528 ERROR nova.api.openstack.extensions   File "/usr/lib/python2.7/site-packages/nova/api/openstack/extensions.py", line 338, in wrapped
2017-06-09 09:22:29.339 115528 ERROR nova.api.openstack.extensions     return f(*args, **kwargs)
2017-06-09 09:22:29.339 115528 ERROR nova.api.openstack.extensions   File "/usr/lib/python2.7/site-packages/nova/api/openstack/compute/simple_tenant_usage.py", line 263, in show
2017-06-09 09:22:29.339 115528 ERROR nova.api.openstack.extensions     detailed=True)
2017-06-09 09:22:29.339 115528 ERROR nova.api.openstack.extensions   File "/usr/lib/python2.7/site-packages/nova/api/openstack/compute/simple_tenant_usage.py", line 123, in _tenant_usages_for_period
2017-06-09 09:22:29.339 115528 ERROR nova.api.openstack.extensions     info['memory_mb'] = instance.flavor.memory_mb
2017-06-09 09:22:29.339 115528 ERROR nova.api.openstack.extensions   File "/usr/lib/python2.7/site-packages/oslo_versionedobjects/base.py", line 67, in getter
2017-06-09 09:22:29.339 115528 ERROR nova.api.openstack.extensions     self.obj_load_attr(name)
2017-06-09 09:22:29.339 115528 ERROR nova.api.openstack.extensions   File "/usr/lib/python2.7/site-packages/nova/objects/instance.py", line 1041, in obj_load_attr
2017-06-09 09:22:29.339 115528 ERROR nova.api.openstack.extensions     self._load_flavor()
2017-06-09 09:22:29.339 115528 ERROR nova.api.openstack.extensions   File "/usr/lib/python2.7/site-packages/nova/objects/instance.py", line 863, in _load_flavor
2017-06-09 09:22:29.339 115528 ERROR nova.api.openstack.extensions     expected_attrs=['flavor', 'system_metadata'])
2017-06-09 09:22:29.339 115528 ERROR nova.api.openstack.extensions   File "/usr/lib/python2.7/site-packages/oslo_versionedobjects/base.py", line 184, in wrapper
2017-06-09 09:22:29.339 115528 ERROR nova.api.openstack.extensions     result = fn(cls, context, *args, **kwargs)
2017-06-09 09:22:29.339 115528 ERROR nova.api.openstack.extensions   File "/usr/lib/python2.7/site-packages/nova/objects/instance.py", line 457, in get_by_uuid
2017-06-09 09:22:29.339 115528 ERROR nova.api.openstack.extensions     use_slave=use_slave)
2017-06-09 09:22:29.339 115528 ERROR nova.api.openstack.extensions   File "/usr/lib/python2.7/site-packages/nova/db/sqlalchemy/api.py", line 225, in wrapper
2017-06-09 09:22:29.339 115528 ERROR nova.api.openstack.extensions     return f(*args, **kwargs)
2017-06-09 09:22:29.339 115528 ERROR nova.api.openstack.extensions   File "/usr/lib/python2.7/site-packages/nova/objects/instance.py", line 449, in _db_instance_get_by_uuid
2017-06-09 09:22:29.339 115528 ERROR nova.api.openstack.extensions     columns_to_join=columns_to_join)
2017-06-09 09:22:29.339 115528 ERROR nova.api.openstack.extensions   File "/usr/lib/python2.7/site-packages/nova/db/api.py", line 725, in instance_get_by_uuid
2017-06-09 09:22:29.339 115528 ERROR nova.api.openstack.extensions     return IMPL.instance_get_by_uuid(context, uuid, columns_to_join)
2017-06-09 09:22:29.339 115528 ERROR nova.api.openstack.extensions   File "/usr/lib/python2.7/site-packages/nova/db/sqlalchemy/api.py", line 169, in wrapper
2017-06-09 09:22:29.339 115528 ERROR nova.api.openstack.extensions     return f(*args, **kwargs)
2017-06-09 09:22:29.339 115528 ERROR nova.api.openstack.extensions   File "/usr/lib/python2.7/site-packages/nova/db/sqlalchemy/api.py", line 270, in wrapped
2017-06-09 09:22:29.339 115528 ERROR nova.api.openstack.extensions     return f(context, *args, **kwargs)
2017-06-09 09:22:29.339 115528 ERROR nova.api.openstack.extensions   File "/usr/lib/python2.7/site-packages/nova/db/sqlalchemy/api.py", line 1867, in instance_get_by_uuid
2017-06-09 09:22:29.339 115528 ERROR nova.api.openstack.extensions     columns_to_join=columns_to_join)
2017-06-09 09:22:29.339 115528 ERROR nova.api.openstack.extensions   File "/usr/lib/python2.7/site-packages/nova/db/sqlalchemy/api.py", line 1876, in _instance_get_by_uuid
2017-06-09 09:22:29.339 115528 ERROR nova.api.openstack.extensions     raise exception.InstanceNotFound(instance_id=uuid)
2017-06-09 09:22:29.339 115528 ERROR nova.api.openstack.extensions InstanceNotFound: Instance 6003b075-4b58-442c-9c8d-50474023f7c5 could not be found.
2017-06-09 09:22:29.339 115528 ERROR nova.api.openstack.extensions 
2017-06-09 09:22:29.342 115528 INFO nova.api.openstack.wsgi [req-6b546481-9c0a-4add-b654-9c305b8c19c7 90a9e21eb123445a8e6bd4c62aaedbf7 00a0bed8529e4454aa0c50c24320a453 - default default] HTTP exception thrown: Unexpected API Error. Please report this at http://bugs.launchpad.net/nova/ and attach the Nova API log if possible.
<class 'nova.exception.InstanceNotFound'>
 
Database record for the instance:

 launched_at: 2017-06-07 14:55:03
           terminated_at: 2017-06-08 08:18:07
            display_name: test
     display_description: test
       availability_zone: nova
                  locked: 0
                 os_type: NULL
             launched_on: bc-c4-3-16
        instance_type_id: 3
                 vm_mode: NULL
                    uuid: 6003b075-4b58-442c-9c8d-50474023f7c5
            architecture: NULL
        root_device_name: /dev/vda
            access_ip_v4: NULL
            access_ip_v6: NULL
            config_drive: 
              task_state: NULL
default_ephemeral_device: NULL
     default_swap_device: NULL
                progress: 0
        auto_disk_config: 1
      shutdown_terminate: 0
       disable_terminate: 0
                 root_gb: 50
            ephemeral_gb: 0
               cell_name: NULL
                    node: bc-c4-3-16
                 deleted: 12
               locked_by: NULL
                 cleaned: 1
      ephemeral_key_uuid: NULL
Comment 1 Rajesh Tailor 2017-06-28 01:26:09 EDT
Hi Eduardas,

I have tried to reproduce the issue as mentioned in reproduction steps,
its not reproducible in my RHOS10 deployment.

Could you try to reproduce it again in fresh RHOS10 deployment and provide
the reproduction steps, if it is reproducible.

I have also tried to reproduce it on stable/newton upstream branch, but
could not reproduce there also.

There is a similar bug https://bugzilla.redhat.com/show_bug.cgi?id=1449451
for which fix is merged upstream and patches are backported for stable/ocata
and stable/newton upstream. 
Since the code location where the issue occur is same for both the issues,
I think if that patch got merged in stable releases, we can backport it to RHOS10,
which could solve the issue.
Comment 2 Rajesh Tailor 2017-07-11 07:23:27 EDT
Hi Eudardas,

I am closing this bug because of lack of response from reporter. 
If you have a response, please feel free to reopen the bug.

Note You need to log in before you can comment on or make changes to this bug.