'get_device_path returns the correct device name even when a non-Cinder
volume has been attached. See FLOC-2859.'

def test_get_device_path_correct_with_attached_disk(self):

    instance_id = self.blockdevice_api.compute_instance_id()
    host_device = '/dev/null'
    tmpdir = FilePath(self.mktemp())
    tmpdir.makedirs()
    virtio = VirtIOClient.using_insecure_tls(instance_id, tmpdir)
    virtio.attach_disk(host_device, 'vdc')
    self.addCleanup(virtio.detach_disk, host_device)
    cinder_volume = self.cinder.create(size=int(Byte(get_minimum_allocatable_size()).to_GiB().value))
    CINDER_VOLUME(id=cinder_volume.id).write()
    self.addCleanup(self._cleanup, instance_id, cinder_volume)
    volume = wait_for_volume_state(volume_manager=self.cinder, expected_volume=cinder_volume, desired_state=u'available', transient_states=(u'creating',))
    devices_before = set(FilePath('/dev').children())
    attached_volume = self.nova.create_server_volume(server_id=instance_id, volume_id=volume.id, device=None)
    volume = wait_for_volume_state(volume_manager=self.cinder, expected_volume=attached_volume, desired_state=u'in-use', transient_states=(u'available', u'attaching'))
    devices_after = set(FilePath('/dev').children())
    new_devices = (devices_after - devices_before)
    [new_device] = new_devices
    device_path = self.blockdevice_api.get_device_path(volume.id)
    self.assertEqual(device_path.realpath(), new_device)
