query = model_query(context, models.Snapshot, read_deleted="yes")
query = query.filter(or_(models.Snapshot.deleted_at == None,
models.Snapshot.deleted_at > begin))
+ query = query.options(joinedload(models.Snapshot.volume))
if end:
query = query.filter(models.Snapshot.created_at < end)
if project_id:
volume = relationship(Volume, backref="snapshots",
foreign_keys=volume_id,
- primaryjoin='and_('
- 'Snapshot.volume_id == Volume.id,'
- 'Snapshot.deleted == False)')
+ primaryjoin='Snapshot.volume_id == Volume.id')
class SnapshotMetadata(BASE, CinderBase):
datetime.datetime(1, 4, 1, 1, 1, 1))
self.assertEqual(len(snapshots), 3)
self.assertEqual(snapshots[0].id, u'2')
+ self.assertEqual(snapshots[0].volume.id, u'1')
self.assertEqual(snapshots[1].id, u'3')
+ self.assertEqual(snapshots[1].volume.id, u'1')
self.assertEqual(snapshots[2].id, u'4')
+ self.assertEqual(snapshots[2].volume.id, u'1')
class DriverTestCase(test.TestCase):