cinder os-attach returns 500

Bug #1449454 reported by Pranali Deore
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Cinder
Fix Released
Undecided
Abhijeet Malawade

Bug Description

Using below curl command, cinder service returns 500 error

1. If volume passed to the curl command is in 'in-use' state,

   curl -g -i --cacert "/opt/stack/data/CA/int-ca/ca-chain.pem" -X POST http://10.69.4.136:8776/v2/7dc3c5bbd69c45e8a0345497e36377d5/volumes/4f5454f8-a1d0-4907-8175-1f06dd2d93f8/action -H "User-Agent: python-cinderclient" -H "Content-Type: application/json" -H "Accept: application/json" -H "X-Auth-Token: a1a655ea182345d29f4d9816a4e0eb04" -d '{"os-attach": {"instance_uuid": "95adc232-652a-4986-aa38-64f035fce409","mountpoint": "/dev/vdc","mode": "rw"}}'

Error log of c-api:

2015-04-24 01:50:05.150 ERROR cinder.api.middleware.fault [req-4235a6f9-dbe9-4e2a-8284-8f7bb7dc1978 0de8c6faec4d4b9b8250c7d26cf27dec 7dc3c5bbd69c45e8a0345497e36377d5] Caught error: Remote error: Remote error: InvalidVolume Invalid volume: volume is already attached
[u'Traceback (most recent call last):\n', u' File "/usr/local/lib/python2.7/dist-packages/oslo_messaging/rpc/dispatcher.py", line 142, in _dispatch_and_reply\n executor_callback))\n', u' File "/usr/local/lib/python2.7/dist-packages/oslo_messaging/rpc/dispatcher.py", line 186, in _dispatch\n executor_callback)\n', u' File "/usr/local/lib/python2.7/dist-packages/oslo_messaging/rpc/dispatcher.py", line 130, in _do_dispatch\n result = func(ctxt, **new_args)\n', u' File "/usr/local/lib/python2.7/dist-packages/osprofiler/profiler.py", line 105, in wrapper\n return f(*args, **kwargs)\n', u' File "/opt/stack/cinder/cinder/volume/manager.py", line 843, in attach_volume\n return do_attach()\n', u' File "/usr/local/lib/python2.7/dist-packages/oslo_concurrency/lockutils.py", line 445, in inner\n return f(*args, **kwargs)\n', u' File "/opt/stack/cinder/cinder/volume/manager.py", line 774, in do_attach\n raise exception.InvalidVolume(reason=msg)\n', u'InvalidVolume: Invalid volume: volume is already attached\n']. None
None.
2015-04-24 01:50:05.151 INFO cinder.api.middleware.fault [req-4235a6f9-dbe9-4e2a-8284-8f7bb7dc1978 0de8c6faec4d4b9b8250c7d26cf27dec 7dc3c5bbd69c45e8a0345497e36377d5] http://10.69.4.136:8776/v2/7dc3c5bbd69c45e8a0345497e36377d5/volumes/4f5454f8-a1d0-4907-8175-1f06dd2d93f8/action returned with HTTP 500
2015-04-24 01:50:05.152 INFO eventlet.wsgi.server [req-4235a6f9-dbe9-4e2a-8284-8f7bb7dc1978 0de8c6faec4d4b9b8250c7d26cf27dec 7dc3c5bbd69c45e8a0345497e36377d5] 10.69.4.136 - - [24/Apr/2015 01:50:05] "POST /v2/7dc3c5bbd69c45e8a0345497e36377d5/volumes/4f5454f8-a1d0-4907-8175-1f06dd2d93f8/action HTTP/1.1" 500 401 3.760313

2. If instance ID is not UUID

   curl -g -i --cacert "/opt/stack/data/CA/int-ca/ca-chain.pem" -X POST http://10.69.4.136:8776/v2/7dc3c5bbd69c45e8a0345497e36377d5/volumes/4f5454f8-a1d0-4907-8175-1f06dd2d93f8/action -H "User-Agent: python-cinderclient" -H "Content-Type: application/json" -H "Accept: application/json" -H "X-Auth-Token: a1a655ea182345d29f4d9816a4e0eb04" -d '{"os-attach": {"instance_uuid": "95adc232-652a-4986-aa38-64f035fce40ih8","mountpoint": "/dev/vdc2","mode": "rw"}}'

