Ask Your Question

cinder type-key failed

asked 2013-04-22 19:50:49 -0500

kong gravatar image

updated 2013-04-22 19:55:22 -0500

I used Grizzly in my setup. I follow the steps below:

1. create a volume type named 'lvm'
root@openstack:~# cinder type-list
| ID | Name |
| fb18bbb9-7989-4b5d-b4d6-f61e5d071338 | lvm |

2. I want to add a extraspec, I got error messages below:
root@openstack:~# *cinder --debug type-key fb18bbb9-7989-4b5d-b4d6-f61e5d071338 set volume

REQ: curl -i -X POST -H "Content-Type: application/json" -H "Accept: application/json" -H "User-Agent: python-cinderclient"

RESP: [200] {'date': 'Tue, 23 Apr 2013 00:43:45 GMT', 'content-type': 'application/json', 'content-length': '2527', 'vary': 'X-Auth-Token'} RESP BODY: {"access": {"token": {"issuedat": "2013-04-23T00:43:45.874472", "expires": "2013-04-24T00:43:45Z", "id": "ccee44c55d984709bba7953b4023e1fc", "tenant": {"description": null, "enabled": true, "id": "0bfe6a094db14ab6859146b3ad04aa0b", "name": "admin"}}, "serviceCatalog": [{"endpoints": [{"adminURL": "", "region": "RegionOne", "internalURL": "", "id": "76896678112445ed9c5c8a1184ec000f", "publicURL": ""}], "endpointslinks": [], "type": "compute", "name": "nova"}, {"endpoints": [{"adminURL": "", "region": "RegionOne", "internalURL": "", "id": "011781d8487b428e8eeaf2d6c327c2b3", "publicURL": ""}], "endpointslinks": [], "type": "network", "name": "quantum"}, {"endpoints": [{"adminURL": "", "region": "RegionOne", "internalURL": "", "id": "1452ccfaccf642e18067648009a3658c", "publicURL": ""}], "endpointslinks": [], "type": "image", "name": "glance"}, {"endpoints": [{"adminURL": "", "region": "RegionOne", "internalURL": "", "id": "74acf246e96646b69c8201da993623ba", "publicURL": ""}], "endpointslinks": [], "type": "volume", "name": "cinder"}, {"endpoints": [{"adminURL": "", "region": "RegionOne", "internalURL": "", "id": "75e1a71917dd4993a71d4e010e83852a", "publicURL": ""}], "endpointslinks": [], "type": "ec2", "name": "ec2"}, {"endpoints": [{"adminURL": "", "region": "RegionOne", "internalURL": "", "id": "44576f97ccdf4fcca39721072c07cc41", "publicURL": ""}], "endpointslinks": [], "type": "identity", "name": "keystone"}], "user": {"username": "admin", "roleslinks": [], "id": "e20e552df6cf4340ac8f89ac5f4aa3ac", "roles": [{"name": "admin"}, {"name": "KeystoneServiceAdmin"}, {"name": "KeystoneAdmin"}], "name": "admin"}, "metadata": {"is_admin": 0, "roles": ["33a701e2e15541cea0311070ad6db1be", "b175dbd7bb6f4dee94680fd637dbe9fe", "695a5c7be0f849de8a40a3b5e712a67e"]}}}

REQ: curl -i -X GET -H "X-Auth-Project-Id: admin" -H "User-Agent: python-cinderclient" -H "Accept: application/json" -H "X-Auth-Token: ccee44c55d984709bba7953b4023e1fc"

RESP: [200] {'date': 'Tue, 23 Apr 2013 00:43:45 GMT', 'x-compute-request-id': 'req-c15489c9-43dd-40dc-925f-13905edd6937', 'content-type': 'application/json', 'content-length': '97'} RESP BODY: {"volumetype": {"extraspecs": {}, "name": "lvm", "id": "fb18bbb9-7989-4b5d-b4d6-f61e5d071338"}}

DEBUG (shell:491) unhashable type: 'list' Traceback (most recent call last): File "/usr/lib/python2.7/dist-packages/cinderclient/", line 488, in main OpenStackCinderShell().main(sys.argv[1:]) File "/usr/lib/python2.7/dist-packages/cinderclient/", line 439, in main args.func(self.cs, args) File "/usr/lib/python2.7/dist-packages/cinderclient/v1/", line 481, in dotypekey keypair = extractmetadata(args) File "/usr/lib/python2.7/dist-packages/cinderclient/v1/", line 105, in extractmetadata ... (more)

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2013-04-22 20:21:36 -0500

kong gravatar image

updated 2013-04-22 20:22:16 -0500

def _extract_metadata(args):
    metadata = {}
    for metadatum in args.metadata:
        # unset doesn't require a val, so we have the if/else
        print type(metadatum)
        if '=' in metadatum:
            print "True"
            (key, value) = metadatum.split('=', 1)
            print "False"
            key = metadatum
            value = None
        metadata[key] = value
    return metadata

I found the type of "metadatum" is <type 'list'="">, list is not hashable. Am I right?

edit flag offensive delete link more


@kong: IMO, you need to check the type of the variable 'metadata' (and not 'metadatum'); since the statement which throws the exception refers 'metadata' (in the stack trace provided above). In fact, the exception is getting raised since the value of variable 'key' is turning out to be a list!

unmesh-gurjar gravatar imageunmesh-gurjar ( 2013-04-23 03:30:01 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Get to know Ask OpenStack

Resources for moderators

Question Tools


Asked: 2013-04-22 19:50:49 -0500

Seen: 218 times

Last updated: Apr 22 '13