softlayer / jumpgate

A simple library to make more clouds compatible with OpenStack.
http://softlayer.github.io/jumpgate/
MIT License
46 stars 30 forks source link

Use of limit & marker parameters to glance list-images is broken #134

Closed jimlindeman closed 9 years ago

jimlindeman commented 10 years ago

The logic in ImagesV2.on_get (in image/driver/sl/images.py) for handling limit & marker is fundamentally broken, primarily because the marker logic tries to set an inequality-based filter on the "globalIdentifier" but then fails to sort the results by that field. Because the results are not sorted by that inequality's field, certain images get reported multiple times and other images get skipped. Also the logic fails to actually check if the marker parameter passed in maps to a public or private image before starting with reporting from the proper set.

I dived into the code and found the current available parameters passed into the two Softlayer "get-images" APIs are described here: http://sldn.softlayer.com/reference/services/SoftLayer_Virtual_Guest_Block_Device_Template_Group/getPublicImages and http://sldn.softlayer.com/reference/services/SoftLayer_Account/getPrivateBlockDeviceTemplateGroups

Both of those calls lack a sort-field parameter, which is absolutely necessary in the current usage of the marker parameter being passed as an inequality-based filter shown in the code (as we need to be sorting by 'globalIdentifier'): if marker is not None: _filter['privateBlockDeviceTemplateGroups']['globalIdentifier'] = ( sl_utils.query_filter('> %s' % marker))

There seems to be at least three ways to handle this: 1) Add sort parameter to those SoftLayer APIs and have Jumpgate specify that sorting if marker != None. 2) Add the marker as a separate parameter to those Softlayer APIs and change Jumpgate to not specify it as an inequality-filter 3) Just fetch the entire set of images from Softlayer (both public/private) without limit & marker parameters and apply the limit/marker logic in Jumpgate (very inefficient for reading large # of images in small chunks)

jimlindeman commented 9 years ago

This is resolved by changes in issue #146