Examples of AmClusterDef


Examples of com.vmware.bdd.plugin.ambari.model.AmClusterDef

   @Override
   public boolean createCluster(ClusterBlueprint blueprint,
         ClusterReportQueue reportQueue)
         throws SoftwareManagementPluginException {
      boolean success = false;
      AmClusterDef clusterDef = null;
      try {
         logger.info("Blueprint:");
         logger.info(ApiUtils.objectToJson(blueprint));
         logger.info("Start cluster " + blueprint.getName() + " creation.");
         String ambariServerVersion = getVersion();
         clusterDef = new AmClusterDef(blueprint, privateKey, ambariServerVersion);
         provisionCluster(clusterDef, reportQueue);
         success = true;

         // All nodes use cluster message after cluster provision successfully.
         Map<String, NodeReport> nodeReports = clusterDef.getCurrentReport().getNodeReports();
         for (String nodeReportKey : nodeReports.keySet()) {
            nodeReports.get(nodeReportKey).setUseClusterMsg(true);
         }
         clusterDef.getCurrentReport().setAction("");
         clusterDef.getCurrentReport().setProgress(
               ProgressSplit.PROVISION_SUCCESS.getProgress());
         clusterDef.getCurrentReport().setSuccess(success);
      } catch (Exception e) {
         clusterDef.getCurrentReport().setSuccess(success);
         String errorMessage = errorMessage("Failed to create cluster " + blueprint.getName(), e);
         logger.error(errorMessage);

         throw SoftwareManagementPluginException.CREATE_CLUSTER_EXCEPTION(e, Constants.AMBARI_PLUGIN_NAME, blueprint.getName());
      } finally {
         clusterDef.getCurrentReport().setFinished(true);

         if(success) {
            clusterDef.getCurrentReport().setClusterAndNodesServiceStatus(ServiceStatus.STARTED);
         }

         reportStatus(clusterDef.getCurrentReport(), reportQueue);
      }
      return success;
   }
View Full Code Here

Examples of com.vmware.bdd.plugin.ambari.model.AmClusterDef

   public boolean scaleOutCluster(ClusterBlueprint blueprint, List<String> addedNodeNames,
         ClusterReportQueue reports)
         throws SoftwareManagementPluginException {
      // TODO Auto-generated method stub
      boolean success = false;
      AmClusterDef clusterDef = null;
      try {
         logger.info("Blueprint:");
         logger.info(ApiUtils.objectToJson(blueprint));
         logger.info("Start cluster " + blueprint.getName() + " scale out.");
         clusterDef = new AmClusterDef(blueprint, privateKey);
         bootstrap(clusterDef, addedNodeNames, reports);
         provisionComponents(clusterDef, addedNodeNames, reports);
         success = true;

         clusterDef.getCurrentReport().setNodesAction("", addedNodeNames);
         clusterDef.getCurrentReport().setNodesStatus(ServiceStatus.STARTED, addedNodeNames);
         clusterDef.getCurrentReport().setProgress(
               ProgressSplit.PROVISION_SUCCESS.getProgress());
         clusterDef.getCurrentReport().setSuccess(true);
      } catch (Exception e) {
         clusterDef.getCurrentReport().clearAllNodesErrorMsg();
         clusterDef.getCurrentReport().setAction("");
         clusterDef.getCurrentReport().setNodesError(
               "Failed to bootstrap nodes for " + e.getMessage(),
               addedNodeNames);
         clusterDef.getCurrentReport().setSuccess(false);
         String errorMessage = errorMessage("Failed to scale out cluster " + blueprint.getName(), e);
         logger.error(errorMessage, e);
         throw SoftwareManagementPluginException.SCALE_OUT_CLUSTER_FAILED(e, Constants.AMBARI_PLUGIN_NAME, blueprint.getName());
      } finally {
         clusterDef.getCurrentReport().setFinished(true);
         reportStatus(clusterDef.getCurrentReport(), reports);
      }
      return success;
   }
View Full Code Here

