Failed to attach interface

Bug #1409617 reported by Liyingjun
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Low
Liyingjun

Bug Description

when i try to attach a existing port to an instance using command: nova interface-attach --port-id <port-id> <instance-id>, i get an error: Failed to attach interface

Step to reproduce:

stacker@stack:~$ neutron port-create 2cac259a-d9b5-47fe-9263-79ce6fd22dc6
Created a new port:
+-----------------------+--------------------------------------------------------------------------------------+
| Field | Value |
+-----------------------+--------------------------------------------------------------------------------------+
| admin_state_up | True |
| allowed_address_pairs | |
| binding:host_id | |
| binding:profile | {} |
| binding:vif_details | {} |
| binding:vif_type | unbound |
| binding:vnic_type | normal |
| device_id | |
| device_owner | |
| fixed_ips | {"subnet_id": "991d821c-aeea-44db-b419-4f82fc89353a", "ip_address": "121.12.120.21"} |
| id | 620c1351-fbac-4d68-aab3-943feb9acb14 |
| mac_address | fa:16:3e:4f:83:59 |
| name | |
| network_id | 2cac259a-d9b5-47fe-9263-79ce6fd22dc6 |
| security_groups | 06aaa36c-a685-4493-a72d-f8457f00acb3 |
| status | DOWN |
| tenant_id | 270850a2c3cd46d794b05e9f28e2c9e2 |
+-----------------------+--------------------------------------------------------------------------------------+
stacker@stack:~$ nova list --all-tenants
+--------------------------------------+------+---------+------------+-------------+--------------------------------------+
| ID | Name | Status | Task State | Power State | Networks |
+--------------------------------------+------+---------+------------+-------------+--------------------------------------+
| af87c1b2-1fd4-4345-a9b6-025694b1cec7 | b | SHUTOFF | - | Shutdown | test=121.12.120.17; private=10.0.0.7 |
| d63f5376-03a6-49ad-b80e-c460c5039593 | c | SHUTOFF | - | Shutdown | private=10.0.0.8 |
+--------------------------------------+------+---------+------------+-------------+--------------------------------------+
stacker@stack:~$ nova interface-attach --port-id 620c1351-fbac-4d68-aab3-943feb9acb14 d63f5376-03a6-49ad-b80e-c460c5039593
ERROR (ClientException): Failed to attach interface (HTTP 500) (Request-ID: req-3d04c5c6-3700-4ebc-9912-6dbf3f13f728)

Here is part of trace log from nova-api:
2015-01-12 15:47:34.943 TRACE nova.api.openstack.compute.contrib.attach_interfaces File "/opt/stack/nova/nova/compute/manager.py", line 323, in decorated_function
2015-01-12 15:47:34.943 TRACE nova.api.openstack.compute.contrib.attach_interfaces kwargs['instance'], e, sys.exc_info())
2015-01-12 15:47:34.943 TRACE nova.api.openstack.compute.contrib.attach_interfaces
2015-01-12 15:47:34.943 TRACE nova.api.openstack.compute.contrib.attach_interfaces File "/usr/local/lib/python2.7/dist-packages/oslo/utils/excutils.py", line 82, in __exit__
2015-01-12 15:47:34.943 TRACE nova.api.openstack.compute.contrib.attach_interfaces six.reraise(self.type_, self.value, self.tb)
2015-01-12 15:47:34.943 TRACE nova.api.openstack.compute.contrib.attach_interfaces
2015-01-12 15:47:34.943 TRACE nova.api.openstack.compute.contrib.attach_interfaces File "/opt/stack/nova/nova/compute/manager.py", line 311, in decorated_function
2015-01-12 15:47:34.943 TRACE nova.api.openstack.compute.contrib.attach_interfaces return function(self, context, *args, **kwargs)
2015-01-12 15:47:34.943 TRACE nova.api.openstack.compute.contrib.attach_interfaces
2015-01-12 15:47:34.943 TRACE nova.api.openstack.compute.contrib.attach_interfaces File "/opt/stack/nova/nova/compute/manager.py", line 4828, in attach_interface
2015-01-12 15:47:34.943 TRACE nova.api.openstack.compute.contrib.attach_interfaces instance_uuid=instance.uuid)
2015-01-12 15:47:34.943 TRACE nova.api.openstack.compute.contrib.attach_interfaces
2015-01-12 15:47:34.943 TRACE nova.api.openstack.compute.contrib.attach_interfaces InterfaceAttachFailed: Failed to attach network adapter device to d63f5376-03a6-49ad-b80e-c460c5039593

Liyingjun (liyingjun)
Changed in nova:
assignee: nobody → Liyingjun (liyingjun)
Revision history for this message
Liyingjun (liyingjun) wrote :

Found the problem! I used admin to create the port, and tried to attach the port to an instance belong to another tenant. But i think we should deny the interface attaching when the port is not belong to the tenant instead of raising an InterfaceAttachFailed exception.

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/146788

Changed in nova:
status: New → In Progress
Changed in nova:
importance: Undecided → Low
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

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

commit c4f353b112dd49b3d04e2b0e115a7db2f0f167d1
Author: liyingjun <email address hidden>
Date: Tue Feb 10 15:24:13 2015 +0800

    Improve 'attach interface' exception handling

    Previously, if a user attempted to launch an instance and specified a
    port that belonged to a different tenant, a HTTP 500 Server
    Error was returned to the user. This patch changes that to a
    more informative HTTPBadRequest exception.

    Change-Id: I4a4017407ac7358490974cbffc5b7dbb7a200f44
    Closes-bug: #1409617

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