'If the API supports ``ICloudAPI`` and a volume is attached to a remote
node that is dead, the dataset returned by
``BlockDeviceDeployer.discover_state`` is marked as
``ATTACHED_TO_DEAD_NODE``.'

def test_remote_device_dead_node(self):

    dead_host = u'dead'
    live_host = u'live'
    api = FakeCloudAPI(self.api, [live_host])
    live_dataset_id = uuid4()
    volume_attached_to_live = api.create_volume(dataset_id=live_dataset_id, size=LOOPBACK_MINIMUM_ALLOCATABLE_SIZE)
    api.attach_volume(volume_attached_to_live.blockdevice_id, attach_to=live_host)
    dead_dataset_id = uuid4()
    volume_attached_to_dead = api.create_volume(dataset_id=dead_dataset_id, size=LOOPBACK_MINIMUM_ALLOCATABLE_SIZE)
    api.attach_volume(volume_attached_to_dead.blockdevice_id, attach_to=dead_host)
    assert_discovered_state(self, self.deployer.set(block_device_api=ProcessLifetimeCache(api), _underlying_blockdevice_api=api), persistent_state=PersistentState(blockdevice_ownership={live_dataset_id: volume_attached_to_live.blockdevice_id, dead_dataset_id: volume_attached_to_dead.blockdevice_id}), expected_discovered_datasets=[DiscoveredDataset(state=DatasetStates.ATTACHED_ELSEWHERE, dataset_id=volume_attached_to_live.dataset_id, blockdevice_id=volume_attached_to_live.blockdevice_id, maximum_size=LOOPBACK_MINIMUM_ALLOCATABLE_SIZE), DiscoveredDataset(state=DatasetStates.ATTACHED_TO_DEAD_NODE, dataset_id=volume_attached_to_dead.dataset_id, blockdevice_id=volume_attached_to_dead.blockdevice_id, maximum_size=LOOPBACK_MINIMUM_ALLOCATABLE_SIZE)])
