2018-04-04 12:58:09.905 20813 INFO cinder.db.sqlalchemy.api [req-b3f7afb6-9feb-447c-9de8-19858819b647 - - - - -] Purging deleted rows older than age=30 days from table=snapshots
2018-04-04 12:58:09.910 20813 ERROR cinder.db.sqlalchemy.api [req-b3f7afb6-9feb-447c-9de8-19858819b647 - - - - -] DBError detected when purging from snapshots: (pymysql.err.IntegrityError) (1451, u'Cannot delete or update a parent row: a foreign key constraint fails (`cinder`.`snapshot_metadata`, CONSTRAINT `snapshot_metadata_ibfk_1` FOREIGN KEY (`snapshot_id`) REFERENCES `snapshots` (`id`))') [SQL: u'DELETE FROM snapshots WHERE snapshots.deleted_at < %(deleted_at_1)s'] [parameters: {u'deleted_at_1': datetime.datetime(2018, 3, 5, 10, 58, 9, 905889)}].: DBReferenceError: (pymysql.err.IntegrityError) (1451, u'Cannot delete or update a parent row: a foreign key constraint fails (`cinder`.`snapshot_metadata`, CONSTRAINT `snapshot_metadata_ibfk_1` FOREIGN KEY (`snapshot_id`) REFERENCES `snapshots` (`id`))') [SQL: u'DELETE FROM snapshots WHERE snapshots.deleted_at < %(deleted_at_1)s'] [parameters: {u'deleted_at_1': datetime.datetime(2018, 3, 5, 10, 58, 9, 905889)}]
Can reproduce by creating a snapshot with metadata, deleting the snapshot, adjust updated_at and deleted_at in the DB to X days in the past, and then running "cinder-manage db purge 30".