'Discover local ZFS manifestations.'

def discover_state(self, cluster_state, persistent_state):

    volumes = self.volume_service.enumerate()
    def map_volumes_to_size(volumes):
        primary_manifestations = {}
        for volume in volumes:
            if (volume.node_id == self.volume_service.node_id):
                path = volume.get_filesystem().get_path()
                primary_manifestations[path] = (volume.name.dataset_id, volume.size.maximum_size)
        return primary_manifestations
    volumes.addCallback(map_volumes_to_size)
    def got_volumes(available_manifestations):
        manifestation_paths = {dataset_id: path for (path, (dataset_id, _)) in available_manifestations.items()}
        manifestations = list((Manifestation(dataset=Dataset(dataset_id=dataset_id, maximum_size=maximum_size), primary=True) for (dataset_id, maximum_size) in available_manifestations.values()))
        return NodeLocalState(node_state=NodeState(uuid=self.node_uuid, hostname=self.hostname, applications=None, manifestations={manifestation.dataset_id: manifestation for manifestation in manifestations}, paths=manifestation_paths, devices={}))
    volumes.addCallback(got_volumes)
    return volumes
