Unable attach/detach interface for shelve offloaded instance

Bug #1299333 reported by Alex Xu
18
This bug affects 3 people
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Low
Alex Xu

Bug Description

$ nova list
+--------------------------------------+------+--------+------------+-------------+-------------------+
| ID | Name | Status | Task State | Power State | Networks |
+--------------------------------------+------+--------+------------+-------------+-------------------+
| 543d9625-2523-4a7f-af47-50c8e6b44981 | vm1 | ACTIVE | - | Running | private=10.0.0.23 |
+--------------------------------------+------+--------+------------+-------------+-------------------+

$ nova shelve vm1
$ nova shelve-offload vm1
$ nova list
+--------------------------------------+------+-------------------+------------+-------------+-------------------+
| ID | Name | Status | Task State | Power State | Networks |
+--------------------------------------+------+-------------------+------------+-------------+-------------------+
| 543d9625-2523-4a7f-af47-50c8e6b44981 | vm1 | SHELVED_OFFLOADED | - | Shutdown | private=10.0.0.23 |
+--------------------------------------+------+-------------------+------------+-------------+-------------------+

$ nova interface-detach vm1 bbabdfa5-7c47-4a67-b8ff-f36249fae8f1
ERROR (ClientException): The server has either erred or is incapable of performing the requested operation. (HTTP 500) (Request-ID: req-ec251c02-4adb-4c60-8e67-a998a1700ec4)

Got exception from nova-api:

2014-03-29 12:06:07.377 ERROR nova.api.openstack [req-ec251c02-4adb-4c60-8e67-a998a1700ec4 admin admin] Caught error: Unable to find host for Instance 543d9625-2523-4a7f-af47-50c8e6b44981
2014-03-29 12:06:07.377 TRACE nova.api.openstack Traceback (most recent call last):
2014-03-29 12:06:07.377 TRACE nova.api.openstack File "/opt/stack/nova/nova/api/openstack/__init__.py", line 125, in __call__
2014-03-29 12:06:07.377 TRACE nova.api.openstack return req.get_response(self.application)
2014-03-29 12:06:07.377 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/webob/request.py", line 1296, in send
2014-03-29 12:06:07.377 TRACE nova.api.openstack application, catch_exc_info=False)
2014-03-29 12:06:07.377 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/webob/request.py", line 1260, in call_application
2014-03-29 12:06:07.377 TRACE nova.api.openstack app_iter = application(self.environ, start_response)
2014-03-29 12:06:07.377 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 144, in __call__
2014-03-29 12:06:07.377 TRACE nova.api.openstack return resp(environ, start_response)
2014-03-29 12:06:07.377 TRACE nova.api.openstack File "/opt/stack/python-keystoneclient/keystoneclient/middleware/auth_token.py", line 582, in __call__
2014-03-29 12:06:07.377 TRACE nova.api.openstack return self.app(env, start_response)
2014-03-29 12:06:07.377 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 144, in __call__
2014-03-29 12:06:07.377 TRACE nova.api.openstack return resp(environ, start_response)
2014-03-29 12:06:07.377 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 144, in __call__
2014-03-29 12:06:07.377 TRACE nova.api.openstack return resp(environ, start_response)
2014-03-29 12:06:07.377 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/routes/middleware.py", line 131, in __call__
2014-03-29 12:06:07.377 TRACE nova.api.openstack response = self.app(environ, start_response)
2014-03-29 12:06:07.377 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 144, in __call__
2014-03-29 12:06:07.377 TRACE nova.api.openstack return resp(environ, start_response)
2014-03-29 12:06:07.377 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 130, in __call__
2014-03-29 12:06:07.377 TRACE nova.api.openstack resp = self.call_func(req, *args, **self.kwargs)
2014-03-29 12:06:07.377 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 195, in call_func
2014-03-29 12:06:07.377 TRACE nova.api.openstack return self.func(req, *args, **kwargs)
2014-03-29 12:06:07.377 TRACE nova.api.openstack File "/opt/stack/nova/nova/api/openstack/wsgi.py", line 917, in __call__
2014-03-29 12:06:07.377 TRACE nova.api.openstack content_type, body, accept)
2014-03-29 12:06:07.377 TRACE nova.api.openstack File "/opt/stack/nova/nova/api/openstack/wsgi.py", line 983, in _process_stack
2014-03-29 12:06:07.377 TRACE nova.api.openstack action_result = self.dispatch(meth, request, action_args)
2014-03-29 12:06:07.377 TRACE nova.api.openstack File "/opt/stack/nova/nova/api/openstack/wsgi.py", line 1070, in dispatch
2014-03-29 12:06:07.377 TRACE nova.api.openstack return method(req=request, **action_args)
2014-03-29 12:06:07.377 TRACE nova.api.openstack File "/opt/stack/nova/nova/api/openstack/compute/contrib/attach_interfaces.py", line 146, in delete
2014-03-29 12:06:07.377 TRACE nova.api.openstack instance, port_id=port_id)
2014-03-29 12:06:07.377 TRACE nova.api.openstack File "/opt/stack/nova/nova/compute/api.py", line 201, in wrapped
2014-03-29 12:06:07.377 TRACE nova.api.openstack return func(self, context, target, *args, **kwargs)
2014-03-29 12:06:07.377 TRACE nova.api.openstack File "/opt/stack/nova/nova/compute/api.py", line 2870, in detach_interface
2014-03-29 12:06:07.377 TRACE nova.api.openstack port_id=port_id)
2014-03-29 12:06:07.377 TRACE nova.api.openstack File "/opt/stack/nova/nova/compute/rpcapi.py", line 399, in detach_interface
2014-03-29 12:06:07.377 TRACE nova.api.openstack cctxt = self.client.prepare(server=_compute_host(None, instance),
2014-03-29 12:06:07.377 TRACE nova.api.openstack File "/opt/stack/nova/nova/compute/rpcapi.py", line 61, in _compute_host
2014-03-29 12:06:07.377 TRACE nova.api.openstack 'Instance %s') % instance['uuid'])
2014-03-29 12:06:07.377 TRACE nova.api.openstack NovaException: Unable to find host for Instance 543d9625-2523-4a7f-af47-50c8e6b44981
2014-03-29 12:06:07.377 TRACE nova.api.openstack

