Deleting a flavor can cause servers/detail to return HTTP 400

Bug #962549 reported by Ryan Tidwell
42
This bug affects 9 people
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Invalid
Undecided
Unassigned

Bug Description

Steps to reproduce on essex-4:

1. Boot an instance using flavor ID 1
2. After the instance is active, delete the flavor (nova-manage flavor delete m1.tiny)
3. Make a call to /servers/details (ie nova list)

# nova list
The server could not comply with the request since it is either malformed or otherwise incorrect. (HTTP 400)

from nova-api.log:

2012-03-22 14:56:40 INFO nova.api.openstack.wsgi [req-43268d0b-0b3f-451f-b36f-bfcb49b68ff9 ryan test] GET http://10.10.10.90:8774/v1.1/test/servers/detail
2012-03-22 14:56:40 DEBUG nova.api.openstack.wsgi [req-43268d0b-0b3f-451f-b36f-bfcb49b68ff9 ryan test] Unrecognized Content-Type provided in request from (pid=23300
) get_body /usr/lib/python2.6/site-packages/nova/api/openstack/wsgi.py:694
2012-03-22 14:56:40 DEBUG nova.compute.api [req-43268d0b-0b3f-451f-b36f-bfcb49b68ff9 ryan test] Searching by: {'deleted': False, 'project_id': 'test'} from (pid=233
00) get_all /usr/lib/python2.6/site-packages/nova/compute/api.py:1009
2012-03-22 14:56:40 DEBUG nova.api.openstack.common [req-43268d0b-0b3f-451f-b36f-bfcb49b68ff9 ryan test] Generated ACTIVE from vm_state=active task_state=None. from
 (pid=23300) status_from_state /usr/lib/python2.6/site-packages/nova/api/openstack/common.py:98
2012-03-22 14:56:40 ERROR nova.api.openstack.wsgi [req-43268d0b-0b3f-451f-b36f-bfcb49b68ff9 ryan test] Exception handling resource: 'NoneType' object is unsubscript
able
(nova.api.openstack.wsgi): TRACE: Traceback (most recent call last):
(nova.api.openstack.wsgi): TRACE: File "/usr/lib/python2.6/site-packages/nova/api/openstack/wsgi.py", line 848, in _process_stack
(nova.api.openstack.wsgi): TRACE: action_result = self.dispatch(meth, request, action_args)
(nova.api.openstack.wsgi): TRACE: File "/usr/lib/python2.6/site-packages/nova/api/openstack/wsgi.py", line 924, in dispatch
(nova.api.openstack.wsgi): TRACE: return method(req=request, **action_args)
(nova.api.openstack.wsgi): TRACE: File "/usr/lib/python2.6/site-packages/nova/api/openstack/compute/servers.py", line 382, in detail
(nova.api.openstack.wsgi): TRACE: servers = self._get_servers(req, is_detail=True)
(nova.api.openstack.wsgi): TRACE: File "/usr/lib/python2.6/site-packages/nova/api/openstack/compute/servers.py", line 465, in _get_servers
(nova.api.openstack.wsgi): TRACE: return self._view_builder.detail(req, limited_list)
(nova.api.openstack.wsgi): TRACE: File "/usr/lib/python2.6/site-packages/nova/api/openstack/compute/views/servers.py", line 123, in detail
(nova.api.openstack.wsgi): TRACE: return self._list_view(self.show, request, instances)
(nova.api.openstack.wsgi): TRACE: File "/usr/lib/python2.6/site-packages/nova/api/openstack/compute/views/servers.py", line 127, in _list_view
(nova.api.openstack.wsgi): TRACE: server_list = [func(request, server)["server"] for server in servers]
(nova.api.openstack.wsgi): TRACE: File "/usr/lib/python2.6/site-packages/nova/api/openstack/compute/views/servers.py", line 61, in wrapped
(nova.api.openstack.wsgi): TRACE: return func(self, request, instance)
(nova.api.openstack.wsgi): TRACE: File "/usr/lib/python2.6/site-packages/nova/api/openstack/compute/views/servers.py", line 97, in show
(nova.api.openstack.wsgi): TRACE: "flavor": self._get_flavor(request, instance),
(nova.api.openstack.wsgi): TRACE: File "/usr/lib/python2.6/site-packages/nova/api/openstack/compute/views/servers.py", line 172, in _get_flavor
(nova.api.openstack.wsgi): TRACE: flavor_id = instance["instance_type"]["flavorid"]
(nova.api.openstack.wsgi): TRACE: TypeError: 'NoneType' object is unsubscriptable
(nova.api.openstack.wsgi): TRACE:
2012-03-22 14:56:40 INFO nova.api.openstack.wsgi [req-43268d0b-0b3f-451f-b36f-bfcb49b68ff9 ryan test] http://10.10.10.90:8774/v1.1/test/servers/detail returned with
 HTTP 400

