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

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


      boolean finished = report.isFinished();
      ClusterEntity cluster = findByName(report.getName());
      Map<String, NodeReport> nodeReportMap = report.getNodeReports();
      for (NodeGroupEntity group : cluster.getNodeGroups()) {
         for (NodeEntity node : group.getNodes()) {
            NodeReport nodeReport = nodeReportMap.get(node.getVmName());
            if (nodeReport == null) {
               continue;
            }
            if (nodeReport.getStatus() != null) {
               if (!node.isDisconnected()
                     && node.getStatus().ordinal() >= NodeStatus.VM_READY
                           .ordinal()) {
                  logger.debug("Got node " + node.getVmName() + " status "
                        + nodeReport.getStatus().toString());
                  NodeStatus oldStatus = node.getStatus();
                  switch (nodeReport.getStatus()) {
                  case STARTED:
                     node.setStatus(NodeStatus.SERVICE_READY, false);
                     break;
                  case UNHEALTHY:
                     node.setStatus(NodeStatus.SERVICE_UNHEALTHY, false);
                     break;
                  case ALERT:
                     if (node.getStatus() != NodeStatus.BOOTSTRAP_FAILED) {
                        node.setStatus(NodeStatus.SERVICE_ALERT, false);
                     }
                     break;
                  case UNKONWN:
                     node.setStatus(NodeStatus.UNKNOWN, false);
                     break;
                  case PROVISIONING:
                  case STOPPED:
                     if (node.getStatus() != NodeStatus.BOOTSTRAP_FAILED) {
                        node.setStatus(NodeStatus.VM_READY, false);
                     }
                     break;
                  default:
                     node.setStatus(NodeStatus.BOOTSTRAP_FAILED, false);
                  }
                  logger.debug("node:" + node.getVmName()
                        + ", status changed from old status: " + oldStatus
                        + " to new status: " + node.getStatus());
               }
            }
            if (nodeReport.isUseClusterMsg() && report.getAction() != null) {
               logger.debug("set node action to:" + report.getAction());
               node.setAction(report.getAction());
            } else if (nodeReport.getAction() != null) {
               node.setAction(nodeReport.getAction());
            }
            if (lastUpdate) {
               if (nodeReport.getErrMsg() != null) {
                  logger.debug("set node error message to:"
                        + report.getAction());
                  node.setErrMessage(nodeReport.getErrMsg());
                  node.setActionFailed(true);
               } else {
                  logger.debug("clear node error message for node "
                        + node.getHostName());
                  node.setErrMessage(null);
View Full Code Here


         }
      }

      private void setNodeActions() {
         for (String nodeName : installingNodes) {
            NodeReport node = currentReport.getNodeReports().get(nodeName);
            node.setAction(currentMsg);
         }
      }
View Full Code Here

         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())) {
                        nodeReport.setErrMsg(apiBootstrapHostStatus.getLog());
                     }
                  }
               }
            }
         }
View Full Code Here

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

      report.setAction("Installing agent...");
      report.setFinished(false);
      report.setName(CLUSTER_NAME);
      report.setProgress(80);
      report.setNodeReports(new HashMap<String, NodeReport>());
      NodeReport node = new NodeReport();
      node.setAction("Installing node agent...");
      node.setName(HDFS_NODE_0);
      report.getNodeReports().put(HDFS_NODE_0, node);

      node = new NodeReport();
      node.setName(HDFS_NODE_1);
      node.setUseClusterMsg(true);
      report.getNodeReports().put(HDFS_NODE_1, node);

      boolean result = clusterEntityMgr.handleOperationStatus(CLUSTER_NAME, report, false);
      Assert.assertFalse(result,
            "cluster " + CLUSTER_NAME + " operation should not be finished");
View Full Code Here

   }

   private void queryNodesStatus(CmClusterDef cluster) {
      for (CmNodeDef node : cluster.getNodes()) {
         Map<String, NodeReport> nodeReports = cluster.getCurrentReport().getNodeReports();
         NodeReport nodeReport = nodeReports.get(node.getName());
         try {
            ApiHost host = apiResourceRootV6.getHostsResource().readHost(node.getNodeId());
            ApiHealthSummary health = host.getHealthSummary();
            switch(health) {
            case GOOD:
               List<ApiRoleRef> roleRefs = host.getRoleRefs();
               boolean hasStarted = false;
               boolean hasStopped = false;
               for (ApiRoleRef roleRef : roleRefs) {
                  if (isRoleStarted(roleRef.getClusterName(),
                        roleRef.getServiceName(), roleRef.getRoleName())) {
                     hasStarted = true;
                  } else {
                     hasStopped = true;
                  }
               }
               if (hasStopped && !hasStarted) {
                  nodeReport.setStatus(ServiceStatus.STOPPED);
               } else if (hasStopped && hasStarted) {
                  nodeReport.setStatus(ServiceStatus.ALERT);
               } else if (!hasStopped && hasStarted){
                  nodeReport.setStatus(ServiceStatus.STARTED);
               } else {
                  nodeReport.setStatus(ServiceStatus.STOPPED);
               }
               logger.debug("Node " + nodeReport.getName() + " is good.");
               break;
            case CONCERNING:
               nodeReport.setStatus(ServiceStatus.UNHEALTHY);
               logger.debug("Node " + nodeReport.getName() + " is concerning.");
               break;
            case BAD:
               logger.debug("Node " + nodeReport.getName() + " is not running well.");
               nodeReport.setStatus(ServiceStatus.ALERT);
               break;
            default:
               logger.debug("Node " + nodeReport.getName() + " is unknown.");
               nodeReport.setStatus(ServiceStatus.UNKONWN);
               break;
            }
         } catch (NotFoundException e) {
            logger.debug("Node " + node.getName() + " is not found in Cloudera Manager.");
            nodeReport.setStatus(ServiceStatus.FAILED);
         }
      }
   }
View Full Code Here

      }
      Map<String, NodeReport> nodeReports = report.getNodeReports();
      for (String hostId: failedRoles.keySet()) {
         String ip = hostId2IP(hostId);
         for (String nodeReportKey: nodeReports.keySet()) {
            NodeReport nodeReport = nodeReports.get(nodeReportKey);
            if (nodeReport.getIpAddress().equals(ip)) {
               logger.info("added " + failedRoles.get(hostId).toString() + " to " + nodeReport.getIpAddress());
               nodeReport.setUseClusterMsg(false);
               nodeReport.setErrMsg("Failed to " + action + " roles " + failedRoles.get(hostId));
            }
         }
      }
      failedRoles.clear();
   }
View Full Code Here

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

TOP

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

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.