Error log of c-api:

2015-04-24 02:21:37.049 ERROR cinder.api.middleware.fault [req-fc87840a-80ce-44ec-87d0-9798383cbc84 0de8c6faec4d4b9b8250c7d26cf27dec 7dc3c5bbd69c45e8a0345497e36377d5] Caught error: Remote error: Remote error: InvalidUUID Expected a uuid but received 95adc232-652a-4986-aa38-64f035fce40ih8.
[u'Traceback (most recent call last):\n', u' File "/usr/local/lib/python2.7/dist-packages/oslo_messaging/rpc/dispatcher.py", line 142, in _dispatch_and_reply\n executor_callback))\n', u' File "/usr/local/lib/python2.7/dist-packages/oslo_messaging/rpc/dispatcher.py", line 186, in _dispatch\n executor_callback)\n', u' File "/usr/local/lib/python2.7/dist-packages/oslo_messaging/rpc/dispatcher.py", line 130, in _do_dispatch\n result = func(ctxt, **new_args)\n', u' File "/usr/local/lib/python2.7/dist-packages/osprofiler/profiler.py", line 105, in wrapper\n return f(*args, **kwargs)\n', u' File "/opt/stack/cinder/cinder/volume/manager.py", line 843, in attach_volume\n return do_attach()\n', u' File "/usr/local/lib/python2.7/dist-packages/oslo_concurrency/lockutils.py", line 445, in inner\n return f(*args, **kwargs)\n', u' File "/opt/stack/cinder/cinder/volume/manager.py", line 805, in do_attach\n raise exception.InvalidUUID(uuid=instance_uuid)\n', u'InvalidUUID: Expected a uuid but received 95adc232-652a-4986-aa38-64f035fce40ih8.\n']. None
None.
2015-04-24 02:21:37.050 INFO cinder.api.middleware.fault [req-fc87840a-80ce-44ec-87d0-9798383cbc84 0de8c6faec4d4b9b8250c7d26cf27dec 7dc3c5bbd69c45e8a0345497e36377d5] http://10.69.4.136:8776/v2/7dc3c5bbd69c45e8a0345497e36377d5/volumes/4f5454f8-a1d0-4907-8175-1f06dd2d93f8/action returned with HTTP 500
2015-04-24 02:21:37.050 INFO eventlet.wsgi.server [req-fc87840a-80ce-44ec-87d0-9798383cbc84 0de8c6faec4d4b9b8250c7d26cf27dec 7dc3c5bbd69c45e8a0345497e36377d5] 10.69.4.136 - - [24/Apr/2015 02:21:37] "POST /v2/7dc3c5bbd69c45e8a0345497e36377d5/volumes/4f5454f8-a1d0-4907-8175-1f06dd2d93f8/action HTTP/1.1" 500 401 3.678798

In both above cases, 400 error should be returned to the end user.

Changed in cinder:
assignee: nobody → Pranali Deore (pranali-deore)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to cinder (master)

Fix proposed to branch: master
Review: https://review.openstack.org/178565

Changed in cinder:
status: New → In Progress
Changed in cinder:
assignee: Pranali Deore (pranali-deore) → Abhijeet Malawade (abhijeet-malawade)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to cinder (master)

Reviewed: https://review.openstack.org/178565
Committed: https://git.openstack.org/cgit/openstack/cinder/commit/?id=42d4d1cc7fe8b2f5eb797905baf3a82220c1d711
Submitter: Jenkins
Branch: master

commit 42d4d1cc7fe8b2f5eb797905baf3a82220c1d711
Author: PranaliDeore <email address hidden>
Date: Mon Apr 27 04:52:46 2015 -0700

    Cinder os-attach api returns 500

    If volume is in 'in-use' state or invalid instance UUID
    is passed to cinder os-attach api, then it returns 500 error
    because InvalidVolume and InvalidUUID exceptions are raised
    from manager, but not caught at api level.

    Caught RemoteError exception in the api and returned 400 error
    code if user passes invalid information of the volume or invalid
    instance UUID.

    Closes-Bug: 1449454
    Change-Id: I2121b03b9f2310c40e0158627b7d4b9ba73a8f5d

Changed in cinder:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in cinder:
milestone: none → liberty-1
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in cinder:
milestone: liberty-1 → 7.0.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.