API "snapshot-create" does not provide proper error description

Bug #1496408 reported by Valeriy Ponomaryov
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Shared File Systems Service (Manila)
Fix Released
Medium
Valeriy Ponomaryov

Bug Description

If we try to create snapshot from share is not snapshottable we expect error that it is not possible and proper descriptino for it.

With current master we get error without description:

$ manila --debug snapshot-create tt2

REQ: curl -i -X GET http://172.18.198.52:8786/v2/22e26f11dafb45bfb49e5a11253ce4c5/shares/detail?is_public=True -H "X-Openstack-Manila-Api-Version: 2.5" -H "X-Auth-Token: 80507abf63284b46be83af5ddef48cd2" -H "Accept: application/json" -H "User-Agent: python-manilaclient"

RESP: [200] {'content-length': '2158', 'x-compute-request-id': 'req-fbd11443-a7ec-48b1-a85a-3828d02500c5', 'vary': 'X-OpenStack-Manila-API-Version', 'connection': 'close', 'x-openstack-manila-api-version': '2.5', 'date': 'Wed, 16 Sep 2015 13:29:09 GMT', 'content-type': 'application/json'}
RESP BODY: {"shares": [{"links": [{"href": "http://172.18.198.52:8786/v2/22e26f11dafb45bfb49e5a11253ce4c5/shares/67f9a182-b4b8-46f3-abe1-1f2d6604279c", "rel": "self"}, {"href": "http://172.18.198.52:8786/22e26f11dafb45bfb49e5a11253ce4c5/shares/67f9a182-b4b8-46f3-abe1-1f2d6604279c", "rel": "bookmark"}], "availability_zone": "nova", "share_network_id": "0b4588fc-add1-4fda-a0dd-4b9f13873386", "export_locations": ["10.254.0.5:/shares/share-6532afad-fe5a-4b3e-bd66-6957ccd24295"], "share_server_id": "1320689d-80f4-49f6-8a70-0e2c1ed8ad90", "snapshot_id": null, "id": "67f9a182-b4b8-46f3-abe1-1f2d6604279c", "size": 1, "share_type": "default", "export_location": "10.254.0.5:/shares/share-6532afad-fe5a-4b3e-bd66-6957ccd24295", "consistency_group_id": null, "project_id": "22e26f11dafb45bfb49e5a11253ce4c5", "metadata": {}, "status": "available", "description": null, "host": "nosb-devstack@london#LONDON", "is_public": false, "snapshot_support": false, "name": "tt2", "created_at": "2015-09-16T10:46:28.000000", "share_proto": "NFS", "volume_type": "default", "source_cgsnapshot_member_id": null}, {"links": [{"href": "http://172.18.198.52:8786/v2/22e26f11dafb45bfb49e5a11253ce4c5/shares/5f5b2c74-a396-42d2-bfca-04cd04a01101", "rel": "self"}, {"href": "http://172.18.198.52:8786/22e26f11dafb45bfb49e5a11253ce4c5/shares/5f5b2c74-a396-42d2-bfca-04cd04a01101", "rel": "bookmark"}], "availability_zone": "nova", "share_network_id": "aba13468-c73b-4813-ad3d-e7e62436b2ce", "export_locations": ["10.254.0.3:/shares/share-7af6f000-3576-4e83-b49e-2d054b3aa28a"], "share_server_id": "3a4caac5-0880-4629-a334-6cdda88a0c0e", "snapshot_id": null, "id": "5f5b2c74-a396-42d2-bfca-04cd04a01101", "size": 1, "share_type": "default", "export_location": "10.254.0.3:/shares/share-7af6f000-3576-4e83-b49e-2d054b3aa28a", "consistency_group_id": null, "project_id": "22e26f11dafb45bfb49e5a11253ce4c5", "metadata": {}, "status": "available", "description": null, "host": "nosb-devstack@london#LONDON", "is_public": false, "snapshot_support": true, "name": "tt", "created_at": "2015-09-10T17:18:34.000000", "share_proto": "NFS", "volume_type": "default", "source_cgsnapshot_member_id": null}]}

