None image.size value crashes on get_sample

Bug #1484117 reported by Igor Degtiarov
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Ceilometer
Fix Released
High
Igor Degtiarov
Kilo
Fix Released
Undecided
Unassigned

Bug Description

Using glanceclient one could create an empty image so sample image.size will contain None value.

>>> image = glance.images.create(name='test')
>>>
>>> image
{u'status': u'queued', u'tags': [], u'container_format': None, u'min_ram': 0, u'updated_at': u'2015-08-12T09:52:20Z', u'visibility': u'private', u'owner': u'c5deed5fa1554e7baf08557947533bc8', u'file': u'/v2/images/0a35561e-b6d3-4249-b37a-36f04b5c0826/file', u'min_disk': 0, u'virtual_size': None, u'id': u'0a35561e-b6d3-4249-b37a-36f04b5c0826',
u'size': None,
u'name': u'test', u'checksum': None, u'created_at': u'2015-08-12T09:52:20Z', u'disk_format': None, u'protected': False, u'schema': u'/v2/schemas/image'}

That is not appropriate when we are talking about metrics and will crash get_sample function on MongoDB and HBase backends because we explicitly change type of volume to float (see patch https://review.openstack.org/#/c/207567/)

Revision history for this message
Igor Degtiarov (idegtiarov) wrote :

I see two ways for fixing:

Add default value for 'counter_volume' field, 0 --- looks like the most suitable for None, if we are talking about metric

Or check for not None counter_volume on writing data into database to exclude None metrics from storage.

As for me second way looks better.

Changed in ceilometer:
assignee: nobody → Igor Degtiarov (idegtiarov)
Changed in ceilometer:
status: New → In Progress
importance: Undecided → High
milestone: none → liberty-3
Revision history for this message
gordon chung (chungg) wrote :

i think the second option might be better as well... i think it's really a case by case scenario where None actually does mean 0 so we probably shouldn't blindly assign 0 to it..

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to ceilometer (master)

Fix proposed to branch: master
Review: https://review.openstack.org/212610

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to ceilometer (master)

Reviewed: https://review.openstack.org/212610
Committed: https://git.openstack.org/cgit/openstack/ceilometer/commit/?id=804de4ef2f26e1892dc2580fe16897b14741a13a
Submitter: Jenkins
Branch: master

commit 804de4ef2f26e1892dc2580fe16897b14741a13a
Author: Igor Degtiarov <email address hidden>
Date: Fri Aug 14 18:47:48 2015 +0300

    Avoid from storing samples with empty or not numerical volumes

    In some cases Ceilometer receives notifications with 'counter_volume' equal
    None, for ex. from glance when empty image was created. This patch adds check
    to avoid storing samples with None or not numerical volumes.

    Closes-Bug: #1484117
    Change-Id: Ic4b87c05d16dba765f601ca346b198eda7c91bea

Changed in ceilometer:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in ceilometer:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in ceilometer:
milestone: liberty-3 → 5.0.0
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to ceilometer (stable/kilo)

Reviewed: https://review.openstack.org/242556
Committed: https://git.openstack.org/cgit/openstack/ceilometer/commit/?id=2ec8c7de84bd9f6806b8129aa2c253055ad175db
Submitter: Jenkins
Branch: stable/kilo

commit 2ec8c7de84bd9f6806b8129aa2c253055ad175db
Author: Rohit Jaiswal <email address hidden>
Date: Thu Oct 22 22:03:20 2015 +0000

    Avoid from storing samples with empty or not numerical volumes

    In some cases Ceilometer receives notifications with 'counter_volume' equal
    None, for ex. from glance when empty image was created. This patch adds check
    to avoid storing samples with None or not numerical volumes.

    Closes-Bug: #1484117
    Closes-Bug: #1508220
    Change-Id: Ic4b87c05d16dba765f601ca346b198eda7c91bea
    (cherry-picked from commit 804de4ef2f26e1892dc2580fe16897b14741a13a)

tags: added: in-stable-kilo
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.