Skip to content

Commit

Permalink
Soft delete tmp migration volume
Browse files Browse the repository at this point in the history
Previously the row for the temporary migration volume was deleted from
the database, which caused a foreign key violation for its admin
metadata. Regardless, the volume should have been soft deleted from the
database anyway, and this patch takes care of that.

Change-Id: I8e4942b0e21ec79c90aa95b18b5612b5b133fd62
Closes-Bug: #1219097
  • Loading branch information
avishay-traeger committed Sep 18, 2013
1 parent 2a725ef commit d2479f1
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 5 deletions.
3 changes: 0 additions & 3 deletions cinder/db/sqlalchemy/api.py
Expand Up @@ -1119,9 +1119,6 @@ def finish_volume_migration(context, src_vol_id, dest_vol_id):
session.query(models.Volume).\
filter_by(id=src_vol_id).\
update(updates)
session.query(models.Volume).\
filter_by(id=dest_vol_id).\
delete()


@require_admin_context
Expand Down
2 changes: 0 additions & 2 deletions cinder/tests/db/test_finish_migration.py
Expand Up @@ -44,8 +44,6 @@ def test_finish_volume_migration(self):
db.finish_volume_migration(ctxt, src_volume['id'],
dest_volume['id'])

self.assertRaises(exception.VolumeNotFound, db.volume_get, ctxt,
dest_volume['id'])
src_volume = db.volume_get(ctxt, src_volume['id'])
expected_name = 'volume-%s' % dest_volume['id']
self.assertEqual(src_volume['_name_id'], dest_volume['id'])
Expand Down
1 change: 1 addition & 0 deletions cinder/volume/manager.py
Expand Up @@ -705,6 +705,7 @@ def migrate_volume_completion(self, ctxt, volume_id, new_volume_id,
LOG.error(msg % {'vol': volume_id, 'err': ex})

self.db.finish_volume_migration(ctxt, volume_id, new_volume_id)
self.db.volume_destroy(ctxt, new_volume_id)
self.db.volume_update(ctxt, volume_id, {'migration_status': None})
return volume['id']

Expand Down

0 comments on commit d2479f1

Please sign in to comment.