private UpgradePack upgradePack(UpgradeCheckRequest request) throws AmbariException {
    Cluster cluster = clustersProvider.get().getCluster(request.getClusterName());

    return upgradeHelper.suggestUpgradePack(
      request.getClusterName(),
      cluster.getCurrentStackVersion(),
      new StackId(request.getTargetRepositoryVersion().getStackId()),
      Direction.UPGRADE,
      request.getUpgradeType(),
      null);
  }
The {@link ComponentsExistInRepoCheck} is used to determine if any of the
components scheduled for upgrade do not exist in the target repository or
stack.
ambari-server/src/main/java/org/apache/ambari/server/checks/ComponentsExistInRepoCheck.java