don't propagate glance backref out of db layer

Bug #1192390 reported by John Griffith on 2013-06-19
This bug affects 3 people
Affects Status Importance Assigned to Milestone
John Griffith

Bug Description

using backrefs outside of db layer can cause unexpected and bad results when attempts to lazy load the backref data are made higher up.

This particular case can be seen in the cinder api list call in the translate when we try to do the get.volume_glance_metadata when we have hundreds of volumes. The result is the lazy load fails but we have no session context to get the back-ref again so we fail.

There's really no reason to carry around this metadata just to determine whether we have a bootable volume or not anyway, we should just add a bootable column to the volumes table that's set True or False and use that in operations like list volumes.

Example trace of failure condition:
2013-06-18 11:34:49.452 TRACE cinder.api.middleware.fault (mapperutil.state_str(state), self.key)
2013-06-18 11:34:49.452 TRACE cinder.api.middleware.fault DetachedInstanceError: Parent instance <Volume at 0x4b658d0> is not bound to a Session; lazy load operation of attribute 'volume_glance_metadata' cannot proceed
2013-06-18 11:34:49.452 TRACE cinder.api.middleware.fault

Changed in cinder:
importance: Undecided → High

Fix proposed to branch: master

Changed in cinder:
status: Triaged → In Progress

Submitter: Jenkins
Branch: master

commit c8f814569d07544734f10f134e146ce981639e07
Author: John Griffith <email address hidden>
Date: Tue Jun 18 23:22:48 2013 -0600

    Replace glance_metadata check with bootable column.

    This patch adds a column to indicate if a volume is bootable or not.

    Cinder API V1 was using get.volume_glance_metadata to determine
    if a volume was bootable for translate_view.

    This is fine until you put a heavy load on the system and things
    can fall apart, particularly the backref of the glance meta is no longer
    available and the call blows up. Also this results in a bit of extra
    unnecessary data being passed around with every create and get call.
    This is especially an issue when creating hundreds or thousands of volumes.
    Even better we can now reliably create thousands of volumes.

    Fixes bug: 1192390

    Change-Id: Idd47a0a8069ee905b81c7aae562b82767ad91930

Changed in cinder:
status: In Progress → Fix Committed
Thierry Carrez (ttx) on 2013-07-17
Changed in cinder:
status: Fix Committed → Fix Released
Thierry Carrez (ttx) on 2013-10-17
Changed in cinder:
milestone: havana-2 → 2013.2
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers