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

Examples of com.vmware.bdd.plugin.ambari.api.model.bootstrap.ApiBootstrapStatus


         poller.waitForComplete();
         logger.debug("Bootstrap request id: " + apiBootstrapRequest.getRequestId());

         boolean success = false;
         boolean allHostsBootstrapped = true;
         ApiBootstrapStatus apiBootstrapStatus =
               apiManager.getBootstrapStatus(apiBootstrapRequest.getRequestId());
         BootstrapStatus bootstrapStatus =
               BootstrapStatus.valueOf(apiBootstrapStatus.getStatus());
         logger.debug("Bootstrap status " + bootstrapStatus);
         if (!bootstrapStatus.isFailedState()) {
            success = true;
         }

         int bootstrapedHostCount =
               apiBootstrapStatus.getApiBootstrapHostStatus().size();
         int needBootstrapHostCount = -1;
         if (addedHosts == null) {
            needBootstrapHostCount = clusterDef.getNodes().size();
         } else {
            needBootstrapHostCount = addedHosts.size();
         }
         logger.debug("Need to bootstrap host number: " + needBootstrapHostCount);
         logger.debug("Got bootstrap status number: " + bootstrapedHostCount);
         if (needBootstrapHostCount != bootstrapedHostCount) {
            success = false;
            allHostsBootstrapped = false;
         }
         if (!success) {
            List<String> notBootstrapNodes = new ArrayList<String>();
            if (!allHostsBootstrapped) {
               for (AmNodeDef node : clusterDef.getNodes()) {
                  boolean nodeBootstrapped = false;
                  for (ApiBootstrapHostStatus apiBootstrapHostStatus : apiBootstrapStatus
                        .getApiBootstrapHostStatus()) {
                     if (node.getFqdn().equals(
                           apiBootstrapHostStatus.getHostName())) {
                        nodeBootstrapped = true;
                        break;
View Full Code Here


         throw AmbariApiException.CANNOT_CONNECT_AMBARI_SERVER(e);
      }
      String bootstrapStatusJson = handleAmbariResponse(response);
      logger.debug("Response of bootstrap status from ambari server:");
      logger.debug(bootstrapStatusJson);
      ApiBootstrapStatus apiBootstrapRequest = ApiUtils.jsonToObject(ApiBootstrapStatus.class, bootstrapStatusJson);
      return apiBootstrapRequest;
   }
View Full Code Here

   @Override
   public boolean poll() {
      Long requestId = apiBootstrap.getRequestId();
      logger.info("Waiting for bootstrap hosts request " + requestId
            + " to complete.");
      ApiBootstrapStatus apiBootstrapStatus = apiManager.getBootstrapStatus(requestId);
      if (apiBootstrapStatus.getApiBootstrapHostStatus() == null) {
         return false;
      }

      // wait for all hosts registration
      int registeredHostsCount = 0;
      ApiHostList apiHostList = apiManager.getRegisteredHosts();
      for ( ApiBootstrapHostStatus apiBootstrapHostStatus : apiBootstrapStatus.getApiBootstrapHostStatus()) {
         for (ApiHost apiHost : apiHostList.getApiHosts()) {
            if (apiHost.getApiHostInfo().getHostName().equals(apiBootstrapHostStatus.getHostName())) {
               registeredHostsCount++;
            }
         }
      }
      int bootstrapedHostCount = apiBootstrapStatus.getApiBootstrapHostStatus().size();
      BootstrapStatus bootstrapStatus = BootstrapStatus.valueOf(apiBootstrapStatus.getStatus());
      if (bootstrapStatus.isFailedState()
            || (bootstrapStatus.isSucceedState() && bootstrapedHostCount == registeredHostsCount)) {
         if (bootstrapStatus.isFailedState()) {
            Map<String, NodeReport> nodeReports = currentReport.getNodeReports();
            for (String nodeReportKey : nodeReports.keySet()) {
               for (ApiBootstrapHostStatus apiBootstrapHostStatus : apiBootstrapStatus.getApiBootstrapHostStatus()) {
                  if (Constants.HOST_BOOTSTRAP_FAILED.equals(apiBootstrapHostStatus.getStatus())) {
                     NodeReport nodeReport = nodeReports.get(nodeReportKey);
                     nodeReport.setUseClusterMsg(false);
                     nodeReport.setAction("Failed to bootstrap host");
                     if (nodeReport.getHostname().equals(apiBootstrapHostStatus.getHostName())) {
View Full Code Here

TOP

Related Classes of com.vmware.bdd.plugin.ambari.api.model.bootstrap.ApiBootstrapStatus

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.