Package com.vmware.bdd.plugin.ambari.api.model.cluster

Examples of com.vmware.bdd.plugin.ambari.api.model.cluster.ClusterRequestStatus


         boolean success = false;
         ApiRequest apiRequest =
               apiManager.getRequest(clusterName, apiRequestSummary
                     .getApiRequestInfo().getRequestId());
         ClusterRequestStatus clusterRequestStatus =
               ClusterRequestStatus.valueOf(apiRequest.getApiRequestInfo()
                     .getRequestStatus());
         if (!clusterRequestStatus.isFailedState()) {
            success = true;
         }
         if (!success) {
            throw SoftwareManagementPluginException.CREATE_CLUSTER_FAIL(Constants.AMBARI_PLUGIN_NAME, clusterDef.getName());
         }
View Full Code Here


      boolean success = false;
      ApiRequest apiRequest =
            apiManager.getRequest(clusterDef.getName(), apiRequestSummary
                  .getApiRequestInfo().getRequestId());
      ClusterRequestStatus clusterRequestStatus =
            ClusterRequestStatus.valueOf(apiRequest.getApiRequestInfo()
                  .getRequestStatus());
      if (!clusterRequestStatus.isFailedState()) {
         success = true;
      }
      if (!success) {
         throw SoftwareManagementPluginException.STOP_CLUSTER_FAILED(Constants.AMBARI_PLUGIN_NAME, clusterDef.getName(), null);
      }
View Full Code Here

      boolean success = false;
      ApiRequest apiRequest =
            apiManager.getRequest(clusterDef.getName(), apiRequestSummary
                  .getApiRequestInfo().getRequestId());
      ClusterRequestStatus clusterRequestStatus =
            ClusterRequestStatus.valueOf(apiRequest.getApiRequestInfo()
                  .getRequestStatus());
      if (!clusterRequestStatus.isFailedState()) {
         success = true;
      }
      if (!success) {
         throw SoftwareManagementPluginException.START_CLUSTER_FAILED(null, Constants.AMBARI_PLUGIN_NAME, clusterDef.getName());
      }
View Full Code Here

      boolean success = false;
      ApiRequest apiRequest =
            apiManager.getRequest(clusterDef.getName(), request
                  .getApiRequestInfo().getRequestId());
      ClusterRequestStatus clusterRequestStatus =
            ClusterRequestStatus.valueOf(apiRequest.getApiRequestInfo()
                  .getRequestStatus());
      if (!clusterRequestStatus.isFailedState()) {
         success = true;
      }
      if (!success) {
         throw SoftwareManagementPluginException.INSTALL_COMPONENTS_FAIL(Constants.AMBARI_PLUGIN_NAME, clusterDef.getName());
      }
View Full Code Here

      boolean success = false;
      ApiRequest apiRequest =
            apiManager.getRequestWithTasks(clusterName, apiRequestSummary
                  .getApiRequestInfo().getRequestId());
      ClusterRequestStatus clusterRequestStatus =
            ClusterRequestStatus.valueOf(apiRequest.getApiRequestInfo()
                  .getRequestStatus());
      if (!clusterRequestStatus.isFailedState()) {
         success = true;
      } else {
         logger.error("Failed to do request: " + ApiUtils.objectToJson(apiRequest.getApiRequestInfo()));
         List<ApiTask> apiTasks = apiRequest.getApiTasks();
         Map<String, NodeReport> nodeReports = clusterReport.getNodeReports();
View Full Code Here

         return true;
      }
      Long requestId = apiRequestSummary.getApiRequestInfo().getRequestId();
      ApiRequest apiRequest = apiManager.getRequestWithTasks(clusterName, requestId);

      ClusterRequestStatus clusterRequestStatus =
            ClusterRequestStatus.valueOf(apiRequest.getApiRequestInfo()
                  .getRequestStatus());

      Map<String, NodeReport> nodeReports = currentReport.getNodeReports();
      for (String nodeReportKey : nodeReports.keySet()) {
         for (ApiTask apiTask : apiRequest.getApiTasks()) {
            NodeReport nodeReport = nodeReports.get(nodeReportKey);
            nodeReport.setUseClusterMsg(false);
            ApiTaskInfo apiTaskInfo = apiTask.getApiTaskInfo();
            if (nodeReport.getHostname().equals(apiTaskInfo.getHostName())) {
               TaskStatus taskStatus =
                     TaskStatus.valueOf(apiTask.getApiTaskInfo().getStatus());
               if (taskStatus.isRunningState()) {
                  if (clusterRequestStatus.isFailedState() &&
                        apiTaskInfo.getStderr() != null &&
                        !apiTaskInfo.getStderr().isEmpty()) {
                     nodeReport.setAction(apiTaskInfo.getCommandDetail() + ": "
                           + apiTaskInfo.getStderr());
                  } else {
                     nodeReport.setAction(apiTaskInfo.getCommandDetail());
                  }
                  nodeReports.put(nodeReportKey, nodeReport);
               }
            }
         }
      }
      currentReport.setNodeReports(nodeReports);

      int provisionPercent =
            (int) apiRequest.getApiRequestInfo().getProgressPercent();
      if (provisionPercent != 0) {
         int currentProgress = currentReport.getProgress();
         int toProgress = beginProgress + provisionPercent / 2;
         if (toProgress >= endProgress) {
            toProgress = endProgress;
         }
         boolean isCompletedState = clusterRequestStatus.isCompletedState();
         if ((toProgress != currentProgress) && (provisionPercent % 10 == 0)
               || isCompletedState) {
            if (isCompletedState) {
               logger.info("Cluster request " + requestId + " is completed.");
            } else {
               logger.info("Waiting for cluster request " + requestId
                     + " to complete.");
            }
            currentReport.setProgress(toProgress);
            if (reportQueue != null) {
               reportQueue.addClusterReport(currentReport.clone());
            }
         }
      }

      if (clusterRequestStatus.isCompletedState()) {
         return true;
      }

      return false;
   }
View Full Code Here

TOP

Related Classes of com.vmware.bdd.plugin.ambari.api.model.cluster.ClusterRequestStatus

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.