extra specs can not be set to share type if required spec is not provided

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

Bug Description

Manila share types have one required extra spec - "driver_handles_share_servers". And API disallows us to set some additional extra specs if we do not provide this one too. But it is ugly, because if we do not want to update this spec then we should not be
obligated to provide it.

Here is how it looks like:

$ manila --debug type-key somesharetype set k=v

...

REQ: curl -i -X POST http://172.18.198.52:8786/v1/694351ade1624402904c3f763bf9e7ec/types/96f373f2-5bd3-4641-9bff-b5b55d5ad2c7/extra_specs -H "X-Auth-Token: 34988e15e946485cbd600f56cf192463" -H "Content-Type: application/json" -H "Accept: application/json" -H "User-Agent: python-manilaclient" -d '{"extra_specs": {"k": "v"}}'

RESP: [400] {'date': 'Tue, 24 Mar 2015 12:01:07 GMT', 'connection': 'keep-alive', 'content-type': 'application/json; charset=UTF-8', 'content-length': '131', 'x-compute-request-id': 'req-01f0d48f-f689-4530-8a74-7faeefc078a7'}
RESP BODY: {"badRequest": {"message": "Invalid extra_spec: Required extra specs 'driver_handles_share_servers' not specified..", "code": 400}}

DEBUG (shell:507) Invalid extra_spec: Required extra specs 'driver_handles_share_servers' not specified.. (HTTP 400) (Request-ID: req-01f0d48f-f689-4530-8a74-7faeefc078a7)
Traceback (most recent call last):
  File "/opt/stack/python-manilaclient/manilaclient/shell.py", line 502, in main
    map(encodeutils.safe_decode, sys.argv[1:]))
  File "/opt/stack/python-manilaclient/manilaclient/shell.py", line 450, in main
    args.func(self.cs, args)
  File "/opt/stack/python-manilaclient/manilaclient/v1/shell.py", line 1903, in do_type_key
    stype.set_keys(keypair)
  File "/opt/stack/python-manilaclient/manilaclient/v1/share_types.py", line 73, in set_keys
    return_raw=True,
  File "/opt/stack/python-manilaclient/manilaclient/base.py", line 143, in _create
    resp, body = self.api.client.post(url, body=body)
  File "/opt/stack/python-manilaclient/manilaclient/httpclient.py", line 131, in post
    return self._cs_request(url, 'POST', **kwargs)
  File "/opt/stack/python-manilaclient/manilaclient/httpclient.py", line 107, in _cs_request
    **kwargs)
  File "/opt/stack/python-manilaclient/manilaclient/httpclient.py", line 96, in request
    raise exceptions.from_response(resp, method, url)
BadRequest: Invalid extra_spec: Required extra specs 'driver_handles_share_servers' not specified.. (HTTP 400) (Request-ID: req-01f0d48f-f689-4530-8a74-7faeefc078a7)
ERROR: Invalid extra_spec: Required extra specs 'driver_handles_share_servers' not specified..

Tags: api
Changed in manila:
importance: Undecided → High
assignee: nobody → Valeriy Ponomaryov (vponomaryov)
milestone: none → kilo-rc1
status: New → In Progress
description: updated
tags: added: api
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/167251

Revision history for this message
Luis Pabón (lpabon) wrote :

Reproduced:
- Devstack
$ source devstack/openrc admin admin
$ manila --debug type-key default set k=v

Revision history for this message
Luis Pabón (lpabon) wrote :

Verified Patch #3:

vagrant@vagrant-ubuntu-trusty-64:/opt/stack/manila$ manila --debug type-key default set k=v

REQ: curl -i -X GET http://10.0.2.15:8786/v1/c97d9add9ae244cbb855e466a04e72d6/types?is_public=all -H "X-Auth-Token: 4a589bcee6cf4e49933cd3086ea74ba9" -H "Accept: application/json" -H "User-Agent: python-manilaclient"

RESP: [200] CaseInsensitiveDict({'date': 'Tue, 24 Mar 2015 19:23:03 GMT', 'x-compute-request-id': 'req-a42a314e-a855-4901-81ee-5fc4c704ee59', 'content-type': 'application/json', 'content-length': '495'})
RESP BODY: {"volume_types": [{"os-share-type-access:is_public": true, "required_extra_specs": {"driver_handles_share_servers": "True"}, "extra_specs": {"driver_handles_share_servers": "True"}, "name": "default", "id": "b30e8ea3-4558-4a36-8d3f-ad1d529b0ba6"}], "share_types": [{"os-share-type-access:is_public": true, "required_extra_specs": {"driver_handles_share_servers": "True"}, "extra_specs": {"driver_handles_share_servers": "True"}, "name": "default", "id": "b30e8ea3-4558-4a36-8d3f-ad1d529b0ba6"}]}

REQ: curl -i -X GET http://10.0.2.15:8786/v1/c97d9add9ae244cbb855e466a04e72d6/types?is_public=all -H "X-Auth-Token: 4a589bcee6cf4e49933cd3086ea74ba9" -H "Accept: application/json" -H "User-Agent: python-manilaclient"

RESP: [200] CaseInsensitiveDict({'date': 'Tue, 24 Mar 2015 19:23:03 GMT', 'x-compute-request-id': 'req-1b567795-142a-4e02-b843-820f437bc3e8', 'content-type': 'application/json', 'content-length': '495'})
RESP BODY: {"volume_types": [{"os-share-type-access:is_public": true, "required_extra_specs": {"driver_handles_share_servers": "True"}, "extra_specs": {"driver_handles_share_servers": "True"}, "name": "default", "id": "b30e8ea3-4558-4a36-8d3f-ad1d529b0ba6"}], "share_types": [{"os-share-type-access:is_public": true, "required_extra_specs": {"driver_handles_share_servers": "True"}, "extra_specs": {"driver_handles_share_servers": "True"}, "name": "default", "id": "b30e8ea3-4558-4a36-8d3f-ad1d529b0ba6"}]}

REQ: curl -i -X POST http://10.0.2.15:8786/v1/c97d9add9ae244cbb855e466a04e72d6/types/b30e8ea3-4558-4a36-8d3f-ad1d529b0ba6/extra_specs -H "X-Auth-Token: 4a589bcee6cf4e49933cd3086ea74ba9" -H "Content-Type: application/json" -H "Accept: application/json" -H "User-Agent: python-manilaclient" -d '{"extra_specs": {"k": "v"}}'

RESP: [200] CaseInsensitiveDict({'date': 'Tue, 24 Mar 2015 19:23:03 GMT', 'x-compute-request-id': 'req-d8f428d7-6770-44bf-bc56-a766542b73da', 'content-type': 'application/json', 'content-length': '27'})
RESP BODY: {"extra_specs": {"k": "v"}}

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

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

commit 22ba5ab2c0827b11517d13f5000b5edfb7a18e78
Author: Valeriy Ponomaryov <email address hidden>
Date: Tue Mar 24 16:33:42 2015 +0200

    Fix setting of extra specs for share types

    Share types have one required extra spec - "driver_handles_share_servers".
    And API disallows us to set some additional extra specs if we do not provide
    required one too. It should not be so, because if we do not want to update
    already existing spec then we should not be obligated to provide it.

    Change-Id: Id2b2c9dfae3da551ae79e66199a84773f333b883
    Closes-Bug: #1435819

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: kilo-rc1 → 2015.1.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.