Either users should be blocked from deleting a flavor until all instances booted from it terminate, or this should be more robust (I'd propose the latter).

Changed in nova:
assignee: nobody → Sirisha Guduru (guduru-sirisha)
status: New → In Progress
Revision history for this message
Sirisha Guduru (guduru-sirisha) wrote :

The possible solutions that can be proposed for resolving this bug are:

1. Either the user has to be given a notification that the instance type or flavor cannot be deleted since the instances are associated with it, and he will be able to delete the flavor only if the instances that are associated with that respective flavor are deleted.

2. Or while fetching the instances from the instances table using "nova list", the code has to be changed in such a way the instance_type_id is not fetched and there is no association of the instances with the instance_type_id. Hence, even if the instance_type is deleted the instance list can be fetched using the "nova list" command.

Revision history for this message
Michael S. Moody (michael-sykosoft) wrote :

Perhaps a 3rd solution:

Allow the flavor to be deleted, but mark it as in a state of deletion (as in, the deletion is in progress, no new instances can be started with this flavor, etc), and the actual deletion itself will take place when any instances still using that flavor are stopped.

Michael

Revision history for this message
thesues (deanraccoon) wrote :

I have seen the same problems,
But how to restore my instance after this?

Revision history for this message
Subbu Allamaraju (subbu) wrote :

By the way, this issue also surfaces during nova-compute restart. nova-compute fails to start if any of the instances have references deleted flavors.

Revision history for this message
Joe Gordon (jogo) wrote :

Is this still valid?

Changed in nova:
status: In Progress → Incomplete
Revision history for this message
Kord Campbell (kordless) wrote : Re: [Bug 962549] Re: Deleting a flavor can cause servers/detail to return HTTP 400
Download full text (4.9 KiB)

I'm not observing my described behavior in Icehouse. Here's what I did:

1. Started an instance with a created flavor.
2. Did a 'nova list', got back a response.
3. Deleted the flavor.
4. Did a 'nova list', got back a response.

K

On Sat, Jul 12, 2014 at 12:28 PM, Joe Gordon <email address hidden>
wrote:

> Is this still valid?
>
> ** Changed in: nova
> Status: In Progress => Incomplete
>
> --
> You received this bug notification because you are subscribed to a
> duplicate bug report (990127).
> https://bugs.launchpad.net/bugs/962549
>
> Title:
> Deleting a flavor can cause servers/detail to return HTTP 400
>
> Status in OpenStack Compute (Nova):
> Incomplete
>
> Bug description:
> Steps to reproduce on essex-4:
>
> 1. Boot an instance using flavor ID 1
> 2. After the instance is active, delete the flavor (nova-manage flavor
> delete m1.tiny)
> 3. Make a call to /servers/details (ie nova list)
>
> # nova list
> The server could not comply with the request since it is either
> malformed or otherwise incorrect. (HTTP 400)
>
> from nova-api.log:
>
> 2012-03-22 14:56:40 INFO nova.api.openstack.wsgi
> [req-43268d0b-0b3f-451f-b36f-bfcb49b68ff9 ryan test] GET
> http://10.10.10.90:8774/v1.1/test/servers/detail
> 2012-03-22 14:56:40 DEBUG nova.api.openstack.wsgi
> [req-43268d0b-0b3f-451f-b36f-bfcb49b68ff9 ryan test] Unrecognized
> Content-Type provided in request from (pid=23300
> ) get_body
> /usr/lib/python2.6/site-packages/nova/api/openstack/wsgi.py:694
> 2012-03-22 14:56:40 DEBUG nova.compute.api
> [req-43268d0b-0b3f-451f-b36f-bfcb49b68ff9 ryan test] Searching by:
> {'deleted': False, 'project_id': 'test'} from (pid=233
> 00) get_all /usr/lib/python2.6/site-packages/nova/compute/api.py:1009
> 2012-03-22 14:56:40 DEBUG nova.api.openstack.common
> [req-43268d0b-0b3f-451f-b36f-bfcb49b68ff9 ryan test] Generated ACTIVE from
> vm_state=active task_state=None. from
> (pid=23300) status_from_state
> /usr/lib/python2.6/site-packages/nova/api/openstack/common.py:98
> 2012-03-22 14:56:40 ERROR nova.api.openstack.wsgi
> [req-43268d0b-0b3f-451f-b36f-bfcb49b68ff9 ryan test] Exception handling
> resource: 'NoneType' object is unsubscript
> able
> (nova.api.openstack.wsgi): TRACE: Traceback (most recent call last):
> (nova.api.openstack.wsgi): TRACE: File
> "/usr/lib/python2.6/site-packages/nova/api/openstack/wsgi.py", line 848, in
> _process_stack
> (nova.api.openstack.wsgi): TRACE: action_result =
> self.dispatch(meth, request, action_args)
> (nova.api.openstack.wsgi): TRACE: File
> "/usr/lib/python2.6/site-packages/nova/api/openstack/wsgi.py", line 924, in
> dispatch
> (nova.api.openstack.wsgi): TRACE: return method(req=request,
> **action_args)
> (nova.api.openstack.wsgi): TRACE: File
> "/usr/lib/python2.6/site-packages/nova/api/openstack/compute/servers.py",
> line 382, in detail
> (nova.api.openstack.wsgi): TRACE: servers = self._get_servers(req,
> is_detail=True)
> (nova.api.openstack.wsgi): TRACE: File
> "/usr/lib/python2.6/site-packages/nova/api/openstack/compute/servers.py",
> line 465, in _get_servers
> (nova.api.openstack.wsgi): TRACE: return
> self._view_bui...

Read more...

Revision history for this message
Ryan Tidwell (ryan-tidwell) wrote :

I reported this against Essex but haven't really been following it too closely. If we're not observing this on Icehouse, I'm thinking this is no longer a valid issue.

Revision history for this message
Sean Dague (sdague) wrote :

This is fixed with the system metadata flavor saving

Changed in nova:
status: Incomplete → Invalid
assignee: Sirisha Guduru (guduru-sirisha) → nobody
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.