neutron openstack client returns ' Unknown error' instead of the real error

Bug #1764259 reported by Adit Sarfaty
20
This bug affects 4 people
Affects Status Importance Assigned to Milestone
python-openstackclient
Incomplete
Undecided
Unassigned

Bug Description

For several neutron create actions, when called via the openstack client you do not get the real error issued by the plugin, as you do with the neutronclient. instead yo get:
BadRequestException: Unknown error

For example, try to create a subnet without a cidr:
1) with the neutron client you see the real error:
neutron subnet-create --name sub1 net1
neutron CLI is deprecated and will be removed in the future. Use openstack CLI instead.
Bad subnets request: a subnetpool must be specified in the absence of a cidr.
Neutron server returns request_ids: ['req-8ee84525-6e98-4774-9392-ab8b596cde1a']

2) with the openstack client the information is missing:
openstack subnet create --network net1 sub1
BadRequestException: Unknown error

Revision history for this message
Slawek Kaplonski (slaweq) wrote :

I didn't check it locally but from Your description it looks like it's bug in OpenStack Client, not in Neutron. If neutronclient displays proper error message, it means IMO that neutron returns proper info via REST API.

Can You explain if there is something wrong on Neutron's side here? If so, please maybe attach logs from neutron-server which shows problem there.

Changed in neutron:
status: New → Incomplete
Revision history for this message
Adit Sarfaty (asarfaty) wrote :

You are right. The fix will probably need to be in the python-openstackclient code.

affects: neutron → python-openstackclient
Revision history for this message
James LaBarre (jlabarre-rh) wrote :
Download full text (5.2 KiB)

Also encountered this problem while trying to set values on a router. Running the command:

    openstack router set --external-gateway provider_network external

resulted in the "BadRequestException: Unknown error" message.

Adding a "--debug" switch (openstack --debug router set --external-gateway provider_network external) managed to show the error, which led to a solution. But it would have been better to get more descriptive output at the beginning.

RELEVANT OUTPUT NEAR THE ERROR:
===========================================================================

GET call to network for http://192.168.77.69:9696/v2.0/networks used request id req-cae8f31f-00a3-4ef8-b3b8-cb6c6125344a
Manager unknown ran task network.GET.networks in 0.112754106522s
Manager unknown running task network.PUT.routers
REQ: curl -g -i -X PUT http://192.168.77.69:9696/v2.0/routers/56479717-b56c-44c9-af6a-1f031219941b -H "User-Agent: osc-lib/1.9.0 keystoneauth1/3.4.0 python-requests/2.14.2 CPython/2.7.5" -H "Content-Type: application/json" -H "X-Auth-Token: {SHA1}5a9c2739672fb9878895b14d461c4b1438ec5713" -d '{"router": {"external_gateway_info": {"network_id": "78a1c6f7-fe5a-4ba0-99b0-c66b03c8ceec"}}}'
http://192.168.77.69:9696 "PUT /v2.0/routers/56479717-b56c-44c9-af6a-1f031219941b HTTP/1.1" 400 161
RESP: [400] Content-Type: application/json Content-Length: 161 X-Openstack-Request-Id: req-c6ce077c-771a-4f8d-b205-df4720530d60 Date: Thu, 27 Sep 2018 20:19:06 GMT
RESP BODY: {"NeutronError": {"message": "Bad router request: Network 78a1c6f7-fe5a-4ba0-99b0-c66b03c8ceec is not an external network.", "type": "BadRequest", "detail": ""}}

PUT call to network for http://192.168.77.69:9696/v2.0/routers/56479717-b56c-44c9-af6a-1f031219941b used request id req-c6ce077c-771a-4f8d-b205-df4720530d60
Manager unknown ran task network.PUT.routers in 0.741237878799s
BadRequestException: 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/command.py", line 184, in run
    return_code = self.take_action(parsed_args) or 0
  File "/usr/lib/python2.7/site-packages/openstackclient/network/v2/router.py", line 642, in take_action
    client.update_router(obj, **attrs)
  File "/usr/lib/python2.7/site-packages/openstack/network/v2/_proxy.py", line 2316, in update_router
    return self._update(_router.Router, router, **attrs)
  File "/usr/lib/python2.7/site-packages/openstack/proxy.py", line 38, in check
    return method(self, expected, actual, *args, **kwargs)
  File "/usr/lib/python2.7/site-packages/openstack/proxy.py", line 174, in _update
    return res.update(self)
  File "/usr/lib/python2.7/site-packages/openstack/resource.py", line 820, in update
    self._translate_response(response, has_body=has_body)
  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/pyt...

Read more...

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.