'Test that attaching volume reserved for another instance fails.'

def test_attach_attaching_volume_with_different_instance(self):

    volume = self._create_volume(self.ctx, {'provider_location': '', 'size': 1})
    self.volume_api.reserve_volume(self.ctx, volume)
    values = {'volume_id': volume['id'], 'attach_status': fields.VolumeAttachStatus.ATTACHING, 'attach_time': timeutils.utcnow(), 'instance_uuid': 'abc123'}
    db.volume_attach(self.ctx, values)
    db.volume_admin_metadata_update(self.ctx, volume['id'], {'attached_mode': 'rw'}, False)
    mountpoint = '/dev/vbd'
    attachment = self.volume_api.attach(self.ctx, volume, fake.INSTANCE_ID, None, mountpoint, 'rw')
    self.assertEqual(fake.INSTANCE_ID, attachment['instance_uuid'])
    self.assertEqual(volume['id'], attachment['volume_id'], volume['id'])
    self.assertEqual(fields.VolumeAttachStatus.ATTACHED, attachment['attach_status'])
