'If a volume is attached and mounted but not mounted at the location
``BlockDeviceDeployer`` expects, the dataset returned by
``BlockDeviceDeployer.discover_state`` is marked as
``ATTACHED``.'

def test_attached_and_mismounted(self):

    dataset_id = uuid4()
    volume = self.api.create_volume(dataset_id=dataset_id, size=LOOPBACK_MINIMUM_ALLOCATABLE_SIZE)
    self.api.attach_volume(volume.blockdevice_id, attach_to=self.this_node)
    device_path = self.api.get_device_path(volume.blockdevice_id)
    make_filesystem(device_path, block_device=True)
    mountpoint = self.deployer.mountroot.child('nonsense')
    mountpoint.makedirs()
    mount(device_path, mountpoint)
    assert_discovered_state(self, self.deployer, persistent_state=PersistentState(blockdevice_ownership={dataset_id: volume.blockdevice_id}), expected_discovered_datasets=[DiscoveredDataset(state=DatasetStates.ATTACHED, dataset_id=volume.dataset_id, blockdevice_id=volume.blockdevice_id, maximum_size=LOOPBACK_MINIMUM_ALLOCATABLE_SIZE, device_path=device_path)])
