[Openstack-operators] Nova API Help

Linux Datacenter linuxdatacenter at gmail.com
Mon Apr 23 03:04:43 UTC 2012


The documentation at: http://api.openstack.org states that you need to have
your tenant id in the url:

v1.1/{tenant_id}/flavors

also, as http://api.openstack.org still misses some content, there is a way
to intercept some calls via http to the api server. Here are the steps:

1. run tcpdump on the interface and port that nova-api listens on and
capture the stream to pcap file (-w <filename> option for tcpdump)
2. as the cloud user ("admin" in your case I guess), run: nova flavor-list
3. stop tcpdump and transfer the capture file from tcpdump to your
workstation
4. on your workstation install and run wireshark
5. load the pcap file to wireshark and go to analysis-> follow tcp stream (
http://www.wireshark.org/docs/wsug_html_chunked/ChAdvFollowTCPSection.html)

you should now see in wireshark how "nova flavor-list" interacted with the
API component, including valid url and post data in json form.

Hope this helps,
-Piotr

On 20 April 2012 13:23, <mpedersen at choopa.com> wrote:

> On Fri, 20 Apr 2012 13:01:59 -0700, "Daneyon Hansen (danehans)"
> <danehans at cisco.com> wrote:
> > What are the nova logs showing?
>
> I knew I'd forget something. I restarted nova-api in debug mode (via: stop
> nova-api; nova-api -d) Here's the logs from each request, and yes, the
> second request really did produce no output. It's been sanitized: ADMIN was
> the X-Auth-Token, and IP.ADDRESS was the server running nova-api. I also
> noticed a pattern "Unrecognized Content-Type" appearing, so the final run
> shown below is with Content-Type header sent. Still got an error
>
> 400.-----------------------------------------------------------------------------------------------
>
> -----------------------------------------------------------------------------------------------
> COMMAND: curl -v -H "X-Auth-Token: ADMIN" http://IP.ADDRESS:8774/flavors
> ---LOG
> 2012-04-20 16:07:39 INFO nova.api.openstack.wsgi [-] GET
> http://IP.ADDRESS:8774/flavors
> 2012-04-20 16:07:39 DEBUG nova.api.openstack.wsgi [-] Unrecognized
> Content-Type provided in request from (pid=14907) get_body
> /usr/lib/python2.7/dist-packages/nova/api/openstack/wsgi.py:697
> 2012-04-20 16:07:39 INFO nova.api.openstack.wsgi [-]
> http://IP.ADDRESS:8774/flavors returned with HTTP 300
>
> ---RESPONSE
> * About to connect() to IP.ADDRESS port 8774 (#0)
> *   Trying IP.ADDRESS... connected
> * Connected to IP.ADDRESS (IP.ADDRESS) port 8774 (#0)
> > GET /flavors HTTP/1.1
> > User-Agent: curl/7.21.6 (x86_64-pc-linux-gnu) libcurl/7.21.6
> OpenSSL/1.0.0e zlib/1.2.3.4 libidn/1.22 librtmp/2.3
> > Host: IP.ADDRESS:8774
> > Accept: */*
> > X-Auth-Token: ADMIN
> >
> < HTTP/1.1 300 Multiple Choices
> < Content-Type: application/json
> < Content-Length: 320
> < Date: Fri, 20 Apr 2012 19:44:41 GMT
> <
> * Connection #0 to host IP.ADDRESS left intact
> * Closing connection #0
> {"choices": [{"status": "CURRENT", "media-types": [{"base":
> "application/xml", "type":
> "application/vnd.openstack.compute+xml;version=2"}, {"base":
> "application/json", "type":
> "application/vnd.openstack.compute+json;version=2"}], "id": "v2.0",
> "links": [{"href": "http://IP.ADDRESS:8774/v2/flavors", "rel": "self"}]}]}
>
>
>
> -----------------------------------------------------------------------------------------------
>
> -----------------------------------------------------------------------------------------------
> COMMAND: curl -v -H "X-Auth-Token: ADMIN"
> http://IP.ADDRESS:8774/v2/flavors
> ---LOG
>
> ---RESPONSE
> * About to connect() to IP.ADDRESS port 8774 (#0)
> *   Trying IP.ADDRESS... connected
> * Connected to IP.ADDRESS (IP.ADDRESS) port 8774 (#0)
> > GET /v2/flavors HTTP/1.1
> > User-Agent: curl/7.21.6 (x86_64-pc-linux-gnu) libcurl/7.21.6
> OpenSSL/1.0.0e zlib/1.2.3.4 libidn/1.22 librtmp/2.3
> > Host: IP.ADDRESS:8774
> > Accept: */*
> > X-Auth-Token: ADMIN
> >
> < HTTP/1.1 404 Not Found
> < Content-Length: 154
> < Content-Type: text/html; charset=UTF-8
> < Date: Fri, 20 Apr 2012 19:46:09 GMT
> <
> <html>
>  <head>
>  <title>404 Not Found</title>
>  </head>
>  <body>
>  <h1>404 Not Found</h1>
>  The resource could not be found.<br /><br />
>
>
>
>  </body>
> * Connection #0 to host IP.ADDRESS left intact
> * Closing connection #0
> </html>
>
>
>
> -----------------------------------------------------------------------------------------------
>
> -----------------------------------------------------------------------------------------------
> COMMAND: curl -v -H "X-Auth-Token: ADMIN"
> http://IP.ADDRESS:8774/openstack/flavors
> ---LOG
> 2012-04-20 16:10:11 INFO nova.api.openstack.wsgi [-] GET
> http://IP.ADDRESS:8774/openstack/flavors
> 2012-04-20 16:10:11 DEBUG nova.api.openstack.wsgi [-] Unrecognized
> Content-Type provided in request from (pid=14907) get_body
> /usr/lib/python2.7/dist-packages/nova/api/openstack/wsgi.py:697
> 2012-04-20 16:10:11 INFO nova.api.openstack.wsgi [-]
> http://IP.ADDRESS:8774/openstack/flavors returned with HTTP 300
>
> ---RESPONSE
> * About to connect() to IP.ADDRESS port 8774 (#0)
> *   Trying IP.ADDRESS... connected
> * Connected to IP.ADDRESS (IP.ADDRESS) port 8774 (#0)
> > GET /openstack/flavors HTTP/1.1
> > User-Agent: curl/7.21.6 (x86_64-pc-linux-gnu) libcurl/7.21.6
> OpenSSL/1.0.0e zlib/1.2.3.4 libidn/1.22 librtmp/2.3
> > Host: IP.ADDRESS:8774
> > Accept: */*
> > X-Auth-Token: ADMIN
> >
> < HTTP/1.1 300 Multiple Choices
> < Content-Type: application/json
> < Content-Length: 330
> < Date: Fri, 20 Apr 2012 19:47:58 GMT
> <
> * Connection #0 to host IP.ADDRESS left intact
> * Closing connection #0
> {"choices": [{"status": "CURRENT", "media-types": [{"base":
> "application/xml", "type":
> "application/vnd.openstack.compute+xml;version=2"}, {"base":
> "application/json", "type":
> "application/vnd.openstack.compute+json;version=2"}], "id": "v2.0",
> "links": [{"href": "http://IP.ADDRESS:8774/v2/openstack/flavors", "rel":
> "self"}]}]}
>
>
>
> -----------------------------------------------------------------------------------------------
>
> -----------------------------------------------------------------------------------------------
> COMMAND: curl -v -H "X-Auth-Token: ADMIN"
> http://IP.ADDRESS:8774/v2/openstack/flavors
> ---LOG
> 2012-04-20 16:10:44 INFO nova.api.openstack.wsgi
> [req-cdd444c1-094c-4d4a-901e-5d46dd703240 419e714fcdf74bc2831ef3f5bfb24430
> e74f096476c8487883ee0905239dadc4] GET
> http://IP.ADDRESS:8774/v2/openstack/flavors
> 2012-04-20 16:10:44 DEBUG nova.api.openstack.wsgi
> [req-cdd444c1-094c-4d4a-901e-5d46dd703240 419e714fcdf74bc2831ef3f5bfb24430
> e74f096476c8487883ee0905239dadc4] Unrecognized Content-Type provided in
> request from (pid=14907) get_body
> /usr/lib/python2.7/dist-packages/nova/api/openstack/wsgi.py:697
>
> ---RESPONSE
> * About to connect() to IP.ADDRESS port 8774 (#0)
> *   Trying IP.ADDRESS... connected
> * Connected to IP.ADDRESS (IP.ADDRESS) port 8774 (#0)
> > GET /v2/openstack/flavors HTTP/1.1
> > User-Agent: curl/7.21.6 (x86_64-pc-linux-gnu) libcurl/7.21.6
> OpenSSL/1.0.0e zlib/1.2.3.4 libidn/1.22 librtmp/2.3
> > Host: IP.ADDRESS:8774
> > Accept: */*
> > X-Auth-Token: ADMIN
> >
> < HTTP/1.1 400 Bad Request
> < Content-Length: 65
> < Content-Type: application/json; charset=UTF-8
> < X-Compute-Request-Id: req-fba3d209-945b-4748-ab8c-d02db60d9b47
> < Date: Fri, 20 Apr 2012 19:47:23 GMT
> <
> * Connection #0 to host IP.ADDRESS left intact
> * Closing connection #0
> {"badRequest": {"message": "Malformed request url", "code": 400}}
>
>
>
> -----------------------------------------------------------------------------------------------
>
> -----------------------------------------------------------------------------------------------
> COMMAND: curl -v -H "X-Auth-Token: ADMIN" -H "Content-type:
> application/json" http://IP.ADDRESS:8774/v2/openstack/flavors
> ---LOG
> 2012-04-20 16:18:56 INFO nova.api.openstack.wsgi
> [req-ab363386-6c07-4176-9b6b-4c0941f82df4 419e714fcdf74bc2831ef3f5bfb24430
> e74f096476c8487883ee0905239dadc4] GET
> http://IP.ADDRESS:8774/v2/openstack/flavors
> 2012-04-20 16:18:56 DEBUG nova.api.openstack.wsgi
> [req-ab363386-6c07-4176-9b6b-4c0941f82df4 419e714fcdf74bc2831ef3f5bfb24430
> e74f096476c8487883ee0905239dadc4] Empty body provided in request from
> (pid=14907) get_body
> /usr/lib/python2.7/dist-packages/nova/api/openstack/wsgi.py:705
>
> ---RESPONSE
> * About to connect() to IP.ADDRESS port 8774 (#0)
> *   Trying IP.ADDRESS... connected
> * Connected to IP.ADDRESS (IP.ADDRESS) port 8774 (#0)
> > GET /v2/openstack/flavors HTTP/1.1
> > User-Agent: curl/7.21.6 (x86_64-pc-linux-gnu) libcurl/7.21.6
> OpenSSL/1.0.0e zlib/1.2.3.4 libidn/1.22 librtmp/2.3
> > Host: IP.ADDRESS:8774
> > Accept: */*
> > X-Auth-Token: ADMIN
> > Content-type: application/json
> >
> < HTTP/1.1 400 Bad Request
> < Content-Length: 65
> < Content-Type: application/json; charset=UTF-8
> < X-Compute-Request-Id: req-ab363386-6c07-4176-9b6b-4c0941f82df4
> < Date: Fri, 20 Apr 2012 20:18:56 GMT
> <
> * Connection #0 to host IP.ADDRESS left intact
> * Closing connection #0
> {"badRequest": {"message": "Malformed request url", "code": 400}}
> _______________________________________________
> Openstack-operators mailing list
> Openstack-operators at lists.openstack.org
> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-operators
>



-- 
checkout my blog on linux clusters:
-- linuxdatacenter.blogspot.com --
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-operators/attachments/20120422/a52858ba/attachment-0002.html>


More information about the Openstack-operators mailing list