private RoleCommandOrder getRoleCommandOrderForUpgrade(Cluster cluster) {
      RoleCommandOrder roleCommandOrder = cluster.getRoleCommandOrder();

      try {
        roleCommandOrder = (RoleCommandOrder) roleCommandOrder.clone();
      } catch (CloneNotSupportedException cloneNotSupportedException) {
        LOG.warn("Unable to clone role command order and apply overrides for this upgrade",
            cloneNotSupportedException);
      }

      LinkedHashSet<String> sectionKeys = roleCommandOrder.getSectionKeys();
      sectionKeys.add("host_ordered_upgrade");

      roleCommandOrder.initialize(cluster, sectionKeys);
      return roleCommandOrder;
    }
Gets a {@link RoleCommandOrder} instance initialized with
{@code host_ordered_upgrade} overrides.

@param cluster
         the cluster to get the {@link RoleCommandOrder} instance for.
@return the order of commands for the cluster
ambari-server/src/main/java/org/apache/ambari/server/stack/upgrade/HostOrderGrouping.java