'An attempt to attach a ``BlockDeviceVolume`` already attached to
another host raises ``AlreadyAttachedVolume``.'

def test_attach_elsewhere_attached_volume(self):

    api = gceblockdeviceapi_for_test(self)
    gce_fixture = self.useFixture(GCEComputeTestObjects(compute=api._operations._compute, project=get_machine_project(), zone=get_machine_zone()))
    instance_name = (u'functional-test-' + unicode(uuid4()))
    other_instance = gce_fixture.create_instance(instance_name)
    new_volume = api.create_volume(dataset_id=uuid4(), size=get_minimum_allocatable_size())
    attached_volume = api.attach_volume(new_volume.blockdevice_id, attach_to=other_instance.name)
    self.assertRaises(AlreadyAttachedVolume, api.attach_volume, blockdevice_id=attached_volume.blockdevice_id, attach_to=api.compute_instance_id())
