From d26ed3aee130646be0e042f29f3af64f1d73608e Mon Sep 17 00:00:00 2001 From: Dan Prince Date: Fri, 25 May 2012 12:25:23 -0400 Subject: Fix reservation_commit so it works w/ PostgreSQL. Update the Reservation model so that the 'usage' relationship is explicitly forced to use an inner join. This fixes an issue on PostgreSQL which doesn't support 'SELECT FOR UPDATE' on outer joined queries. Fixes LP Bug #1003756. Change-Id: I3c40bd8481855a18391e12d7411762e91b1ef8b0 --- nova/db/sqlalchemy/models.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/nova/db/sqlalchemy/models.py b/nova/db/sqlalchemy/models.py index fa10356a6..b956ea606 100644 --- a/nova/db/sqlalchemy/models.py +++ b/nova/db/sqlalchemy/models.py @@ -465,9 +465,11 @@ class Reservation(BASE, NovaBase): uuid = Column(String(36), nullable=False) usage_id = Column(Integer, ForeignKey('quota_usages.id'), nullable=False) + # NOTE(dprince): Force innerjoin below for lockmode update on PostgreSQL usage = relationship(QuotaUsage, backref=backref('reservations'), foreign_keys=usage_id, + innerjoin=True, primaryjoin='and_(' 'Reservation.usage_id == QuotaUsage.id,' 'Reservation.deleted == False)') -- cgit