]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Fixed method db.api.reservation_expire
authorSergey Skripnick <sskripnick@mirantis.com>
Wed, 29 May 2013 09:46:14 +0000 (12:46 +0300)
committerGerrit Code Review <review@openstack.org>
Sat, 1 Jun 2013 13:20:21 +0000 (13:20 +0000)
There was missing relation in Reservation model.

Change-Id: I6efe558278297aea6d2348b347152c244b3323d6
Fixes: bug 1185325
cinder/db/sqlalchemy/models.py
cinder/tests/test_db_api.py

index 28bd932d0d8833b19f44644c93d2022338e9a707..8d33336e518261fa847f33d844c974d3bb90bc38 100644 (file)
@@ -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."""
index 816d9d5d989393e3fa77669765177b19c59fdee0..c7580dffa6d392a00c4ae4f4067c310be6cd82fe 100644 (file)
@@ -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')