The compute API in nova Essex now throws InstanceInvalidState exceptions when an instance is in the wrong state for the selected action.
Trying to delete a server in build (or resize) will cause HTTP 500 exceptions to occur. This is incorrect API behaviour as the SPEC says that HTTP 409 buildInProgress should be returned.
Additionally, the API log files include a full stack trace when the exceptions occur (these are user generated via the API):
3d527481b 75cf5a01f13c4ef09cf4e1601f0c16c6 7535afc6ccc4449b804f7c06e8ebd98e] Caught error: Instance 3beb9aa8-9081-4398-b3a8-55cd1d77b1fd in vm_state building. Cannot delete while the instance is in this state.
(nova.api.openstack.v2): TRACE: Traceback (most recent call last):
(nova.api.openstack.v2): TRACE: File "/usr/lib/python2.7/dist-packages/nova/api/openstack/v2/__init__.py", line 59, in __call__
(nova.api.openstack.v2): TRACE: return req.get_response(self.application)
(nova.api.openstack.v2): TRACE: File "/usr/lib/python2.7/dist-packages/webob/request.py", line 1053, in get_response
(nova.api.openstack.v2): TRACE: application, catch_exc_info=False)
(nova.api.openstack.v2): TRACE: File "/usr/lib/python2.7/dist-packages/webob/request.py", line 1022, in call_application
(nova.api.openstack.v2): TRACE: app_iter = application(self.environ, start_response)
(nova.api.openstack.v2): TRACE: File "/usr/lib/python2.7/dist-packages/keystone/middleware/auth_token.py", line 330, in __call__
(nova.api.openstack.v2): TRACE: return self._forward_request(env, start_response, proxy_headers)
(nova.api.openstack.v2): TRACE: File "/usr/lib/python2.7/dist-packages/keystone/middleware/auth_token.py", line 541, in _forward_request
(nova.api.openstack.v2): TRACE: return self.app(env, start_response)
(nova.api.openstack.v2): TRACE: File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 159, in __call__
(nova.api.openstack.v2): TRACE: return resp(environ, start_response)
(nova.api.openstack.v2): TRACE: File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 147, in __call__
(nova.api.openstack.v2): TRACE: resp = self.call_func(req, *args, **self.kwargs)
(nova.api.openstack.v2): TRACE: File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 208, in call_func
(nova.api.openstack.v2): TRACE: return self.func(req, *args, **kwargs)
(nova.api.openstack.v2): TRACE: File "/usr/lib/python2.7/dist-packages/nova/api/openstack/wsgi.py", line 568, in __call__
(nova.api.openstack.v2): TRACE: action_result = self.dispatch(request, action, args)
(nova.api.openstack.v2): TRACE: File "/usr/lib/python2.7/dist-packages/nova/api/openstack/wsgi.py", line 600, in dispatch
(nova.api.openstack.v2): TRACE: return controller_method(req=request, **action_args)
(nova.api.openstack.v2): TRACE: File "/usr/lib/python2.7/dist-packages/nova/exception.py", line 52, in new_f
(nova.api.openstack.v2): TRACE: ret = f(*args, **kwargs)
(nova.api.openstack.v2): TRACE: File "/usr/lib/python2.7/dist-packages/nova/scheduler/api.py", line 401, in new_f
(nova.api.openstack.v2): TRACE: return f(*args, **kwargs)
(nova.api.openstack.v2): TRACE: File "/usr/lib/python2.7/dist-packages/nova/api/openstack/v2/servers.py", line 575, in delete
(nova.api.openstack.v2): TRACE: self._delete(req.environ['nova.context'], id)
(nova.api.openstack.v2): TRACE: File "/usr/lib/python2.7/dist-packages/nova/api/openstack/v2/servers.py", line 437, in _delete
(nova.api.openstack.v2): TRACE: self.compute_api.delete(context, instance)
(nova.api.openstack.v2): TRACE: File "/usr/lib/python2.7/dist-packages/nova/compute/api.py", line 77, in inner
(nova.api.openstack.v2): TRACE: method=f.__name__)
(nova.api.openstack.v2): TRACE: InstanceInvalidState: Instance 3beb9aa8-9081-4398-b3a8-55cd1d77b1fd in vm_state building. Cannot delete while the instance is in this state.
----
Given the compute API is throwing a new type of exception it appears we need to review the Openstack and EC2 APIs to make sure these exceptions are handled properly.
Fix proposed to branch: master /review. openstack. org/2846
Review: https:/