Create Volume snapshot with invalid Volume ID is returning 500 ERROR

Bug #1014687 reported by Rajalakshmi Ganesan
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Cinder
Fix Released
Undecided
Eoghan Glynn

Bug Description

Description: Create Volume snapshot with invalid Volume ID is throwing 500 Error.

Expected Result: Should return error code 400. (raise Bad Request)

Actual Result: Is returning 500 error code . (Compute Fault)

LOG:
-------

AssertionError: Create Snapshot did not raise Badrequest for ['', '1234567890', 'alphabetic', '!@#$%^&*()_+:>>'] as invalidVolume IDs
-------------------- >> begin captured logging << --------------------
tempest.common.rest_client: ERROR: Request URL: http://127.0.0.1:8774/v1.1/admin/os-snapshots
tempest.common.rest_client: ERROR: Request Body: {"snapshot": {"force": "false", "display_name": "VolumeSnap-46474293957", "display_description": "VolumeSnapDescrip-32621310791", "volume_id": ""}}
tempest.common.rest_client: ERROR: Response Headers: {'date': 'Mon, 18 Jun 2012 19:29:29 GMT', 'status': '500', 'content-length': '128', 'content-type': 'application/json; charset=UTF-8', 'x-compute-request-id': 'req-f23bb461-1dac-4582-ab77-4db4281681bd'}
tempest.common.rest_client: ERROR: Response Body: {u'computeFault': {u'message': u'The server has either erred or is incapable of performing the requested operation.', u'code': 500}}
tempest.common.rest_client: ERROR: Request URL: http://127.0.0.1:8774/v1.1/admin/os-snapshots
tempest.common.rest_client: ERROR: Request Body: {"snapshot": {"force": "false", "display_name": "VolumeSnap-46474293957", "display_description": "VolumeSnapDescrip-32621310791", "volume_id": "1234567890"}}
tempest.common.rest_client: ERROR: Response Headers: {'date': 'Mon, 18 Jun 2012 19:29:33 GMT', 'status': '500', 'content-length': '128', 'content-type': 'application/json; charset=UTF-8', 'x-compute-request-id': 'req-8770baca-2ee6-4e33-8593-88caecce6d27'}
tempest.common.rest_client: ERROR: Response Body: {u'computeFault': {u'message': u'The server has either erred or is incapable of performing the requested operation.', u'code': 500}}
tempest.common.rest_client: ERROR: Request URL: http://127.0.0.1:8774/v1.1/admin/os-snapshots
tempest.common.rest_client: ERROR: Request Body: {"snapshot": {"force": "false", "display_name": "VolumeSnap-46474293957", "display_description": "VolumeSnapDescrip-32621310791", "volume_id": "alphabetic"}}
tempest.common.rest_client: ERROR: Response Headers: {'date': 'Mon, 18 Jun 2012 19:29:34 GMT', 'status': '500', 'content-length': '128', 'content-type': 'application/json; charset=UTF-8', 'x-compute-request-id': 'req-0a111b54-4139-4219-ae15-f1464f389091'}
tempest.common.rest_client: ERROR: Response Body: {u'computeFault': {u'message': u'The server has either erred or is incapable of performing the requested operation.', u'code': 500}}
tempest.common.rest_client: ERROR: Request URL: http://127.0.0.1:8774/v1.1/admin/os-snapshots
tempest.common.rest_client: ERROR: Request Body: {"snapshot": {"force": "false", "display_name": "VolumeSnap-46474293957", "display_description": "VolumeSnapDescrip-32621310791", "volume_id": "!@#$%^&*()_+:>>"}}
tempest.common.rest_client: ERROR: Response Headers: {'date': 'Mon, 18 Jun 2012 19:29:38 GMT', 'status': '500', 'content-length': '128', 'content-type': 'application/json; charset=UTF-8', 'x-compute-request-id': 'req-877e3e4f-8b2d-4989-a0e3-7c242c8b61f1'}
tempest.common.rest_client: ERROR: Response Body: {u'computeFault': {u'message': u'The server has either erred or is incapable of performing the requested operation.', u'code': 500}}
--------------------- >> end captured logging << ---------------------

description: updated
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (master)

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

Changed in nova:
assignee: nobody → Rongze Zhu (zrzhit)
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

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

Revision history for this message
Rongze Zhu (zrzhit) wrote :

I use cinderr reproduce it.

