private UpgradePack getServiceUpgradePack(UpgradePack pack, File upgradesFolder) throws AmbariException {
    File stackFolder = new File(upgradesFolder, stackInfo.getName());
    File versionFolder = new File(stackFolder, stackInfo.getVersion());
    // !!! relies on the service upgrade pack filename being named the exact same
    File servicePackFile = new File(versionFolder, pack.getName() + ".xml");

    LOG.info("Service folder: " + servicePackFile.getAbsolutePath());
    if (servicePackFile.exists()) {
      return parseServiceUpgradePack(pack, servicePackFile);
    } else {
      UpgradePack child = findServiceUpgradePack(pack, stackFolder);

      return null == child ? null : parseServiceUpgradePack(pack, child);
    }
  }
Returns the upgrade pack for a service if it exists, otherwise returns null
ambari-server/src/main/java/org/apache/ambari/server/stack/StackModule.java