private void parseUpgradePacks(Collection<String> subDirs) throws AmbariException {
    Map<String, UpgradePack> upgradeMap = new HashMap<>();
    ConfigUpgradePack configUpgradePack = null;
    if (subDirs.contains(UPGRADE_PACK_FOLDER_NAME)) {
      File f = new File(getAbsolutePath() + File.separator + UPGRADE_PACK_FOLDER_NAME);
      if (f.isDirectory()) {
        upgradesDir = f.getAbsolutePath();
        for (File upgradeFile : f.listFiles(XML_FILENAME_FILTER)) {
          if (upgradeFile.getName().toLowerCase().startsWith(CONFIG_UPGRADE_XML_FILENAME_PREFIX)) {
            if (configUpgradePack == null) {
              if(upgradeFile.length() != 0) {
                configUpgradePack = parseConfigUpgradePack(upgradeFile);
              }
            } else { // If user messed things up with lower/upper case filenames
              throw new AmbariException(String.format("There are multiple files with name like %s" + upgradeFile.getAbsolutePath()));
            }
          } else {
            String upgradePackName = FilenameUtils.removeExtension(upgradeFile.getName());
            if(upgradeFile.length() != 0) {
              UpgradePack pack = parseUpgradePack(upgradePackName, upgradeFile);
              pack.setName(upgradePackName);
              upgradeMap.put(upgradePackName, pack);
            }
          }
        }
      }
    }

    if (upgradesDir == null) {
      LOG.info("Stack '{}' doesn't contain an upgrade directory ", getPath());
    }

    if (!upgradeMap.isEmpty()) {
      upgradePacks = upgradeMap;
    }

    if (configUpgradePack != null) {
      this.configUpgradePack = configUpgradePack;
    } else {
      ConfigUpgradePack emptyConfigUpgradePack = new ConfigUpgradePack();
      emptyConfigUpgradePack.services = new ArrayList<>();
      this.configUpgradePack = emptyConfigUpgradePack;
      LOG.info("Stack '{}' doesn't contain config upgrade pack file", getPath());
    }
  }
Parse all stack upgrade files for the stack.

@param subDirs stack sub directories
@throws AmbariException if unable to parse stack upgrade file
ambari-server/src/main/java/org/apache/ambari/server/stack/StackDirectory.java