private AllocationFailureReasonList collateAllocationFailures(Node node, List<Node> hosts,
                                                                  Map<Node, AllocationResources> availableResources,
                                                                  Map<Node, List<Allocation>> containedAllocations) {
        List<AllocationFailureReason> allocationFailureReasons = new ArrayList<>();
        for (var host : hosts) {
            AllocationFailureReason reason = new AllocationFailureReason();
            var availableHostResources = availableResources.get(host);
            reason.violatesParentHostPolicy = violatesParentHostPolicy(node, host, containedAllocations);

            NodeResources l = availableHostResources.nodeResources;
            NodeResources r = node.allocation().map(Allocation::requestedResources).orElse(node.resources());

            if (l.vcpu() < r.vcpu())
                reason.insufficientVcpu = true;
            if (l.memoryGiB() < r.memoryGiB())
                reason.insufficientMemoryGb = true;
            if (l.diskGb() < r.diskGb())
                reason.insufficientDiskGb = true;
            if (r.diskSpeed() != NodeResources.DiskSpeed.any && r.diskSpeed() != l.diskSpeed())
                reason.incompatibleDiskSpeed = true;
            if (r.storageType() != NodeResources.StorageType.any && r.storageType() != l.storageType())
                reason.incompatibleStorageType = true;
            if (r.architecture() != NodeResources.Architecture.any && r.architecture() != l.architecture())
                reason.incompatibleStorageType = true;
            if (availableHostResources.availableIPs < 1)
                reason.insufficientAvailableIPs = true;

            allocationFailureReasons.add(reason);
        }

        return new AllocationFailureReasonList(allocationFailureReasons);
    }
Returns the parent to which the node was allocated, if it was successfully allocated.
node-repository/src/main/java/com/yahoo/vespa/hosted/provision/maintenance/CapacityChecker.java