'Test that attaching to an in-use volume fails.'

def test_attach_in_used_volume_by_instance(self):

    volume = self._create_volume(self.ctx, {'provider_location': '', 'size': 1})
    connector = {'initiator': 'iqn.2012-07.org.fake:01'}
    self.volume_api.reserve_volume(self.ctx, volume)
    conn_info = self.volume_api.initialize_connection(self.ctx, volume, connector)
    self.volume_api.attach(self.ctx, volume, fake.INSTANCE_ID, None, '/dev/vbd0', 'rw')
    self.assertEqual('rw', conn_info['data']['access_mode'])
    self.assertRaises(exception.InvalidVolume, self.volume_api.attach, self.ctx, volume, fake.INSTANCE_ID, None, '/dev/vdb1', 'ro')
