incorrect error code when rebooting a rebooting_hard guest

Bug #1288926 reported by Sarath Menon
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Medium
Liusheng

Bug Description

This is using the latest nova from trunk. In our deployment, we had a hypervisor go down and the tenant issued a hard reboot prior. When attempting a reboot on a guest with the state HARD_REBOOT, nova controller throws this error in it's logs and returns 'ERROR: The server has either erred or is incapable of performing the requested operation. (HTTP 500)' to the user:

2014-03-06 18:21:00,535 (routes.middleware): DEBUG middleware __call__ Matched POST /tenant1/servers/778032b2-469d-445e-abde-7b9b0b673324/action
2014-03-06 18:21:00,536 (routes.middleware): DEBUG middleware __call__ Route path: '/{project_id}/servers/:(id)/action', defaults: {'action': u'action', 'controller': <nova.api.openstack.wsgi.Resource object at 0x5242c90>}
2014-03-06 18:21:00,536 (routes.middleware): DEBUG middleware __call__ Match dict: {'action': u'action', 'controller': <nova.api.openstack.wsgi.Resource object at 0x5242c90>, 'project_id': u'tenant1', 'id': u'778032b2-469d-445e-abde-7b9b0b673324'}
2014-03-06 18:21:00,537 (nova.api.openstack.wsgi): DEBUG wsgi _process_stack Action: 'action', body: {"reboot": {"type": "SOFT"}}
2014-03-06 18:21:00,538 (nova.api.openstack.wsgi): DEBUG wsgi _process_stack Calling method <bound method Controller._action_reboot of <nova.api.openstack.compute.contrib.keypairs.Controller object at 0x4c35a50>>
2014-03-06 18:21:00,747 (nova.api.openstack): ERROR __init__ _error Caught error: Unexpected task state: expecting [None, 'rebooting'] but the actual state is rebooting_hard
Traceback (most recent call last):
  File "/usr/local/gshare/csi-nova.venv/lib/python2.6/site-packages/nova/api/openstack/__init__.py", line 125, in __call__
    return req.get_response(self.application)
  File "/usr/local/gshare/csi-nova.venv/lib/python2.6/site-packages/webob/request.py", line 1320, in send
    application, catch_exc_info=False)
  File "/usr/local/gshare/csi-nova.venv/lib/python2.6/site-packages/webob/request.py", line 1284, in call_application
    app_iter = application(self.environ, start_response)
  File "/usr/local/gshare/csi-nova.venv/lib/python2.6/site-packages/webob/dec.py", line 144, in __call__
    return resp(environ, start_response)
  File "/usr/local/gshare/csi-nova.venv/lib/python2.6/site-packages/keystoneclient/middleware/auth_token.py", line 598, in __call__
    return self.app(env, start_response)
  File "/usr/local/gshare/csi-nova.venv/lib/python2.6/site-packages/webob/dec.py", line 144, in __call__
    return resp(environ, start_response)
  File "/usr/local/gshare/csi-nova.venv/lib/python2.6/site-packages/webob/dec.py", line 144, in __call__
    return resp(environ, start_response)
  File "/usr/local/gshare/csi-nova.venv/lib/python2.6/site-packages/routes/middleware.py", line 131, in __call__
    response = self.app(environ, start_response)
  File "/usr/local/gshare/csi-nova.venv/lib/python2.6/site-packages/webob/dec.py", line 144, in __call__
    return resp(environ, start_response)
  File "/usr/local/gshare/csi-nova.venv/lib/python2.6/site-packages/webob/dec.py", line 130, in __call__
    resp = self.call_func(req, *args, **self.kwargs)
  File "/usr/local/gshare/csi-nova.venv/lib/python2.6/site-packages/webob/dec.py", line 195, in call_func
    return self.func(req, *args, **kwargs)
  File "/usr/local/gshare/csi-nova.venv/lib/python2.6/site-packages/nova/api/openstack/wsgi.py", line 925, in __call__
    content_type, body, accept)
  File "/usr/local/gshare/csi-nova.venv/lib/python2.6/site-packages/nova/api/openstack/wsgi.py", line 987, in _process_stack
    action_result = self.dispatch(meth, request, action_args)
  File "/usr/local/gshare/csi-nova.venv/lib/python2.6/site-packages/nova/api/openstack/wsgi.py", line 1074, in dispatch
    return method(req=request, **action_args)
  File "/usr/local/gshare/csi-nova.venv/lib/python2.6/site-packages/nova/api/openstack/compute/servers.py", line 1145, in _action_reboot
    self.compute_api.reboot(context, instance, reboot_type)
  File "/usr/local/gshare/csi-nova.venv/lib/python2.6/site-packages/nova/compute/api.py", line 199, in wrapped
    return func(self, context, target, *args, **kwargs)
  File "/usr/local/gshare/csi-nova.venv/lib/python2.6/site-packages/nova/compute/api.py", line 189, in inner
    return function(self, context, instance, *args, **kwargs)
  File "/usr/local/gshare/csi-nova.venv/lib/python2.6/site-packages/nova/compute/api.py", line 170, in inner
    return f(self, context, instance, *args, **kw)
  File "/usr/local/gshare/csi-nova.venv/lib/python2.6/site-packages/nova/compute/api.py", line 2073, in reboot
    instance.save(expected_task_state=[None, task_states.REBOOTING])
  File "/usr/local/gshare/csi-nova.venv/lib/python2.6/site-packages/nova/objects/base.py", line 151, in wrapper
    return fn(self, ctxt, *args, **kwargs)
  File "/usr/local/gshare/csi-nova.venv/lib/python2.6/site-packages/nova/objects/instance.py", line 472, in save
    columns_to_join=_expected_cols(expected_attrs))
  File "/usr/local/gshare/csi-nova.venv/lib/python2.6/site-packages/nova/db/api.py", line 739, in instance_update_and_get_original
    columns_to_join=columns_to_join)
  File "/usr/local/gshare/csi-nova.venv/lib/python2.6/site-packages/nova/db/sqlalchemy/api.py", line 128, in wrapper
    return f(*args, **kwargs)
  File "/usr/local/gshare/csi-nova.venv/lib/python2.6/site-packages/nova/db/sqlalchemy/api.py", line 2164, in instance_update_and_get_original
    columns_to_join=columns_to_join)
  File "/usr/local/gshare/csi-nova.venv/lib/python2.6/site-packages/nova/db/sqlalchemy/api.py", line 2215, in _instance_update
    actual=actual_state, expected=expected)
