From c6cf0167eda91df4312321a58fe4437863f35fe9 Mon Sep 17 00:00:00 2001 From: Sergey Skripnick Date: Wed, 29 May 2013 12:46:14 +0300 Subject: [PATCH] Fixed method db.api.reservation_expire There was missing relation in Reservation model. Change-Id: I6efe558278297aea6d2348b347152c244b3323d6 Fixes: bug 1185325 --- cinder/db/sqlalchemy/models.py | 6 ++++++ cinder/tests/test_db_api.py | 1 - 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/cinder/db/sqlalchemy/models.py b/cinder/db/sqlalchemy/models.py index 28bd932d0..8d33336e5 100644 --- a/cinder/db/sqlalchemy/models.py +++ b/cinder/db/sqlalchemy/models.py @@ -245,6 +245,12 @@ class Reservation(BASE, CinderBase): delta = Column(Integer) expire = Column(DateTime, nullable=False) + usage = relationship( + "QuotaUsage", + foreign_keys=usage_id, + primaryjoin='and_(Reservation.usage_id == QuotaUsage.id,' + 'QuotaUsage.deleted == 0)') + class Snapshot(BASE, CinderBase): """Represents a block storage device that can be attached to a VM.""" diff --git a/cinder/tests/test_db_api.py b/cinder/tests/test_db_api.py index 816d9d5d9..c7580dffa 100644 --- a/cinder/tests/test_db_api.py +++ b/cinder/tests/test_db_api.py @@ -443,7 +443,6 @@ class DBAPIReservationTestCase(BaseTest): self.assertEqual(expected, db.quota_usage_get_all_by_project( self.ctxt, 'project1')) - @test.testtools.skip("bug 1185325") def test_reservation_expire(self): self.values['expire'] = datetime.utcnow() + timedelta(days=1) reservations = _quota_reserve(self.ctxt, 'project1') -- 2.45.2