Tags: api
Alex Xu (xuhj)
Changed in nova:
assignee: nobody → Alex Xu (xuhj)
Allison Randal (allison)
tags: added: compute
melanie witt (melwitt)
Changed in nova:
importance: Undecided → High
status: New → Confirmed
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/87081

Changed in nova:
status: Confirmed → In Progress
Revision history for this message
Andrew Laski (alaski) wrote :

It's not a bug that an interface can't be attached/detached from a shelved instance. The 500 response is a bug. The error should be caught and an informative user response should be returned.

Changed in nova:
status: In Progress → Confirmed
importance: High → Wishlist
importance: Wishlist → Low
melanie witt (melwitt)
tags: added: api
removed: compute
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on nova (master)

Change abandoned by Alex Xu (<email address hidden>) on branch: master
Review: https://review.openstack.org/87081

Changed in nova:
status: Confirmed → In Progress
Revision history for this message
Alex Xu (xuhj) wrote :

This is fix by add state check for instance

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

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

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

commit ac236c2cd73c9d7e05ef9fbd22a4f8f099262082
Author: He Jie Xu <email address hidden>
Date: Sat Apr 12 19:30:12 2014 +0800

    Check instance state before attach/detach interface

    Currently there isn't any instance's status checking before
    attach/detach interface, It will fail when some status didn't
    support it. This patch add checking for it.

    This patch allow attach/detach interface for ACTIVE, PAUSED
    and STOPPED instance.

    * ACTIVE: The interface is hotplug to instance.
    * PAUSED: The interface can be hotpluged after instance unpaused.
    It's fixed by commit: a868fcedf8e46070cae6aa8e59e61934fa23db1c
    * STOPPED: In this status, the instance is destroyed. It just update
    the instance configuration with new interface. When the start
    instance, the instance will be recreated with new configuration.

    Change-Id: I3c038056085be1f655758ed8b6a44bcdbf70cdd5
    Closes-bug: #1299333

Changed in nova:
status: In Progress → Fix Committed
Changed in nova:
milestone: none → juno-2
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in nova:
milestone: juno-2 → 2014.2
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.