REQ: curl -i -X GET http://172.18.198.52:8786/v2/22e26f11dafb45bfb49e5a11253ce4c5/shares/detail?is_public=True -H "X-Openstack-Manila-Api-Version: 2.5" -H "X-Auth-Token: 80507abf63284b46be83af5ddef48cd2" -H "Accept: application/json" -H "User-Agent: python-manilaclient"

RESP: [200] {'content-length': '2158', 'x-compute-request-id': 'req-b89cb7c1-2e6f-43e8-b41e-5c3b1cd36f8c', 'vary': 'X-OpenStack-Manila-API-Version', 'connection': 'close', 'x-openstack-manila-api-version': '2.5', 'date': 'Wed, 16 Sep 2015 13:29:09 GMT', 'content-type': 'application/json'}
RESP BODY: {"shares": [{"links": [{"href": "http://172.18.198.52:8786/v2/22e26f11dafb45bfb49e5a11253ce4c5/shares/67f9a182-b4b8-46f3-abe1-1f2d6604279c", "rel": "self"}, {"href": "http://172.18.198.52:8786/22e26f11dafb45bfb49e5a11253ce4c5/shares/67f9a182-b4b8-46f3-abe1-1f2d6604279c", "rel": "bookmark"}], "availability_zone": "nova", "share_network_id": "0b4588fc-add1-4fda-a0dd-4b9f13873386", "export_locations": ["10.254.0.5:/shares/share-6532afad-fe5a-4b3e-bd66-6957ccd24295"], "share_server_id": "1320689d-80f4-49f6-8a70-0e2c1ed8ad90", "snapshot_id": null, "id": "67f9a182-b4b8-46f3-abe1-1f2d6604279c", "size": 1, "share_type": "default", "export_location": "10.254.0.5:/shares/share-6532afad-fe5a-4b3e-bd66-6957ccd24295", "consistency_group_id": null, "project_id": "22e26f11dafb45bfb49e5a11253ce4c5", "metadata": {}, "status": "available", "description": null, "host": "nosb-devstack@london#LONDON", "is_public": false, "snapshot_support": false, "name": "tt2", "created_at": "2015-09-16T10:46:28.000000", "share_proto": "NFS", "volume_type": "default", "source_cgsnapshot_member_id": null}, {"links": [{"href": "http://172.18.198.52:8786/v2/22e26f11dafb45bfb49e5a11253ce4c5/shares/5f5b2c74-a396-42d2-bfca-04cd04a01101", "rel": "self"}, {"href": "http://172.18.198.52:8786/22e26f11dafb45bfb49e5a11253ce4c5/shares/5f5b2c74-a396-42d2-bfca-04cd04a01101", "rel": "bookmark"}], "availability_zone": "nova", "share_network_id": "aba13468-c73b-4813-ad3d-e7e62436b2ce", "export_locations": ["10.254.0.3:/shares/share-7af6f000-3576-4e83-b49e-2d054b3aa28a"], "share_server_id": "3a4caac5-0880-4629-a334-6cdda88a0c0e", "snapshot_id": null, "id": "5f5b2c74-a396-42d2-bfca-04cd04a01101", "size": 1, "share_type": "default", "export_location": "10.254.0.3:/shares/share-7af6f000-3576-4e83-b49e-2d054b3aa28a", "consistency_group_id": null, "project_id": "22e26f11dafb45bfb49e5a11253ce4c5", "metadata": {}, "status": "available", "description": null, "host": "nosb-devstack@london#LONDON", "is_public": false, "snapshot_support": true, "name": "tt", "created_at": "2015-09-10T17:18:34.000000", "share_proto": "NFS", "volume_type": "default", "source_cgsnapshot_member_id": null}]}

