Package com.vmware.bdd.entity

Examples of com.vmware.bdd.entity.NodeEntity


                           com.vmware.aurora.composition.concurrent.Priority.BACKGROUND,
                           storeProceduresArray, callback);

         for (int i = 0; i < storeProceduresArray.length; i++) {
            SetLocalRepoSP sp = (SetLocalRepoSP) storeProceduresArray[i];
            NodeEntity node = sp.getNodeEntity();
            String vmNameWithIP = node.getVmNameWithIP();
            if (result[i].finished && result[i].throwable == null) {
               updateNodeData(node, true, null, null);
               logger.info("Set local repo: store procedure succeed for "
                     + vmNameWithIP);
            }
View Full Code Here


      ClusterCreate clusterSpec = configMgr.getClusterConfig(clusterName);

      String newPassword = clusterSpec.getPassword();

      String targetNode = getJobParameters(chunkContext).getString(JobConstants.SUB_JOB_NODE_NAME);
      NodeEntity nodeEntity = clusterEntityMgr.findNodeByName(targetNode);
      if (nodeEntity == null) {
         throw TaskException.EXECUTION_FAILED("No fixed node need to set password for.");
      }

      boolean success = false;
      try {
         success = setPasswordService.setPasswordForNode(clusterName, nodeEntity, newPassword);
         putIntoJobExecutionContext(chunkContext, JobConstants.SET_PASSWORD_SUCCEED_JOB_PARAM, success);
      } catch (Exception e) {
         logger.error("Failed to set password for " + nodeEntity.getVmNameWithIP(), e);
         putIntoJobExecutionContext(chunkContext, JobConstants.SET_PASSWORD_SUCCEED_JOB_PARAM, success);
      }
      return RepeatStatus.FINISHED;
   }
View Full Code Here

                           com.vmware.aurora.composition.concurrent.Priority.BACKGROUND,
                           storeProceduresArray, callback);

         for (int i = 0; i < storeProceduresArray.length; i++) {
            SetVMPasswordSP sp = (SetVMPasswordSP) storeProceduresArray[i];
            NodeEntity node = sp.getNodeEntity();
            String vmNameWithIP = node.getVmNameWithIP();
            if (result[i].finished && result[i].throwable == null) {
               updateNodeData(node, true, null, null);
               logger.info("Set password store procedure succeed for "
                     + vmNameWithIP);
            }
View Full Code Here

                     JobConstants.TARGET_NAME_JOB_PARAM).split("-")[0];
      }
      String nodeName =
            getJobParameters(chunkContext).getString(
                  JobConstants.SUB_JOB_NODE_NAME);
      NodeEntity node = getClusterEntityMgr().findNodeByName(nodeName);
      getClusterEntityMgr().syncUpNode(clusterName, nodeName);
      Boolean success =
            getFromJobExecutionContext(chunkContext,
                  JobConstants.NODE_OPERATION_SUCCESS, Boolean.class);
      if (success != null && !success) {
         throw ClusteringServiceException.CLUSTER_OPERATION_FAILED(clusterName);
      }
      NodeStatus expectedStatus =
            getFromJobExecutionContext(chunkContext,
                  JobConstants.EXPECTED_NODE_STATUS, NodeStatus.class);
      if (expectedStatus != null) {
         logger.info("the node should be in status " + expectedStatus);
         JobUtils.verifyNodeStatus(node, expectedStatus, true);
      }
      String cpuNumberStr =
            getJobParameters(chunkContext).getString(
                  JobConstants.NODE_SCALE_CPU_NUMBER);
      String memorySizeStr =
            getJobParameters(chunkContext).getString(
                  JobConstants.NODE_SCALE_MEMORY_SIZE);
      int cpuNumber = 0;
      if (cpuNumberStr != null) {
         cpuNumber = Integer.parseInt(cpuNumberStr);
      }
      boolean rollback =
            getFromJobExecutionContext(chunkContext,
                  JobConstants.NODE_SCALE_ROLLBACK, Boolean.class);
      long memory = 0;
      if (memorySizeStr != null) {
         memory = Long.parseLong(memorySizeStr);
      }
      if (cpuNumber > 0 && !rollback) {
         node.setCpuNum(cpuNumber);
      }
      if (memory > 0) {
         if (!rollback) {
            node.setMemorySize(memory);
         }
         scaleService.updateSwapDisk(nodeName);
      }
      getClusterEntityMgr().update(node);
