Bug 836193 - Removing an flavor "in use" leads to nova failiure
Summary: Removing an flavor "in use" leads to nova failiure
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: openstack-nova
Version: 17
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Mark McLoughlin
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-06-28 10:07 UTC by David Busby
Modified: 2013-08-01 08:40 UTC (History)
16 users (show)

Fixed In Version: openstack-nova-2012.1.3-1.fc17
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2013-08-01 03:33:04 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Launchpad 1018788 0 None None None 2012-06-28 10:26:53 UTC

Description David Busby 2012-06-28 10:07:30 UTC
I've removed all default flavors and created 3 custom flavors on a nova install (f17).

This was done with 2 instances presently running with the intention to resize the instances.

This leads to the following:

---
5a57533] Exception handling resource: 'NoneType' object has no attribute '__getitem__'
2012-06-28 10:42:24 TRACE nova.api.openstack.wsgi Traceback (most recent call last):
2012-06-28 10:42:24 TRACE nova.api.openstack.wsgi   File "/usr/lib/python2.7/site-packages/nova/api/openstack/wsgi.py", line 851, in _process_stack
2012-06-28 10:42:24 TRACE nova.api.openstack.wsgi     action_result = self.dispatch(meth, request, action_args)
2012-06-28 10:42:24 TRACE nova.api.openstack.wsgi   File "/usr/lib/python2.7/site-packages/nova/api/openstack/wsgi.py", line 926, in dispatch
2012-06-28 10:42:24 TRACE nova.api.openstack.wsgi     return method(req=request, **action_args)
2012-06-28 10:42:24 TRACE nova.api.openstack.wsgi   File "/usr/lib/python2.7/site-packages/nova/api/openstack/compute/servers.py", line 382, in detail
2012-06-28 10:42:24 TRACE nova.api.openstack.wsgi     servers = self._get_servers(req, is_detail=True)
2012-06-28 10:42:24 TRACE nova.api.openstack.wsgi   File "/usr/lib/python2.7/site-packages/nova/api/openstack/compute/servers.py", line 465, in _get_servers
2012-06-28 10:42:24 TRACE nova.api.openstack.wsgi     return self._view_builder.detail(req, limited_list)
2012-06-28 10:42:24 TRACE nova.api.openstack.wsgi   File "/usr/lib/python2.7/site-packages/nova/api/openstack/compute/views/servers.py", line 123, in detail
2012-06-28 10:42:24 TRACE nova.api.openstack.wsgi     return self._list_view(self.show, request, instances)
2012-06-28 10:42:24 TRACE nova.api.openstack.wsgi   File "/usr/lib/python2.7/site-packages/nova/api/openstack/compute/views/servers.py", line 127, in _list_view
2012-06-28 10:42:24 TRACE nova.api.openstack.wsgi     server_list = [func(request, server)["server"] for server in servers]
2012-06-28 10:42:24 TRACE nova.api.openstack.wsgi   File "/usr/lib/python2.7/site-packages/nova/api/openstack/compute/views/servers.py", line 61, in wrapped
2012-06-28 10:42:24 TRACE nova.api.openstack.wsgi     return func(self, request, instance)
2012-06-28 10:42:24 TRACE nova.api.openstack.wsgi   File "/usr/lib/python2.7/site-packages/nova/api/openstack/compute/views/servers.py", line 97, in show
2012-06-28 10:42:24 TRACE nova.api.openstack.wsgi     "flavor": self._get_flavor(request, instance),
2012-06-28 10:42:24 TRACE nova.api.openstack.wsgi   File "/usr/lib/python2.7/site-packages/nova/api/openstack/compute/views/servers.py", line 172, in _get_flavor
2012-06-28 10:42:24 TRACE nova.api.openstack.wsgi     flavor_id = instance["instance_type"]["flavorid"]
2012-06-28 10:42:24 TRACE nova.api.openstack.wsgi TypeError: 'NoneType' object has no attribute '__getitem__'
2012-06-28 10:42:24 TRACE nova.api.openstack.wsgi 
---

Added some debug code:

