private UpgradePack findPreferred(String preferred, StackId... stackIds) {
    if (StringUtils.isEmpty(preferred)) {
      return null;
    }

    for (StackId stackId : stackIds) {
      Map<String, UpgradePack> packs = m_ambariMetaInfoProvider.get().getUpgradePacks(
          stackId.getStackName(), stackId.getStackVersion());

      if (!packs.containsKey(preferred)) {
        LOG.warn("Upgrade pack '{}' not found for stack {}", preferred, stackId);
      } else {
        return packs.get(preferred);
      }
    }

    return null;
  }
Finds an upgrade pack with a preferred name.

@param preferred
         the name of the preferred upgrade pack
@param stackIds
         the stack ids to find
ambari-server/src/main/java/org/apache/ambari/server/stack/upgrade/orchestrate/UpgradeHelper.java