zhu@zrz-dev:~/git/devstack$ cinder --debug snapshot-create 'noexist'
connect: (127.0.0.1, 5000)
send: 'POST /v2.0/tokens HTTP/1.1\r\nHost: 127.0.0.1:5000\r\nContent-Length: 98\r\ncontent-type: application/json\r\naccept-encoding: gzip, deflate\r\naccept: application/json\r\nuser-agent: python-cinderclient\r\n\r\n{"auth": {"tenantName": "demo", "passwordCredentials": {"username": "admin", "password": "root"}}}'
reply: 'HTTP/1.1 200 OK\r\n'
header: Vary: X-Auth-Token
header: Content-Type: application/json
header: Content-Length: 2090
header: Date: Wed, 15 Aug 2012 09:37:22 GMT
connect: (10.42.1.143, 8776)
send: u'POST /v1/a8e170f3d0604588a967e4579c75d78d/snapshots HTTP/1.1\r\nHost: 10.42.1.143:8776\r\nContent-Length: 105\r\nx-auth-project-id: demo\r\naccept-encoding: gzip, deflate\r\naccept: application/json\r\nx-auth-token: 836ffa6581b14242b165be784e9c19ef\r\nuser-agent: python-cinderclient\r\ncontent-type: application/json\r\n\r\n{"snapshot": {"display_name": null, "force": false, "display_description": null, "volume_id": "noexist"}}'
reply: 'HTTP/1.1 500 Internal Server Error\r\n'
header: Content-Length: 128
header: Content-Type: application/json; charset=UTF-8
header: X-Compute-Request-Id: req-b016d976-70e5-4d83-89bc-8a3b50f1bcb4
header: Date: Wed, 15 Aug 2012 09:37:23 GMT
DEBUG (shell:443) The server has either erred or is incapable of performing the requested operation. (HTTP 500) (Request-ID: req-b016d976-70e5-4d83-89bc-8a3b50f1bcb4)
Traceback (most recent call last):
  File "/opt/stack/python-cinderclient/cinderclient/shell.py", line 440, in main
    OpenStackCinderShell().main(sys.argv[1:])
  File "/opt/stack/python-cinderclient/cinderclient/shell.py", line 391, in main
    args.func(self.cs, args)
  File "/opt/stack/python-cinderclient/cinderclient/v1/shell.py", line 215, in do_snapshot_create
    args.display_description)
  File "/opt/stack/python-cinderclient/cinderclient/v1/volume_snapshots.py", line 68, in create
    return self._create('/snapshots', body, 'snapshot')
  File "/opt/stack/python-cinderclient/cinderclient/base.py", line 149, in _create
    resp, body = self.api.client.post(url, body=body)
  File "/opt/stack/python-cinderclient/cinderclient/client.py", line 140, in post
    return self._cs_request(url, 'POST', **kwargs)
  File "/opt/stack/python-cinderclient/cinderclient/client.py", line 125, in _cs_request
    **kwargs)
  File "/opt/stack/python-cinderclient/cinderclient/client.py", line 108, in request
    raise exceptions.from_response(resp, body)
ClientException: The server has either erred or is incapable of performing the requested operation. (HTTP 500) (Request-ID: req-b016d976-70e5-4d83-89bc-8a3b50f1bcb4)
ERROR: The server has either erred or is incapable of performing the requested operation. (HTTP 500) (Request-ID: req-b016d976-70e5-4d83-89bc-8a3b50f1bcb4)
zhu@zrz-dev:~/git/devstack$

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/11397

Changed in cinder:
assignee: nobody → Rongze Zhu (zrzhit)
status: New → In Progress
Revision history for this message
Duncan Thomas (duncan-thomas) wrote :

Looks like diablo returns a 404 in this case.

duncan@z400-duncan:~$ nova volume-snapshot-create 000
Volume 0 could not be found. (HTTP 404)

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

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

Changed in cinder:
assignee: Rongze Zhu (zrzhit) → Eoghan Glynn (eglynn)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to cinder (master)

Reviewed: https://review.openstack.org/11398
Committed: http://github.com/openstack/cinder/commit/f7938c0b96c047490b6eb935cbf882505ce4a811
Submitter: Jenkins
Branch: master

commit f7938c0b96c047490b6eb935cbf882505ce4a811
Author: Eoghan Glynn <email address hidden>
Date: Wed Aug 15 10:36:09 2012 +0000

    Map internal exceptions in the nova style.

    Fixes LP 1014687.

    Adopt the nova idiom of internal exceptions mapped to their
    corresponding HTTP reponse code in the FaultWrapper middleware,
    and also inclusion of their detail message if declared safe for
    external exposure.

    Change-Id: I95a3c30466f6951e02f7a182545ff8db8fbecee8

Changed in cinder:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in cinder:
milestone: none → folsom-3
status: Fix Committed → Fix Released
Revision history for this message
Eoghan Glynn (eglynn) wrote :

The nova aspect of this bug is invalid, as the exception mapping logic in the nova FaultWrapper (as ported in https://review.openstack.org/11398) would already take care of mapping the NotFound exception to a 404 response.

So I'm going to detach the nova aspect, making this bug Cinder only.

no longer affects: nova
Thierry Carrez (ttx)
Changed in cinder:
milestone: folsom-3 → 2012.2
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.