public static VersionDefinitionXml build(StackInfo stackInfo) {

    VersionDefinitionXml xml = new VersionDefinitionXml();
    xml.m_stackDefault = true;
    xml.release = new Release();
    xml.repositoryInfo = new RepositoryXml();
    xml.xsdLocation = SCHEMA_LOCATION;

    StackId stackId = new StackId(stackInfo.getName(), stackInfo.getVersion());

    xml.release.repositoryType = RepositoryType.STANDARD;
    xml.release.stackId = stackId.toString();
    xml.release.version = stackInfo.getVersion();
    xml.release.releaseNotes = "NONE";
    xml.release.display = stackId.toString();

    for (ServiceInfo si : stackInfo.getServices()) {
      // do NOT build a manifest entry for services on the stack which cannot be
      // a part of an upgrade - this is to prevent services like KERBEROS from
      // preventing an upgrade if it's in Maintenance Mode
      if (!si.isVersionAdvertised()) {
        continue;
      }

      ManifestService ms = new ManifestService();
      ms.serviceName = si.getName();
      ms.version = StringUtils.trimToEmpty(si.getVersion());
      ms.serviceId = ms.serviceName + "-" + ms.version.replace(".", "");
      xml.manifestServices.add(ms);
    }

    if (null != stackInfo.getRepositoryXml()) {
      xml.repositoryInfo.getOses().addAll(stackInfo.getRepositoryXml().getOses());
    }

    try {
      xml.toXml();
    } catch (Exception e) {
      throw new IllegalArgumentException(e);
    }

    return xml;
  }
Builds a Version Definition that is the default for the stack.
<p>
This will use all of the services defined on the stack, excluding those
which do not advertise a version. If a service doesn't advertise a version,
we cannot include it in a generated VDF.

@return the version definition
ambari-server/src/main/java/org/apache/ambari/server/state/repository/VersionDefinitionXml.java