Examples of com.vmware.bdd.plugin.ambari.model.AmClusterDef

   }

   @Override
   public boolean startCluster(ClusterBlueprint clusterBlueprint, ClusterReportQueue reports)
         throws SoftwareManagementPluginException {
      AmClusterDef clusterDef = new AmClusterDef(clusterBlueprint, null);
      String clusterName = clusterDef.getName();
      if (!isProvisioned(clusterName)) {
         throw AmException.CLUSTER_NOT_PROVISIONED(clusterName);
      }
      if (!isClusterProvisionedByBDE(clusterDef)) {
         throw SoftwareManagementPluginException.START_CLUSTER_FAILED_NOT_PROV_BY_BDE(clusterName);
      }

      ClusterReport clusterReport = clusterDef.getCurrentReport();
      clusterReport.setAction("Ambari is starting services");
      clusterReport.setProgress(ProgressSplit.OPERATION_BEGIN.getProgress());
      reportStatus(clusterReport, reports);
      boolean success = false;
      //when start services, some tasks will fail with error msg "Host Role in invalid state".
View Full Code Here

Examples of com.vmware.bdd.plugin.ambari.model.AmClusterDef

   @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;
         }
View Full Code Here

Examples of com.vmware.bdd.plugin.ambari.model.AmClusterDef

            return true;
         }
         if (!isProvisioned(clusterName)) {
            return true;
         }
         AmClusterDef clusterDef = new AmClusterDef(clusterBlueprint, null);
         if (!isClusterProvisionedByBDE(clusterDef)) {
            return true;
         }
         //Stop services if there is started services, when stop failed, we will try to forcely delete resource
         //although we may also fail because of resource dependency. In that case, we will
View Full Code Here

Examples of com.vmware.bdd.plugin.ambari.model.AmClusterDef

      }
   }

   @Override
   public boolean onDeleteNodes(ClusterBlueprint blueprint, List<String> nodeNames) throws SoftwareManagementPluginException {
      AmClusterDef clusterDef = null;
      try {
         logger.info("Delete nodes " + nodeNames + " from cluster " + blueprint.getName());
         clusterDef = new AmClusterDef(blueprint, privateKey);
         List<String> targetHostNames = new ArrayList<>();
         for (AmNodeDef nodeDef : clusterDef.getNodes()) {
            if (nodeNames.contains(nodeDef.getName())) {
               targetHostNames.add(nodeDef.getFqdn());
            }
         }
         removeHosts(clusterDef, targetHostNames, null);
      } catch (Exception e) {
         clusterDef.getCurrentReport().setSuccess(false);
         String errorMessage = errorMessage("Failed to delete nodes " + nodeNames + " from cluster " + blueprint.getName(), e);
         logger.error(errorMessage, e);
         throw SoftwareManagementPluginException.DELETE_NODES_FAILED(e, Constants.AMBARI_PLUGIN_NAME, nodeNames.toArray());
      }
      return true;
View Full Code Here

Examples of com.vmware.bdd.plugin.ambari.model.AmClusterDef

      return false;
   }

   @Override
   public ClusterReport queryClusterStatus(ClusterBlueprint blueprint) {
      AmClusterDef clusterDef = new AmClusterDef(blueprint, privateKey);
      try {
         ServiceStatus status =
               apiManager.getClusterStatus(blueprint.getName(),
                     blueprint.getHadoopStack());
         clusterDef.getCurrentReport().setStatus(status);

         Map<String, ServiceStatus> hostStates =
               apiManager.getHostStatus(blueprint.getName());
         Map<String, NodeReport> nodeReports =
               clusterDef.getCurrentReport().getNodeReports();
         for (AmNodeDef node : clusterDef.getNodes()) {
            String fqdn = node.getFqdn();
            nodeReports.get(node.getName()).setStatus(hostStates.get(fqdn));
         }
      } catch (NotFoundException e) {
         logger.info("Cluster " + blueprint.getName() + " does not exist in server.");
         return null;
      }
      return clusterDef.getCurrentReport().clone();
   }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.