lyn
lyn

Reputation: 53

How to use openstack API v3 to list accessible volumes

I am learning OpenStack now and I want to list all accessible volumes on my OpenStack controller by HTTP get request with x_auth_token:

http://{OpenStack controller IP}:8776/v3/{project_id}/volumes

(Reference URL: https://developer.openstack.org/api-ref/block-storage/v3/index.html?expanded=#list-accessible-volumes)

But, the request body always as below:

    {
    "badRequest":{
    "message": "Malformed request url",
    "code": 400
    }
}

I have try many times but they all didn't work. So, I want to know, what the request url should be here? Thanks in advance.....

Upvotes: 0

Views: 1570

Answers (1)

TommyLike
TommyLike

Reputation: 1018

One of the possible reasons is that your project_id is incorrect or doesn't match your credential, take a look at this link. In order to solve this problem you can:
1. Try openstack command with debug option.

openstack --debug volume list
#or
cinder --debug list

you could get the request and response details:

REQ: curl -g -i -X GET http://ip:port/v3/{project_id}/volumes/detail -H "User-Agent: python-cinderclient" -H "Accept: application/json" -H "X-Auth-Token: {token_value}"

Make sure you have input every required headers(context-type/x-auth-token/...).

  1. Try to ask for help in irc channel #openstack-cinder

Upvotes: 1

Related Questions