'``CreateBlockDeviceDataset.run`` fails with ``DatasetExists`` if there
is already a ``BlockDeviceVolume`` for the requested dataset.'

@capture_logging(assertHasAction, CREATE_BLOCK_DEVICE_DATASET, succeeded=False)
def test_created_exists(self, logger):

    self.patch(blockdevice, '_logger', logger)
    dataset_id = uuid4()
    existing_volume = self.api.create_volume(dataset_id, size=LOOPBACK_MINIMUM_ALLOCATABLE_SIZE)
    change = CreateBlockDeviceDataset(dataset_id=dataset_id, maximum_size=LOOPBACK_MINIMUM_ALLOCATABLE_SIZE)
    changing = run_state_change(change, self.deployer, InMemoryStatePersister())
    failure = self.failureResultOf(changing, DatasetExists)
    self.assertEqual(existing_volume, failure.value.blockdevice)
