Bug 1619384 - openstack client for network commands doesn't handle the RESP code 409 properly
Summary: openstack client for network commands doesn't handle the RESP code 409 properly
Keywords:
Status: CLOSED DUPLICATE of bug 1570786
Alias: None
Product: Red Hat OpenStack
Classification: Red Hat
Component: python-openstacksdk
Version: 13.0 (Queens)
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
: ---
Assignee: RHOS Maint
QA Contact: nlevinki
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-08-20 16:38 UTC by Numan Siddique
Modified: 2018-08-21 14:46 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-08-21 14:46:05 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Numan Siddique 2018-08-20 16:38:05 UTC
Description of problem:

Suppose I create a port and all the IPs in the subnet are exhausted, neutron server returns error 409 with the message -

RESP: [409] Content-Type: application/json Content-Length: 164 X-Openstack-Request-Id: req-2023b247-2602-4835-9817-6be51d5452d0 Date: Mon, 20 Aug 2018 16:26:07 GMT 
RESP BODY: {"NeutronError": {"message": "No more IP addresses available on network 3658721d-ec0c-41a5-9fe0-5d726079e822.", "type": "IpAddressGenerationFailure", "detail": ""}}

But openstack client displays the final result as

(overcloud) [stack@undercloud-0 ~]$ openstack port create --network priv p3 
HttpException: Unknown error
(overcloud) [stack@undercloud-0 ~]$ 

The same command when used with upstream devstack, it displays as

[stack@numcentos ~]$ openstack port create --network priv t3
ConflictException: 409: Client Error for url: http://127.0.0.1:9696/v2.0/ports, {"NeutronError": {"message": "No more IP addresses available on network 18ac8052-aea1-47f5-a18f-d93b0b6ceb93.", "type": "IpAddressGenerationFailure", "detail": ""}}



Version-Release number of selected component (if applicable):
OSP13
(overcloud) [stack@undercloud-0 ~]$ rpm -qa | grep python2-openstackclient
python2-openstackclient-3.14.2-1.el7ost.noarch



How reproducible:
All the time

Steps to Reproduce:
1. openstack network create priv
2. openstack subnet create --network priv --subnet-range 30.0.0.0/24 --allocation-pool start=30.0.0.2,end=30.0.0.4 priv_subnet
3. openstack port create --network priv p1
4. openstack port create --network priv p2
..
5. openstack port create --network priv p3 -debug
...
...
RESP BODY: {"NeutronError": {"message": "No more IP addresses available on network 3658721d-ec0c-41a5-9fe0-5d726079e822.", "type": "IpAddressGenerationFailure", "detail": ""}}

POST call to network for http://10.0.0.108:9696/v2.0/ports used request id req-da65aba0-a248-4d2b-a444-62e290e657f2
Manager unknown ran task network.POST.ports in 0.8569419384s
HttpException: Unknown error
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/cliff/app.py", line 400, in run_subcommand
    result = cmd.run(parsed_args)
  File "/usr/lib/python2.7/site-packages/osc_lib/command/command.py", line 41, in run
    return super(Command, self).run(parsed_args)
  File "/usr/lib/python2.7/site-packages/cliff/display.py", line 116, in run
    column_names, data = self.take_action(parsed_args)
  File "/usr/lib/python2.7/site-packages/openstackclient/network/v2/port.py", line 429, in take_action
    obj = client.create_port(**attrs)
  File "/usr/lib/python2.7/site-packages/openstack/network/v2/_proxy.py", line 1456, in create_port
    return self._create(_port.Port, **attrs)
  File "/usr/lib/python2.7/site-packages/openstack/proxy.py", line 194, in _create
    return res.create(self)
  File "/usr/lib/python2.7/site-packages/openstack/resource.py", line 732, in create
    self._translate_response(response)
  File "/usr/lib/python2.7/site-packages/openstack/resource.py", line 664, in _translate_response
    exceptions.raise_from_response(response, error_message=error_message)
  File "/usr/lib/python2.7/site-packages/openstack/exceptions.py", line 205, in raise_from_response
    http_status=http_status, request_id=request_id
HttpException: HttpException: Unknown error
clean_up CreatePort: HttpException: Unknown error
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/osc_lib/shell.py", line 134, in run
    ret_val = super(OpenStackShell, self).run(argv)
  File "/usr/lib/python2.7/site-packages/cliff/app.py", line 279, in run
    result = self.run_subcommand(remainder)
  File "/usr/lib/python2.7/site-packages/osc_lib/shell.py", line 169, in run_subcommand
    ret_value = super(OpenStackShell, self).run_subcommand(argv)
  File "/usr/lib/python2.7/site-packages/cliff/app.py", line 400, in run_subcommand
    result = cmd.run(parsed_args)
  File "/usr/lib/python2.7/site-packages/osc_lib/command/command.py", line 41, in run
    return super(Command, self).run(parsed_args)
  File "/usr/lib/python2.7/site-packages/cliff/display.py", line 116, in run
    column_names, data = self.take_action(parsed_args)
  File "/usr/lib/python2.7/site-packages/openstackclient/network/v2/port.py", line 429, in take_action
    obj = client.create_port(**attrs)
  File "/usr/lib/python2.7/site-packages/openstack/network/v2/_proxy.py", line 1456, in create_port
    return self._create(_port.Port, **attrs)
  File "/usr/lib/python2.7/site-packages/openstack/proxy.py", line 194, in _create
    return res.create(self)
  File "/usr/lib/python2.7/site-packages/openstack/resource.py", line 732, in create
    self._translate_response(response)
  File "/usr/lib/python2.7/site-packages/openstack/resource.py", line 664, in _translate_response
    exceptions.raise_from_response(response, error_message=error_message)
  File "/usr/lib/python2.7/site-packages/openstack/exceptions.py", line 205, in raise_from_response
    http_status=http_status, request_id=request_id
HttpException: HttpException: Unknown error

END return value: 1


Actual results:


Expected results:


Additional info:

Comment 1 Julie Pichon 2018-08-21 14:46:05 UTC
Thank you for including detailed steps to reproduce. It looks like this is fixed in 14, all in openstacksdk.

For the detailed error message, this is fixed thanks to https://review.openstack.org/#/c/571101/

For HTTPException vs ConflictException this is fixed with https://review.openstack.org/#/c/555142/

And finally for showing "Unknown error" instead of "409" this is fixed by https://review.openstack.org/#/c/555143/

It appears these patches are already tracked in another generic bug related to error messages in networking commands, so marking this one as duplicate.

*** This bug has been marked as a duplicate of bug 1570786 ***


Note You need to log in before you can comment on or make changes to this bug.