LOG.info(dir(instance))

---
2012-06-28 11:01:15 INFO nova.api.openstack.compute.views.servers [req-f6191d59-6ee9-44fe-ad12-7f9ec6b0d892 81de5ddfa3d2434885836012f49d1a24 d8fbd2d4c33d49b886bd12b2c5a57533] ['__class__', '__cmp__', '__contains__', '__delattr__', '__delitem__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__gt__', '__hash__', '__init__', '__iter__', '__le__', '__len__', '__lt__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__setitem__', '__sizeof__', '__str__', '__subclasshook__', 'clear', 'copy', 'fromkeys', 'get', 'has_key', 'items', 'iteritems', 'iterkeys', 'itervalues', 'keys', 'pop', 'popitem', 'setdefault', 'update', 'values', 'viewitems', 'viewkeys', 'viewvalues']
---

LOG.info(instance.__class__.__name__)

---
2012-06-28 11:02:45 INFO nova.api.openstack.compute.views.servers [req-a8b71553-cf6c-4c60-a883-5953df339176 81de5ddfa3d2434885836012f49d1a24 d8fbd2d4c33d49b886bd12b2c5a57533] dict
---

LOG.info(instance["instance_type"].__class__.__name__)

---
2012-06-28 11:04:59 INFO nova.api.openstack.compute.views.servers [req-573602d2-f40c-4be9-b2ca-4eaedd83aac2 81de5ddfa3d2434885836012f49d1a24 d8fbd2d4c33d49b886bd12b2c5a57533] NoneType
---

Based on this the issue arises when an instance associated with a flavor has its flavor removed, leading to a complete failure of nova.

Comment 1 David Busby 2012-06-28 10:14:14 UTC
This workaround allows for nova to recover; though I am kludging this by forcing the flavor_id to 0 may be a better way of doing this:

---


index d20cd26..52253d8 100644
--- a/servers.py
+++ b/servers.py
@@ -169,7 +169,10 @@ class ViewBuilder(common.ViewBuilder):
         }
 
     def _get_flavor(self, request, instance):
-        flavor_id = instance["instance_type"]["flavorid"]
+        if(instance["instance_type"] == None):
+            flavor_id = 0
+        else:
+            flavor_id = instance["instance_type"]["flavorid"]
         flavor_ref = self._flavor_builder._get_href_link(request, flavor_id)
         flavor_bookmark = self._flavor_builder._get_bookmark_link(request,
                                                                   flavor_id)
---

Comment 2 David Busby 2012-06-28 10:22:54 UTC
created launchpad bug: https://bugs.launchpad.net/nova/+bug/1018788

Comment 3 David Busby 2012-06-28 10:24:50 UTC
Note: similar issue affects nova/compute/api.pi line 1368 in resize.

Comment 4 David Busby 2012-06-28 10:44:26 UTC
Note: my kludge above only allowed the api to return the list, this had further cascading issue that will need to be addressed; or a method placed on deletion of a flavor to first check it is not in use.

Comment 5 Russell Bryant 2012-07-02 14:18:14 UTC
This bug was fixed in master by:

    https://review.openstack.org/#/c/8007/

related discussion here: 

    https://lists.launchpad.net/openstack/msg12648.html

It's still a problem in Essex (what is in use for this bug).  That patch is probably too invasive for a stable branch backport, though.

Comment 6 Fedora End Of Life 2013-07-04 00:08:34 UTC
This message is a reminder that Fedora 17 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 17. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '17'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 17's end of life.

Bug Reporter:  Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 17 is end of life. If you 
would still like  to see this bug fixed and are able to reproduce it 
against a later version  of Fedora, you are encouraged  change the 
'version' to a later Fedora version prior to Fedora 17's end of life.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 7 Fedora End Of Life 2013-08-01 03:33:15 UTC
Fedora 17 changed to end-of-life (EOL) status on 2013-07-30. Fedora 17 is 
no longer maintained, which means that it will not receive any further 
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of 
Fedora please feel free to reopen this bug against that version.

Thank you for reporting this bug and we are sorry it could not be fixed.


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