View Full Code Here

    */
   @Override
   public boolean scaleNodeResource(String nodeName, int cpuNumber, long memory) {
      logger.info("scale node: " + nodeName + ", cpu number: " + cpuNumber
            + ", memory: " + memory);
      NodeEntity node = clusterEntityMgr.findNodeByName(nodeName);

      DiskEntity swapDisk = findSwapDisk(node);
      VcDatastore targetDs = null;
      long newSwapSizeInMB = 0;
      if (memory > 0) {
         newSwapSizeInMB =
               (((long) Math.ceil(memory * node.getNodeGroup().getSwapRatio()) + 1023) / 1024) * 1024;
         logger.info("new swap disk size(MB): " + newSwapSizeInMB);
         targetDs = getTargetDsForSwapDisk(node, swapDisk, newSwapSizeInMB);
      }

      ScaleVMSP scaleVMSP =
            new ScaleVMSP(node.getMoId(), cpuNumber, memory, targetDs,
                  swapDisk, newSwapSizeInMB);
      return VcVmUtil.runSPOnSingleVM(node, scaleVMSP);
   }
View Full Code Here

   /* (non-Javadoc)
    * @see com.vmware.bdd.service.IScaleService#getVmOriginalCpuNumber(java.lang.String)
    */
   @Override
   public int getVmOriginalCpuNumber(String nodeName) {
      NodeEntity node = clusterEntityMgr.findNodeByName(nodeName);
      return node.getCpuNum();
   }
View Full Code Here

   /* (non-Javadoc)
    * @see com.vmware.bdd.service.IScaleService#getVmOriginalMemory(java.lang.String)
    */
   @Override
   public long getVmOriginalMemory(String nodeName) {
      NodeEntity node = clusterEntityMgr.findNodeByName(nodeName);
      return node.getMemorySize();
   }
View Full Code Here

    * @see com.vmware.bdd.service.IScaleService#updateSwapDisk(java.lang.String)
    */
   @Override
   public void updateSwapDisk(String nodeName) {
      logger.info("update swap disk meta data for node: " + nodeName);
      NodeEntity node = clusterEntityMgr.findNodeByName(nodeName);
      DiskEntity swapDisk = findSwapDisk(node);
      VcVmUtil.populateDiskInfo(swapDisk, node.getMoId());
   }
View Full Code Here

         boolean success = true;
         int total = 0;
         for (int i = 0; i < storeNodeProceduresArray.length; i++) {
            Throwable nodeUpgradeSPException = result[i].throwable;
            NodeUpgradeSP sp = (NodeUpgradeSP) storeNodeProceduresArray[i];
            NodeEntity node = sp.getNode();
            if (result[i].finished && nodeUpgradeSPException == null) {
               updateNodeData(node);
               ++total;
            } else if (nodeUpgradeSPException != null) {
               updateNodeData(node, false, nodeUpgradeSPException.getMessage(), CommonUtil.getCurrentTimestamp());
               logger.error("Failed to Upgrade cluster Node " + node.getVmName(), nodeUpgradeSPException);
               success = false;
            }
         }
         logger.info(total + " Nodes are upgraded.");
View Full Code Here

   }

   @Transactional
   @RetryTransaction
   public void updateDisks(String nodeName, List<DiskEntity> diskSets) {
      NodeEntity node = findNodeByName(nodeName);
      for (DiskEntity disk : diskSets) {
         boolean found = false;
         for (DiskEntity old : node.getDisks()) {
            if (disk.getName().equals(old.getName())) {
               found = true;
               old.setDatastoreName(disk.getDatastoreName());
               old.setDatastoreMoId(disk.getDatastoreMoId());
               old.setVmdkPath(disk.getVmdkPath());
               old.setSizeInMB(disk.getSizeInMB());
            }
         }
         if (!found) {
            disk.setNodeEntity(node);
            node.getDisks().add(disk);
         }
      }
   }
View Full Code Here

TOP

Related Classes of com.vmware.bdd.entity.NodeEntity

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.