UnexpectedTaskStateError: Unexpected task state: expecting [None, 'rebooting'] but the actual state is rebooting_hard
2014-03-06 18:21:00,750 (nova.api.openstack): INFO __init__ _error http://nova-controller.isg.apple.com:8774/v2/tenant1/servers/778032b2-469d-445e-abde-7b9b0b673324/action returned with HTTP 500

The actual error message back to the user must be something along the lines of 'Unexpected task state: expecting [None, 'rebooting'] but the actual state is rebooting_hard' with a 4xx HTTP code.

Liusheng (liusheng)
Changed in nova:
assignee: nobody → Liusheng (liusheng)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (master)

Fix proposed to branch: master
Review: https://review.openstack.org/79274

Changed in nova:
status: New → In Progress
Andrew Laski (alaski)
Changed in nova:
importance: Undecided → Medium
milestone: none → icehouse-rc1
tags: added: icehouse-rc-potential
Changed in nova:
milestone: icehouse-rc1 → none
Revision history for this message
jichenjc (jichenjc) wrote :

not only REBOOTING_HARD has this problem, I would think REBOOTING also has this problem
so hopefully this issue can also be fixed

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/79274
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=00f5125745dc72afbc9aeade8b780d7a3be49a30
Submitter: Jenkins
Branch: master

commit 00f5125745dc72afbc9aeade8b780d7a3be49a30
Author: liu-sheng <email address hidden>
Date: Mon Mar 10 16:20:16 2014 +0800

    Don't allow reboot when instance in rebooting_hard

    It shouldn't allow reboot a instance while the instance in
    rebooting_hard task state.
    If the instance is in rebooting_hard, solf reboot action is
    meaningless.

    Change-Id: I43147104a7473eaaf1b86f84386bb28b7e3574c3
    Closes-bug: #1288926

Changed in nova:
status: In Progress → Fix Committed
Changed in nova:
milestone: none → icehouse-rc1
Thierry Carrez (ttx)
Changed in nova:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in nova:
milestone: icehouse-rc1 → 2014.1
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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