REQ: curl -i -X POST http://172.18.198.52:8786/v2/22e26f11dafb45bfb49e5a11253ce4c5/snapshots -H "X-Openstack-Manila-Api-Version: 2.5" -H "X-Auth-Token: 80507abf63284b46be83af5ddef48cd2" -H "Content-Type: application/json" -H "Accept: application/json" -H "User-Agent: python-manilaclient" -d '{"snapshot": {"share_id": "67f9a182-b4b8-46f3-abe1-1f2d6604279c", "force": false, "name": null, "description": null}}'

RESP: [422] {'content-length': '90', 'x-compute-request-id': 'req-73595d69-d77e-45ec-bd83-ec86bd4a62c9', 'vary': 'X-OpenStack-Manila-API-Version', 'connection': 'close', 'x-openstack-manila-api-version': '2.5', 'date': 'Wed, 16 Sep 2015 13:29:09 GMT', 'content-type': 'application/json; charset=UTF-8'}
RESP BODY: {"computeFault": {"message": "Unable to process the contained instructions", "code": 422}}

DEBUG (shell:510) Unable to process the contained instructions (HTTP 422) (Request-ID: req-73595d69-d77e-45ec-bd83-ec86bd4a62c9)
Traceback (most recent call last):
  File "/opt/stack/python-manilaclient/manilaclient/shell.py", line 505, in main
    map(encodeutils.safe_decode, sys.argv[1:]))
  File "/opt/stack/python-manilaclient/manilaclient/shell.py", line 453, in main
    args.func(self.cs, args)
  File "/opt/stack/python-manilaclient/manilaclient/v1/shell.py", line 1157, in do_snapshot_create
    args.description)
  File "/opt/stack/python-manilaclient/manilaclient/v1/share_snapshots.py", line 68, in create
    return self._create('/snapshots', body, 'snapshot')
  File "/opt/stack/python-manilaclient/manilaclient/base.py", line 151, in _create
    resp, body = self.api.client.post(url, body=body)
  File "/opt/stack/python-manilaclient/manilaclient/httpclient.py", line 153, in post
    return self._cs_request(url, 'POST', **kwargs)
  File "/opt/stack/python-manilaclient/manilaclient/httpclient.py", line 112, in _cs_request
    **kwargs)
  File "/opt/stack/python-manilaclient/manilaclient/httpclient.py", line 126, in _cs_request_with_retries
    resp, body = self.request(url, method, **kwargs)
  File "/opt/stack/python-manilaclient/manilaclient/httpclient.py", line 104, in request
    raise exceptions.from_response(resp, method, url)
UnprocessableEntity: Unable to process the contained instructions (HTTP 422) (Request-ID: req-73595d69-d77e-45ec-bd83-ec86bd4a62c9)
ERROR: Unable to process the contained instructions

Changed in manila:
milestone: none → liberty-rc1
assignee: nobody → Valeriy Ponomaryov (vponomaryov)
status: New → In Progress
importance: Undecided → Medium
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to manila (master)

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

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to manila (master)

Reviewed: https://review.openstack.org/225577
Committed: https://git.openstack.org/cgit/openstack/manila/commit/?id=fdca2909de273d38d3c9c03e5b44343fd2bbe0be
Submitter: Jenkins
Branch: master

commit fdca2909de273d38d3c9c03e5b44343fd2bbe0be
Author: Valeriy Ponomaryov <email address hidden>
Date: Mon Sep 21 11:12:52 2015 +0300

    Fix error response when denying snapshot creation

    If we try to create snapshot from share that is not snapshottable
    we expect error that it is not possible and proper description for it.
    Now we get some abstract message
    "ERROR: Unable to process the contained instructions".

    So, make API provide proper information about error.

    Change-Id: I16a2f7c80102159c30f91af7e045e73ee3df7f89
    Closes-Bug: #1496408

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