aodh/tests/image
xingzhou dfcd0dd7c4 ImagePollster record duplicate counter during one poll
When using ImagePollster to poll image status from Glance, there might
be duplicate image status event recorded down if there are private
images together with public images stored in Glance.

In Glance, the get image list API looks like:
    def _get_images(self, context, filters, **params):
        ...
 # NOTE(markwash): for backwards compatibility, is_public=True for
 # admins actually means "treat me as if I'm not an admin and show
 # all my images"
        if context.is_admin and params.get('is_public') is True:
            context.is_admin = False
            del params['is_public']
        ...
The above code shows that if a user is of 'admin_role'(this option is
configured in the glance-api.conf)  and querying for public images,
Glance will return all the public images together with the private
ones

While in ceilometer/image/glance.py#_Base.iter_images method,
ceilometer get the image list by querying public and private images
respectively and then chain the result lists together. This causes
the duplication of image in the image list.

This fix changes the code in ImagePollster.get_counters method to
filter out the duplicate images based on their image id.

Change-Id: Ib5e213161043033c20195efc0c6e7edd78982bd6
Fixes: Bug 1180630
2013-05-27 21:27:51 -04:00
..
__init__.py Allow glance pollster tests to run. 2012-09-26 10:20:02 +01:00
test_glance.py ImagePollster record duplicate counter during one poll 2013-05-27 21:27:51 -04:00
test_notifications.py Get all tests to use tests.base.TestCase 2013-05-15 11:37:48 -04:00