Package com.vmware.bdd.software.mgmt.plugin.monitor

Examples of com.vmware.bdd.software.mgmt.plugin.monitor.ClusterReport


         this.version = ApiClusterVersion.CDH5.toString();
         this.fullVersion = null;
      }
      this.nodes = new ArrayList<CmNodeDef>();
      this.services = new ArrayList<CmServiceDef>();
      this.currentReport = new ClusterReport(blueprint);
      this.failoverEnabled = isFailoverEnabled(blueprint);
      Integer zkIdIndex = 1;
      Integer nameServiceIndex = 0;
      boolean hasImpala = false;
      for (NodeGroupInfo group : blueprint.getNodeGroups()) {
View Full Code Here


   @Override
   public boolean onStopCluster(ClusterBlueprint clusterBlueprint, ClusterReportQueue reports)
         throws SoftwareManagementPluginException {
      String clusterName = clusterBlueprint.getName();
      AmClusterDef clusterDef = new AmClusterDef(clusterBlueprint, null);
      ClusterReport clusterReport = clusterDef.getCurrentReport();
      boolean success = false;
      try {
         if (!isProvisioned(clusterName)) {
            return true;
         }
         if (!isClusterProvisionedByBDE(clusterDef)) {
            throw SoftwareManagementPluginException.STOP_CLUSTER_FAILED(Constants.AMBARI_PLUGIN_NAME,
                  clusterName, "Cannot stop a cluster that is not provisioned by Big Data Extension");
         }
         clusterReport.setAction("Ambari is stopping services");
         clusterReport.setProgress(ProgressSplit.OPERATION_BEGIN.getProgress());
         reportStatus(clusterReport, reports);
         ApiRequest apiRequestSummary = apiManager.stopAllServicesInCluster(clusterName);
         if (apiRequestSummary == null || apiRequestSummary.getApiRequestInfo() == null) {
            logger.info("Services is already stopped in cluster " + clusterName);
            return true;
         }
         doSoftwareOperation(clusterName, apiRequestSummary, clusterReport, reports);
         clusterReport.setClusterAndNodesAction("");
         clusterReport.clearAllNodesErrorMsg();
         clusterReport.setClusterAndNodesServiceStatus(ServiceStatus.STOPPED);
         reportStatus(clusterReport.clone(), reports);
         return true;
      } catch (Exception e) {
         logger.error("Failed to stop all services: ", e);
         throw SoftwareManagementPluginException.STOP_CLUSTER_EXCEPTION(e, Constants.AMBARI_PLUGIN_NAME, clusterName);
      }
View Full Code Here

   // make the cloudera manager in inconsistent state with bde. So when we fail, we throw exception
   private boolean stopServices(ClusterBlueprint clusterBlueprint, ClusterReportQueue reportQueue) throws SoftwareManagementPluginException {
      assert(clusterBlueprint != null && clusterBlueprint.getName() != null && !clusterBlueprint.getName().isEmpty());
      String clusterName = clusterBlueprint.getName();
      CmClusterDef clusterDef = null;
      ClusterReport report = null;
      boolean succeed = false;
      try {
         if (!isProvisioned(clusterName)) {
            return true;
         }
         clusterDef = new CmClusterDef(clusterBlueprint);
         report = clusterDef.getCurrentReport();
         if (isStopped(clusterName) || !needStop(clusterName)) {
            succeed = true;
            return true;
         }
         executeAndReport("Stopping Services",
               apiResourceRootV6.getClustersResource().stopCommand(clusterName),
               ProgressSplit.STOP_SERVICES.getProgress(),
               report,
               reportQueue,
               true);
         succeed = true;
         return true;
      } catch (Exception e) {
         logger.error("Got an exception when cloudera manager stopping services", e);
         report.setClusterAndNodesServiceStatus(ServiceStatus.STOP_FAILED);
         HashMap<String, Set<String>> unstoppedRoles = getFailedRoles(clusterName, ApiRoleState.STOPPED);
         setRolesErrorMsg(report, unstoppedRoles, "stopping");
         throw SoftwareManagementPluginException.STOP_CLUSTER_EXCEPTION(e, Constants.CDH_PLUGIN_NAME, clusterBlueprint.getName());
      } finally {
         if (clusterDef != null) {
            if (succeed) {
               report.setClusterAndNodesServiceStatus(ServiceStatus.STOPPED);
               report.setProgress(ProgressSplit.STOP_SERVICES.getProgress());
               logger.info("Cloudera Manager stopped all services successfully.");
            }
            report.setClusterAndNodesAction("");
            report.setFinished(true);
            report.setSuccess(succeed);
            reportQueue.addClusterReport(report.clone());
         }
      }
   }
View Full Code Here

   @Override
   public boolean startCluster(ClusterBlueprint clusterBlueprint, ClusterReportQueue reportQueue) throws SoftwareManagementPluginException {
      assert(clusterBlueprint != null && clusterBlueprint.getName() != null && !clusterBlueprint.getName().isEmpty());
      String clusterName = clusterBlueprint.getName();
      CmClusterDef clusterDef = null;
      ClusterReport report = null;
      boolean succeed = false;
      try {
         if (!isProvisioned(clusterName)) {
            return true;
         }
         clusterDef = new CmClusterDef(clusterBlueprint);
         report = clusterDef.getCurrentReport();
         if (isExistingServiceStarted(clusterName)) {
            succeed = true;
            return true;
         }
         ReflectionUtils.getPreStartServicesHook().preStartServices(clusterDef.getName(), 120);
         executeAndReport("Starting Services",
                           apiResourceRootV6.getClustersResource().startCommand(clusterName),
                           ProgressSplit.START_SERVICES.getProgress(),
                           report,
                           reportQueue,
                           true);
         succeed = true;
         return true;
      } catch (Exception e) {
         report.setClusterAndNodesServiceStatus(ServiceStatus.STARTUP_FAILED);
         logger.error("Got an exception when cloudera manager starting cluster", e);
         HashMap<String, Set<String>> unstartedRoles = getFailedRoles(clusterName, ApiRoleState.STARTED);
         setRolesErrorMsg(report, unstartedRoles, "starting");
         throw SoftwareManagementPluginException.START_CLUSTER_FAILED(e, Constants.CDH_PLUGIN_NAME, clusterDef.getName());
      } finally {
         if (clusterDef != null) {
            report.setFinished(true);
            if (succeed) {
               report.setProgress(ProgressSplit.START_SERVICES.getProgress());
               report.setClusterAndNodesServiceStatus(ServiceStatus.STARTED);
               logger.info("Cloudera Manager started all services successfully.");
            }
            report.setClusterAndNodesAction("");//clean action field
            report.setFinished(true);
            report.setSuccess(succeed);
            reportQueue.addClusterReport(report.clone());
         }
      }
   }
View Full Code Here

      this.name = blueprint.getName();
      this.version = blueprint.getHadoopStack().getFullVersion();
      this.verbose = true;
      this.sshKey = privateKey;
      this.user = Constants.AMBARI_SSH_USER;
      this.currentReport = new ClusterReport(blueprint);
      this.configurations =
            AmUtils.toAmConfigurations(blueprint.getConfiguration());

      this.nodes = new ArrayList<AmNodeDef>();
      HdfsVersion hdfs = getDefaultHdfsVersion(this.version);
View Full Code Here

* Time: 11:07 AM
*/
public class TestCloner {
   @Test
   public void testClone() {
      ClusterReport report = new ClusterReport();
      report.setName("cluster01");
      Map<String, NodeReport> nodes = new HashMap<String, NodeReport>();
      NodeReport node1 = new NodeReport();
      node1.setName("node1");
      nodes.put(node1.getName(), node1);
      report.setNodeReports(nodes);

      System.out.println((new Gson()).toJson(report));

      ClusterReport report2 = report.clone();
      report2.setName("cluster02");
      report2.getNodeReports().get("node1").setName("node1111");


      System.out.println((new Gson()).toJson(report2));
      System.out.println((new Gson()).toJson(report));

View Full Code Here

TOP

Related Classes of com.vmware.bdd.software.mgmt.plugin.monitor.ClusterReport

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.