Soft delete tmp migration volume

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
This commit is contained in:
Avishay Traeger 2013-09-02 20:23:45 +03:00
parent 2a725ef15d
commit d2479f1e88
3 changed files with 1 additions and 5 deletions

View File

@ -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

View File

@ -44,8 +44,6 @@ class FinishVolumeMigrationTestCase(test.TestCase):
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'])

View File

@ -705,6 +705,7 @@ class VolumeManager(manager.SchedulerDependentManager):
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']