Bug 806143 - using python novaclient results in 1GB of data transferred over rest interface
using python novaclient results in 1GB of data transferred over rest interface
Status: CLOSED NOTABUG
Product: Fedora
Classification: Fedora
Component: python-novaclient (Show other bugs)
17
x86_64 Linux
unspecified Severity low
: ---
: ---
Assigned To: Mark McLoughlin
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-03-22 22:20 EDT by Steven Dake
Modified: 2016-04-26 12:47 EDT (History)
5 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2012-12-21 17:13:11 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Steven Dake 2012-03-22 22:20:28 EDT
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-22 22:21:52 EDT
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 11:52:42 EDT
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 17:13:11 EST
-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.