← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1744103] Re: nova interface-attach 500 on conflict

 

Reviewed:  https://review.openstack.org/535532
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=0098dbf2f12902ccd79f6111ba3a1d5a094ae6dc
Submitter: Zuul
Branch:    master

commit 0098dbf2f12902ccd79f6111ba3a1d5a094ae6dc
Author: Hongbin Lu <hongbin.lu@xxxxxxxxxx>
Date:   Fri Jan 19 00:26:15 2018 +0000

    Handle IpAddressAlreadyAllocated exception
    
    Change-Id: I5bee9ae18764b6f285ecc5e8d7148a1019c74701
    Closes-Bug: #1744103


** Changed in: nova
       Status: In Progress => Fix Released

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Compute (nova).
https://bugs.launchpad.net/bugs/1744103

Title:
  nova interface-attach  500 on conflict

Status in OpenStack Compute (nova):
  Fix Released

Bug description:
  Nova returns with 5xx response instead of 4xx in case of user error.

  In this case it is clearly user issue, the user can know the 10.0.0.3
  ip address already allocated from the subnet and it cannot be
  allocated twice.

  nuva must return with 409/Conflict status code and state the problem
  to the user as neutron did to nova.

  $ nova boot --image cirros-0.3.5-x86_64-disk --flavor 42 --nic net-
  id=ef952752-b81c-478e-a114-04083c63827c test

  $ nova list
  +--------------------------------------+------+--------+------------+-------------+--------------------------------------------------------+
  | ID                                   | Name | Status | Task State | Power State | Networks                                               |
  +--------------------------------------+------+--------+------------+-------------+--------------------------------------------------------+
  | 7a453305-2684-4684-8005-04a98aebfc7e | test | ACTIVE | -          | Running     | private=fd64:8b83:fea2:0:f816:3eff:fe5f:3da3, 10.0.0.3 |
  +--------------------------------------+------+--------+------------+-------------+--------------------------------------------------------+

  $ nova interface-attach  7a453305-2684-4684-8005-04a98aebfc7e --net-id=ef952752-b81c-478e-a114-04083c63827c --fixed-ip 10.0.0.3
  ERROR (ClientException): Unexpected API Error. Please report this at http://bugs.launchpad.net/nova/ and attach the Nova API log if possible.
  <class 'oslo_messaging.rpc.client.RemoteError'> (HTTP 500) (Request-ID: req-64d655fe-0564-46ec-85c2-c982d34f796c)

  Jan 18 15:21:29 afazekas-1516283855.localdomain devstack@n-api.service[15371]: DEBUG nova.api.openstack.wsgi [None req-64d655fe-0564-46ec-85c2-c982d34f796c demo demo] Action: 'create', calling method: <bound met
  Jan 18 15:21:29 afazekas-1516283855.localdomain devstack@n-api.service[15371]: DEBUG nova.compute.api [None req-64d655fe-0564-46ec-85c2-c982d34f796c demo demo] [instance: 7a453305-2684-4684-8005-04a98aebfc7e] Fe
  Jan 18 15:21:29 afazekas-1516283855.localdomain devstack@n-api.service[15371]: DEBUG oslo_concurrency.lockutils [None req-64d655fe-0564-46ec-85c2-c982d34f796c demo demo] Lock "921bd34d-76f9-4c1c-8d6e-1892c2ebac0
  Jan 18 15:21:29 afazekas-1516283855.localdomain devstack@n-api.service[15371]: DEBUG oslo_concurrency.lockutils [None req-64d655fe-0564-46ec-85c2-c982d34f796c demo demo] Lock "921bd34d-76f9-4c1c-8d6e-1892c2ebac0
  Jan 18 15:21:30 afazekas-1516283855.localdomain devstack@n-api.service[15371]: ERROR nova.api.openstack.wsgi [None req-64d655fe-0564-46ec-85c2-c982d34f796c demo demo] Unexpected exception in API method: RemoteEr
  Jan 18 15:21:30 afazekas-1516283855.localdomain devstack@n-api.service[15371]: Neutron server returns request_ids: ['req-d63bbcfd-44d7-4986-a46f-00fbc4d58749']
  Jan 18 15:21:30 afazekas-1516283855.localdomain devstack@n-api.service[15371]: [u'Traceback (most recent call last):\n', u'  File "/usr/lib/python2.7/site-packages/oslo_messaging/rpc/server.py", line 163, in _pr
  Jan 18 15:21:30 afazekas-1516283855.localdomain devstack@n-api.service[15371]: e\n    security_group_ids)\n', u'  File "/opt/stack/nova/nova/network/neutronv2/api.py", line 871, in _create_ports_for_instance\n
  Jan 18 15:21:30 afazekas-1516283855.localdomain devstack@n-api.service[15371]: gs)\n', u'  File "/usr/lib/python2.7/site-packages/neutronclient/v2_0/client.py", line 268, in _handle_fault_response\n    exception
  Jan 18 15:21:30 afazekas-1516283855.localdomain devstack@n-api.service[15371]: ERROR nova.api.openstack.wsgi Traceback (most recent call last):
  Jan 18 15:21:30 afazekas-1516283855.localdomain devstack@n-api.service[15371]: ERROR nova.api.openstack.wsgi   File "/opt/stack/nova/nova/api/openstack/wsgi.py", line 803, in wrapped
  Jan 18 15:21:30 afazekas-1516283855.localdomain devstack@n-api.service[15371]: ERROR nova.api.openstack.wsgi     return f(*args, **kwargs)
  Jan 18 15:21:30 afazekas-1516283855.localdomain devstack@n-api.service[15371]: ERROR nova.api.openstack.wsgi   File "/opt/stack/nova/nova/api/validation/__init__.py", line 108, in wrapper
  Jan 18 15:21:30 afazekas-1516283855.localdomain devstack@n-api.service[15371]: ERROR nova.api.openstack.wsgi     return func(*args, **kwargs)
  Jan 18 15:21:30 afazekas-1516283855.localdomain devstack@n-api.service[15371]: ERROR nova.api.openstack.wsgi   File "/opt/stack/nova/nova/api/validation/__init__.py", line 108, in wrapper
  Jan 18 15:21:30 afazekas-1516283855.localdomain devstack@n-api.service[15371]: ERROR nova.api.openstack.wsgi     return func(*args, **kwargs)
  Jan 18 15:21:30 afazekas-1516283855.localdomain devstack@n-api.service[15371]: ERROR nova.api.openstack.wsgi   File "/opt/stack/nova/nova/api/openstack/compute/attach_interfaces.py", line 133, in create
  Jan 18 15:21:30 afazekas-1516283855.localdomain devstack@n-api.service[15371]: ERROR nova.api.openstack.wsgi     instance, network_id, port_id, req_ip, tag=tag)
  Jan 18 15:21:30 afazekas-1516283855.localdomain devstack@n-api.service[15371]: ERROR nova.api.openstack.wsgi   File "/opt/stack/nova/nova/compute/api.py", line 202, in inner
  Jan 18 15:21:30 afazekas-1516283855.localdomain devstack@n-api.service[15371]: ERROR nova.api.openstack.wsgi     return function(self, context, instance, *args, **kwargs)
  Jan 18 15:21:30 afazekas-1516283855.localdomain devstack@n-api.service[15371]: ERROR nova.api.openstack.wsgi   File "/opt/stack/nova/nova/compute/api.py", line 150, in inner
  Jan 18 15:21:30 afazekas-1516283855.localdomain devstack@n-api.service[15371]: ERROR nova.api.openstack.wsgi     return f(self, context, instance, *args, **kw)
  Jan 18 15:21:30 afazekas-1516283855.localdomain devstack@n-api.service[15371]: ERROR nova.api.openstack.wsgi   File "/opt/stack/nova/nova/compute/api.py", line 3974, in attach_interface
  Jan 18 15:21:30 afazekas-1516283855.localdomain devstack@n-api.service[15371]: ERROR nova.api.openstack.wsgi     requested_ip=requested_ip, tag=tag)
  Jan 18 15:21:30 afazekas-1516283855.localdomain devstack@n-api.service[15371]: ERROR nova.api.openstack.wsgi   File "/opt/stack/nova/nova/compute/rpcapi.py", line 455, in attach_interface
  Jan 18 15:21:30 afazekas-1516283855.localdomain devstack@n-api.service[15371]: ERROR nova.api.openstack.wsgi     return cctxt.call(ctxt, 'attach_interface', **kw)
  Jan 18 15:21:30 afazekas-1516283855.localdomain devstack@n-api.service[15371]: ERROR nova.api.openstack.wsgi   File "/usr/lib/python2.7/site-packages/oslo_messaging/rpc/client.py", line 174, in call
  Jan 18 15:21:30 afazekas-1516283855.localdomain devstack@n-api.service[15371]: ERROR nova.api.openstack.wsgi     retry=self.retry)
  Jan 18 15:21:30 afazekas-1516283855.localdomain devstack@n-api.service[15371]: ERROR nova.api.openstack.wsgi   File "/usr/lib/python2.7/site-packages/oslo_messaging/transport.py", line 131, in _send
  Jan 18 15:21:30 afazekas-1516283855.localdomain devstack@n-api.service[15371]: ERROR nova.api.openstack.wsgi     timeout=timeout, retry=retry)
  Jan 18 15:21:30 afazekas-1516283855.localdomain devstack@n-api.service[15371]: ERROR nova.api.openstack.wsgi   File "/usr/lib/python2.7/site-packages/oslo_messaging/_drivers/amqpdriver.py", line 559, in send
  Jan 18 15:21:30 afazekas-1516283855.localdomain devstack@n-api.service[15371]: ERROR nova.api.openstack.wsgi     retry=retry)
  Jan 18 15:21:30 afazekas-1516283855.localdomain devstack@n-api.service[15371]: ERROR nova.api.openstack.wsgi   File "/usr/lib/python2.7/site-packages/oslo_messaging/_drivers/amqpdriver.py", line 550, in _send
  Jan 18 15:21:30 afazekas-1516283855.localdomain devstack@n-api.service[15371]: ERROR nova.api.openstack.wsgi     raise result
  Jan 18 15:21:30 afazekas-1516283855.localdomain devstack@n-api.service[15371]: ERROR nova.api.openstack.wsgi RemoteError: Remote error: Conflict IP address 10.0.0.3 already allocated in subnet 67edb4e0-aeae-4496
  Jan 18 15:21:30 afazekas-1516283855.localdomain devstack@n-api.service[15371]: ERROR nova.api.openstack.wsgi Neutron server returns request_ids: ['req-d63bbcfd-44d7-4986-a46f-00fbc4d58749']
  Jan 18 15:21:30 afazekas-1516283855.localdomain devstack@n-api.service[15371]: ERROR nova.api.openstack.wsgi [u'Traceback (most recent call last):\n', u'  File "/usr/lib/python2.7/site-packages/oslo_messaging/rp
  Jan 18 15:21:30 afazekas-1516283855.localdomain devstack@n-api.service[15371]: /api.py", line 938, in allocate_for_instance\n    security_group_ids)\n', u'  File "/opt/stack/nova/nova/network/neutronv2/api.py",
  Jan 18 15:21:30 afazekas-1516283855.localdomain devstack@n-api.service[15371]: 14, in wrapper\n    ret = obj(*args, **kwargs)\n', u'  File "/usr/lib/python2.7/site-packages/neutronclient/v2_0/client.py", line 26
  Jan 18 15:21:30 afazekas-1516283855.localdomain devstack@n-api.service[15371]: ERROR nova.api.openstack.wsgi
  Jan 18 15:21:30 afazekas-1516283855.localdomain devstack@n-api.service[15371]: INFO nova.api.openstack.wsgi [None req-64d655fe-0564-46ec-85c2-c982d34f796c demo demo] HTTP exception thrown: Unexpected API Error.
  Jan 18 15:21:30 afazekas-1516283855.localdomain devstack@n-api.service[15371]: <class 'oslo_messaging.rpc.client.RemoteError'>
  Jan 18 15:21:30 afazekas-1516283855.localdomain devstack@n-api.service[15371]: DEBUG nova.api.openstack.wsgi [None req-64d655fe-0564-46ec-85c2-c982d34f796c demo demo] Returning 500 to user: Unexpected API Error.
  Jan 18 15:21:30 afazekas-1516283855.localdomain devstack@n-api.service[15371]: <class 'oslo_messaging.rpc.client.RemoteError'> {{(pid=15372) __call__ /opt/stack/nova/nova/api/openstack/wsgi.py:1079}}

  Tested on Fedora 27 on Jan 18 2018 sources, the issue reproducible on
  older versions (pike).

To manage notifications about this bug go to:
https://bugs.launchpad.net/nova/+bug/1744103/+subscriptions


References