Capabilities API for SQL backends is broken

Bug #1292611 reported by Ildiko Vancsa
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Ceilometer
Fix Released
High
Ildiko Vancsa

Bug Description

Capabilities API is broken for SQL backends, it raises NotImplemented error:

For the request:
curl -H "X-Auth-Token: $TOKEN" --header "Content-Type:application/json" "http://localhost:8777/v2/capabilities"

The following response is received with using MySQL as DB backend:
{
"error_message": {
"debuginfo": null,
"faultcode": "Server",
"faultstring": "Capabilities not implemented."
}
}

Changed in ceilometer:
assignee: nobody → Ildiko Vancsa (ildiko-vancsa)
Revision history for this message
Balazs Gibizer (balazs-gibizer) wrote :

Actually the whole capability reporting is broken because the ceilometer.utils.update_nested function updates its first parameter in place (see https://github.com/openstack/ceilometer/blob/master/ceilometer/utils.py#L144-L147) and every storage driver using the ceilometer.storage.base.Connection.DEFAULT_CAPABILITIES directly as a first parameter for the update_nested function therefore modifying the base class level variable. (see for example https://github.com/openstack/ceilometer/blob/master/ceilometer/storage/impl_mongodb.py#L888)

So to make the capability reporting works we need to do a deep copy of the first parameter of update_nested or pass a deep copy of DEFAULT_CAPABILITIES in ever storage driver to that function.

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/80852

Changed in ceilometer:
status: New → In Progress
Eoghan Glynn (eglynn)
Changed in ceilometer:
milestone: none → icehouse-rc1
importance: Undecided → High
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to ceilometer (master)

Reviewed: https://review.openstack.org/80852
Committed: https://git.openstack.org/cgit/openstack/ceilometer/commit/?id=4d57208adda0696e5163285b5efd397ef3324231
Submitter: Jenkins
Branch: master

commit 4d57208adda0696e5163285b5efd397ef3324231
Author: Ildiko Vancsa <email address hidden>
Date: Sun Mar 16 10:32:11 2014 +0100

    Fix bug in get_capabilities behavior in DB drivers

    Capabilities API returns NotImplementedError in case of SQLAlchemy
    driver. This issue is fixed in this patch by moving the function into
    the proper class.

    Another issue is, that get_capabilities function overwrites the
    DEFAULT_CAPABILITIES dict in base.py every time, when the function is
    invoked.

    This behavior was changed to create a CAPABILITIES dict in each DB driver's
    __init__ function by making a deep copy from DEFAULT_CAPABILITIES and
    updating the new dict with the AVAILABLE_CAPABILITIES. get_capabilities now
    returns the newly created CAPABILITIES dict without modifying it.

    Tests were also added to check that get_capabilities returns the expected
    values for each DB driver.

    Fixes-bug: #1292611

    Change-Id: I725751b600bf462c19278e5785eb2d8530023083

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: icehouse-rc1 → 2014.1
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.