Cinderclient Raises Keystoneclient Exceptions When Using Keystone Session

Bug #1413781 reported by HT_Sergio
18
This bug affects 4 people
Affects Status Importance Assigned to Milestone
python-cinderclient
New
Undecided
Unassigned

Bug Description

For the same action, cinderclient will raise a different exception depending on how the cinderclient object was created.

Example that shows this behaviour:
http://paste.openstack.org/show/176913/

Expected exception:
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/sergio/code/env/local/lib/python2.7/site-packages/cinderclient/v1/volumes.py", line 187, in create
    return self._create('/volumes', body, 'volume')
  File "/home/sergio/code/env/local/lib/python2.7/site-packages/cinderclient/base.py", line 157, in _create
    resp, body = self.api.client.post(url, body=body)
  File "/home/sergio/code/env/local/lib/python2.7/site-packages/cinderclient/client.py", line 305, in post
    return self._cs_request(url, 'POST', **kwargs)
  File "/home/sergio/code/env/local/lib/python2.7/site-packages/cinderclient/client.py", line 269, in _cs_request
    **kwargs)
  File "/home/sergio/code/env/local/lib/python2.7/site-packages/cinderclient/client.py", line 252, in request
    raise exceptions.from_response(resp, body)
cinderclient.exceptions.BadRequest: Invalid input received: Volume size 0 must be an integer and greater than 0 (HTTP 400) (Request-ID: req-a60d45b2-3b8f-4e45-8a79-7b3157c0c973)

Exception when using a keystone session:
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/sergio/code/env/local/lib/python2.7/site-packages/cinderclient/v1/volumes.py", line 187, in create
    return self._create('/volumes', body, 'volume')
  File "/home/sergio/code/env/local/lib/python2.7/site-packages/cinderclient/base.py", line 157, in _create
    resp, body = self.api.client.post(url, body=body)
  File "/home/sergio/code/env/local/lib/python2.7/site-packages/cinderclient/client.py", line 91, in post
    return self._cs_request(url, 'POST', **kwargs)
  File "/home/sergio/code/env/local/lib/python2.7/site-packages/cinderclient/client.py", line 85, in _cs_request
    return self.request(url, method, **kwargs)
  File "/home/sergio/code/env/local/lib/python2.7/site-packages/cinderclient/client.py", line 80, in request
    return super(SessionClient, self).request(*args, **kwargs)
  File "/home/sergio/code/env/local/lib/python2.7/site-packages/keystoneclient/adapter.py", line 158, in request
    resp = super(LegacyJsonAdapter, self).request(*args, **kwargs)
  File "/home/sergio/code/env/local/lib/python2.7/site-packages/keystoneclient/adapter.py", line 88, in request
    return self.session.request(url, method, **kwargs)
  File "/home/sergio/code/env/local/lib/python2.7/site-packages/keystoneclient/utils.py", line 318, in inner
    return func(*args, **kwargs)
  File "/home/sergio/code/env/local/lib/python2.7/site-packages/keystoneclient/session.py", line 354, in request
    raise exceptions.from_response(resp, method, url)
keystoneclient.openstack.common.apiclient.exceptions.BadRequest: Bad Request (HTTP 400) (Request-ID: req-86c3e79d-ad38-43d8-a6fb-99a709d2b04d)

The second exception (keystoneclient.openstack.common.apiclient.exceptions.BadRequest) is an instance of keystoneclient.exceptions.BadRequest, which seems to me like that should only be exceptions coming from keystoneclient.

description: updated
description: updated
Revision history for this message
HT_Sergio (sergio-martins) wrote :

Related issue: https://bugs.launchpad.net/python-cinderclient/+bug/1412583
Possibly the fix for it will also fix this issue.

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.