Metadef ORM classes should use a common delete

Bug #1371837 reported by Wayne
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Glance
In Progress
Low
Wayne

Bug Description

The metadef db delete functions typically have code like this:
session.delete(db_rec)
session.flush()

To be consistent with the ORM classes save() function implementation, it would be better to add a delete function
to the base metadef ORM class (i.e., GlanceMetadefBase).

Background - Both GlanceBase and GlanceMetadefBase ORM classes call oslo.db.sqlalchemy.models.ModelBase.save() for create/update.
There is no function for hard deletes in ModelBase.

The ModelBase.save function is simply:
def save(self, session)
    with session.begin(subtransactions=True):
        session.add(self)
        session.flush()
Note: See comments in ModelBase.save for more details on the need for "with session.begin(subtransactions=True_"

The new GlanceMetadefBase.delete() function should be implemented in a way that is consistent with the oslo ModelBase.save function implementation.

Tags: metadef
Wayne (wayne-okuma)
Changed in glance:
assignee: nobody → Wayne (wayne-okuma)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to glance (master)

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

Changed in glance:
status: New → In Progress
Wayne (wayne-okuma)
tags: added: glance metadef
Dolph Mathews (dolph)
tags: removed: glance
Changed in glance:
importance: Undecided → Low
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on glance (master)

Change abandoned by Glance Bot (<email address hidden>) on branch: master
Review: https://review.openstack.org/122910

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.