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
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
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'])
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']