'If a blockdevice associated to a dataset is attached, but the dataset
is registered as owning a different blockdevice, the dataset is
reported as ``REGISTERED``, associated to the registered blockdevice,
and a message is logged about the extraneously attached blockdevice.'

@capture_logging(assertHasMessage, UNREGISTERED_VOLUME_ATTACHED)
def test_registered_other_blockdevice_attached(self, logger):

    self.patch(blockdevice, '_logger', logger)
    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)
    assert_discovered_state(self, self.deployer, persistent_state=PersistentState(blockdevice_ownership={dataset_id: u'no-such-volume'}), expected_discovered_datasets=[DiscoveredDataset(state=DatasetStates.REGISTERED, dataset_id=dataset_id, blockdevice_id=u'no-such-volume')])
