public RequestStatusResponse scaleHosts(final ScaleClusterRequest request)
      throws InvalidTopologyException, AmbariException {

    ensureInitialized();
    LOG.info("TopologyManager.scaleHosts: Entering");
    String clusterName = request.getClusterName();
    long clusterId = ambariContext.getClusterId(clusterName);
    final ClusterTopology topology = clusterTopologyMap.get(clusterId);
    if (topology == null) {
      throw new InvalidTopologyException("Unable to retrieve cluster topology for cluster. This is most likely a " +
          "result of trying to scale a cluster via the API which was created using " +
          "the Ambari UI. At this time only clusters created via the API using a " +
          "blueprint can be scaled with this API.  If the cluster was originally created " +
          "via the API as described above, please file a Jira for this matter.");
    }

    hostNameCheck(request, topology);
    request.setClusterId(clusterId);
    if (ambariContext.isTopologyResolved(clusterId)) {
      getOrCreateTopologyTaskExecutor(clusterId).start();
    }

    // this registers/updates all request host groups
    topology.update(request);

    final Long requestId = ambariContext.getNextRequestId();
    LogicalRequest logicalRequest = RetryHelper.executeWithRetry(new Callable<LogicalRequest>() {
         @Override
         public LogicalRequest call() throws Exception {
           LogicalRequest logicalRequest = processAndPersistTopologyRequest(request, topology, requestId);

           return logicalRequest;
         }
       }
    );
    processRequest(request, topology, logicalRequest);
    return getRequestStatus(logicalRequest.getRequestId());
  }
Retrieve security info from Blueprint if missing from Cluster Template request.

@param request
@return
ambari-server/src/main/java/org/apache/ambari/server/topology/TopologyManager.java