Ask Your Question
0

Cinder-volume using API's(No JSON Object could be decoded)

asked 2014-03-27 08:02:31 -0600

RHK gravatar image

updated 2014-10-16 04:53:21 -0600

Hello,

I am not able to list Cinder volumes through REST API's

Below was the curl command i am using

curl -s -H "X-Auth-Token: $TOKEN_ID" -X GET -H "Content-type: application/json" http://10.10.10.51:9292/v2.0/$tenant_id/volumes/detail |python -m json.tool
No JSON object could be decoded

Was there any changes required on syntax? How to get the cinder volumes details using APi's

UPDATE

I modified the port to 8776,

curl -s -H "X-Auth-Token: $TOKEN_ID" -X GET -H "Content-type: application/json" \
  http://10.10.10.51:8776/v2.0/$tenant_id/volumes/detail |python -m json.tool

Now i am getting like below response. I am not getting the exact information.

{ "choices": [ { "id": "v1.0", "links": [ { "href": "http://10.10.10.51:8776/v1/v2.0/80e2ada69b4449a9a6506f3407f46528/volumes/detail", "rel": "self" } ], "media-types": [ { "base": "application/xml", "type": "application/vnd.openstack.volume+xml;version=1" }, { "base": "application/json", "type": "application/vnd.openstack.volume+json;version=1" } ], "status": "CURRENT" }, { "id": "v2.0", "links": [ { "href": "http://10.10.10.51:8776/v1/v2.0/80e2ada69b4449a9a6506f3407f46528/volumes/detail", "rel": "self" } ], "media-types": [ { "base": "application/xml", "type": "application/vnd.openstack.volume+xml;version=1" }, { "base": "application/json", "type": "application/vnd.openstack.volume+json;version=1" } ], "status": "CURRENT" } ] }

Regards,
RHK

edit retag flag offensive close merge delete

Comments

Because this question is old (and answered), you're probably not going to get many people looking at it. You probably want to post a new question.

larsks gravatar imagelarsks ( 2014-10-16 13:59:48 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
1

answered 2014-03-27 08:59:32 -0600

larsks gravatar image

updated 2014-04-02 13:26:29 -0600

Port 9292 is glance, not cinder. Cinder listens on port 8776. You can find out what services are listening on what ports using the keystone service-list and endpoint-list commands. For example

$ keystone service-list | grep cinder
| d81505aec2b5464eb299a2814d9a7ef6 |  cinder  |     volume     |       Cinder Service       |
$ keystone endpoint-list | grep d81505aec2b5464eb299a2814d9a7ef6
| d32688601e714d4e8077d8df07fde5e8 | RegionOne | http://192.168.200.1:8776/v1/%(tenant_id)s | http://192.168.200.1:8776/v1/%(tenant_id)s | http://192.168.200.1:8776/v1/%(tenant_id)s | d81505aec2b5464eb299a2814d9a7ef6 |

Knowing the correct port, I can access the cinder API like this:

curl -X GET -s -H "x-auth-token: $TOKEN" \
  -H 'content-type: application/json' \
  http://192.168.200.1:8776/v1/$OS_TENANT_ID/volumes | jq .
{
  "volumes": [
    {
      "size": 1,
      "id": "fe69f0b6-8402-45ab-81ce-ecb6ee997ba4",
      "metadata": {},
      "source_volid": null,
      "snapshot_id": null,
      "status": "available",
      "display_name": null,
      "attachments": [],
      "availability_zone": "nova",
      "bootable": "false",
      "created_at": "2014-03-27T13:48:17.000000",
      "display_description": null,
      "volume_type": "None"
    }
  ]
}

UPDATE 2014-04-02

While you are now using the correct port, you're still using the wrong endpoint URL. Start with a request to:

http://10.10.10.51:8776/

And you will probably see a response like this:

{
  "versions": [
    {
      "links": [
        {
          "rel": "self",
          "href": "http://10.10.10.51:8776/v1/"
        }
      ],
      "id": "v1.0",
      "updated": "2012-01-04T11:33:21Z",
      "status": "CURRENT"
    },
    {
      "links": [
        {
          "rel": "self",
          "href": "http://10.10.10.51:8776/v1/"
        }
      ],
      "id": "v2.0",
      "updated": "2012-11-21T11:33:21Z",
      "status": "CURRENT"
    }
  ]
}

This tells you that for either API version 1.0 or 2.0, the endpoint is:

http://10.10.10.51:8776/v1/

Which means your complete URL should be:

http://10.10.10.51:8776/v1/$tenant_id/volumes/detail

You are using:

http://10.10.10.51:8776/v2.0/

Which isn't a valid API endpoint.

edit flag offensive delete link more

Comments

Thank You, i am getting the correct response now.

RHK gravatar imageRHK ( 2014-04-03 05:35:00 -0600 )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

1 follower

Stats

Asked: 2014-03-27 08:02:31 -0600

Seen: 1,895 times

Last updated: Oct 16 '14