Bug 806143 - using python novaclient results in 1GB of data transferred over rest interface
Summary: using python novaclient results in 1GB of data transferred over rest interface
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: python-novaclient
Version: 17
Hardware: x86_64
OS: Linux
unspecified
low
Target Milestone: ---
Assignee: Mark McLoughlin
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-03-23 02:20 UTC by Steven Dake
Modified: 2016-04-26 16:47 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2012-12-21 22:13:11 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Steven Dake 2012-03-23 02:20:28 UTC
Description of problem:

Ussing Essex RC1 + Keystone:

Running a test program results in a 1160249344 byte response from rest server.  Since the response is garbage, the python api call results in:
Traceback (most recent call last):
  File "./test", line 21, in <module>
    image_data = nova_client.images.get(image_list[0])
  File "/usr/lib/python2.7/site-packages/python_novaclient-2012.2-py2.7.egg/novaclient/v1_1/images.py", line 38, in get
    return self._get("/images/%s" % base.getid(image), "image")
  File "/usr/lib/python2.7/site-packages/python_novaclient-2012.2-py2.7.egg/novaclient/base.py", line 153, in _get
    return self.resource_class(self, body[response_key])
TypeError: string indices must be integers, not str


Version-Release number of selected component (if applicable):
F16 RC1 Essex APIs

How reproducible:
100% 

Steps to Reproduce:
1. run test program
2.
3.
  
Actual results:
python fault

Expected results:
no fault, a proper image detail from the call

Additional info:

Note the test program may not be entirely correct.  I have also tried service_type='compute', service_name='nova' which results the nova image-list problem occuring (error 500 - looks like auth not passed between nova compute and glance).  The documentation indicates these parameters aren't necessary, but then I receive endpoint errors.  Note the list returned in the first api is correct, but the image details in the second api call fail with the 1gb dump over the network.

(source keystonerc)
note an image should be registered

Test program:
#!/usr/bin/python

import eventlet
from eventlet.green import socket
import libssh2
import time
import os
import random
import base64
import M2Crypto
from novaclient.v1_1 import client

username = os.environ['OS_USERNAME']
password = os.environ['OS_PASSWORD']
tenant = os.environ['OS_TENANT_NAME']
auth_url = os.environ['OS_AUTH_URL']

nova_client = client.Client(username, password, tenant, auth_url, service_type='
image', service_name='glance')

image_list = nova_client.images.list()
image_data = nova_client.images.get(image_list[0])

Comment 1 Steven Dake 2012-03-23 02:21:52 UTC
Angus I'm off to dinner.  Would you mind trying this on your F17 install?  Also, could you try with a nova registered image vs one that was registered with our jeos_create?  Could be user error on our part.  Would be helpful to understand where the error lies so the API could be hardened.

Comment 2 Steven Dake 2012-03-23 15:52:42 UTC
Note this problem still occurs with latest getting started guide, but using the nova pass-through works properly, so not a major concern for me atm.

nova-passthrough:
nova_client = client.Client(username, password, tenant, auth_url,
service_type='compute', service_name='nova')

Comment 3 Alan Pevec 2012-12-21 22:13:11 UTC
-nova_client = client.Client(username, password, tenant, auth_url, service_type='image', service_name='glance',http_log_debug=True)
+nova_client = client.Client(username, password, tenant, auth_url, service_type='compute', service_name='nova',http_log_debug=True)

So bad things happen when novaclient talks to Glance API endpoint...

Glance REST API was forked from Nova so wrong endpoint seemed to work at first, but there were changes, from glance/api/v1/images.py

        GET /images/detail -- Returns a set of detailed metadata about
                              images
        HEAD /images/<ID> -- Return metadata about an image with id <ID>
        GET /images/<ID> -- Return image data for image with id <ID>

vs Compute API (from api.openstack.org)

GET v2/images/{image_id} Lists details of the specified image.

Where you expected just metadata, Glance was happily streaming you the whole image :)


Note You need to log in before you can comment on or make changes to this bug.