cinder-manage db purge fails with Integrity failure

Bug #1589806 reported by Abhishek Kekane
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Ravi Shekhar Jethani

Bug Description

Steps to reproduce db purge issue

1. Create volume type.
$ cinder type-create lvmdriver-2 --is-public False
2. Associate to project
$ cinder type-access-add --volume-type f564e0ba-d9be-40fa-b28d-ff2c491bb8dd --project-id 4d9f1417e6474546b80f1ebbe7415c60

3. Delete volume type
$ cinder type-delete f564e0ba-d9be-40fa-b28d-ff2c491bb8dd
4. Run ”cinder-manage db purge 1” where 1 is the age in days of deleted volume type
5. If age in days of deleted volume type is greater than 1 above command will raise following error

2016-06-06 12:57:11.430 ERROR cinder.db.sqlalchemy.api [req-71599e7f-d84f-4437-8286-a14860197a6c None None] DBError detected when purging from volume_types: (pymysql.err.IntegrityError) (1451, u'Cannot delete or update a parent row: a foreign key fails (`cinder`.`volume_type_projects`, CONSTRAINT `volume_type_projects_ibfk_1` FOREIGN KEY (`volume_type_id`) REFERENCES `volume_types` (`id`))') [SQL: u'DELETE FROM volume_types WHERE volume_types.deleted_at < %(deleted_at_1)s'] [parameters: {u'deleted_at_1': datetime.datetime(2016, 6, 5, 7, 27, 11, 366430)}].
Purge command failed, check cinder-manage logs for more details.

Changed in cinder:
assignee: nobody → Abhishek Kekane (abhishek-kekane)
description: updated
description: updated
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to cinder (master)

Fix proposed to branch: master

Changed in cinder:
assignee: Abhishek Kekane (abhishek-kekane) → Ravi Shekhar Jethani (ravishekar-jethani)
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to cinder (master)

Submitter: Jenkins
Branch: master

commit e9b928d669cbcc6faeb07e3e1992512eeaa721b2
Author: Ravi Jethani <email address hidden>
Date: Mon Jun 6 15:15:58 2016 +0530

    Fix db purge for volume_types FK constraint

    db purge command raises FK constraint while purging volume_types
    and volume_type_projects deleted rows.
    Delete volume_type_projects records before deleting volume_types
    to solve this issue.

    Change-Id: I46d3c7559c58e979e6227825ed0b2e21158415c2
    Closes-Bug: #1589806

Changed in cinder:
status: In Progress → Fix Released
Revision history for this message
Doug Hellmann (doug-hellmann) wrote : Fix included in openstack/cinder

This issue was fixed in the openstack/cinder development milestone.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers