Examples of NodeEntity


Examples of com.vmware.bdd.entity.NodeEntity

      logger.info("stopCluster, start to create store procedures.");
      List<Callable<Void>> storeProcedures = new ArrayList<Callable<Void>>();
      Map<String, NodeOperationStatus> nodesStatus =
            new HashMap<String, NodeOperationStatus>();
      for (int i = 0; i < nodes.size(); i++) {
         NodeEntity node = nodes.get(i);
         if (node.getMoId() == null) {
            logger.info("VC vm does not exist for node: " + node.getVmName());
            continue;
         }
         VcVirtualMachine vcVm = VcCache.getIgnoreMissing(node.getMoId());

         if (vcVm == null) {
            logger.info("VC vm does not exist for node: " + node.getVmName());
            continue;
         }
         StopVmSP stopSp = new StopVmSP(vcVm);
         storeProcedures.add(stopSp);
         nodesStatus.put(node.getVmName(),
               new NodeOperationStatus(node.getVmName()));
      }

      try {
         if (storeProcedures.isEmpty()) {
            logger.info("no VM is available. Return directly.");
View Full Code Here

Examples of com.vmware.bdd.entity.NodeEntity

   }

   @Transactional
   @RetryTransaction
   public void refreshNodeByMobId(String vmId, String action, boolean inSession) {
      NodeEntity node = nodeDao.findByMobId(vmId);
      if (node != null) {
         node.setAction(action);
         refreshNodeStatus(node, inSession);
      }
   }
View Full Code Here

Examples of com.vmware.bdd.entity.NodeEntity

      return nodeDao.findByMobId(vmId);
   }

   @Transactional
   public NodeEntity getNodeWithNicsByMobId(String vmId) {
      NodeEntity nodeEntity = nodeDao.findByMobId(vmId);
      Hibernate.initialize(nodeEntity.getNics());
      return nodeEntity;
   }
View Full Code Here

Examples of com.vmware.bdd.entity.NodeEntity

   }

   @Transactional
   @RetryTransaction
   public void refreshNodeByVmName(String vmId, String vmName, boolean inSession) {
      NodeEntity node = nodeDao.findByName(vmName);
      if (node != null) {
         node.setMoId(vmId);
         refreshNodeStatus(node, inSession);
      }
   }
View Full Code Here

Examples of com.vmware.bdd.entity.NodeEntity

   @Transactional
   @RetryTransaction
   public void refreshNodeByVmName(String vmId, String vmName,
         String nodeAction, boolean inSession) {
      NodeEntity node = nodeDao.findByName(vmName);
      if (node != null) {
         node.setMoId(vmId);
         node.setAction(nodeAction);
         refreshNodeStatus(node, inSession);
      }
   }
View Full Code Here

Examples of com.vmware.bdd.entity.NodeEntity

   }

   @Override
   public boolean startSingleVM(String clusterName, String nodeName,
         StatusUpdater statusUpdator) {
      NodeEntity node = this.clusterEntityMgr.findNodeByName(nodeName);
      boolean reserveRawDisks = clusterEntityMgr.findByName(clusterName).getDistroVendor().equalsIgnoreCase(Constants.MAPR_VENDOR);
      // For node scale up/down, the disk info in db is not yet updated when powering on it, need to fetch from VC
      StartVmSP.StartVmPrePowerOn prePowerOn = new StartVmSP.StartVmPrePowerOn(reserveRawDisks,
            VcVmUtil.getVolumes(node.getMoId(), node.getDisks()));
      StartVmPostPowerOn query =
            new StartVmPostPowerOn(node.fetchAllPortGroups(),
                  Constants.VM_POWER_ON_WAITING_SEC, clusterEntityMgr);

      VcHost host = null;
      if (node.getHostName() != null) {
         host = VcResourceUtils.findHost(node.getHostName());
      }

      VcVirtualMachine vcVm = VcCache.getIgnoreMissing(node.getMoId());
      if (vcVm == null) {
         logger.info("VC vm does not exist for node: " + node.getVmName());
         return false;
      }
      StartVmSP startVMSP = new StartVmSP(vcVm, prePowerOn, query, host);
      return VcVmUtil.runSPOnSingleVM(node, startVMSP);
   }
View Full Code Here

Examples of com.vmware.bdd.entity.NodeEntity

      return taskIds;
   }

   public List<DiskEntity> getDisks(String nodeName) {
      NodeEntity node = nodeDao.findByName(nodeName);
      return new ArrayList<DiskEntity>(node.getDisks());
   }
View Full Code Here

Examples of com.vmware.bdd.entity.NodeEntity

   }

   @Override
   public boolean stopSingleVM(String clusterName, String nodeName,
         StatusUpdater statusUpdator, boolean... vmPoweroff) {
      NodeEntity node = this.clusterEntityMgr.findNodeByName(nodeName);
      if (node.getMoId() == null) {
         logger.error("vm mobid for node " + node.getVmName() + " is null");
         return false;
      }
      VcVirtualMachine vcVm = VcCache.getIgnoreMissing(node.getMoId());
      if (vcVm == null) {
         logger.info("VC vm does not exist for node: " + node.getVmName());
         return false;
      }
      StopVmSP stopVMSP;
      if (vmPoweroff.length > 0 && vmPoweroff[0]) {
         stopVMSP = new StopVmSP(vcVm, true);
View Full Code Here

Examples of com.vmware.bdd.entity.NodeEntity

         disks.add(disk);
      }
      Mockito.when(entityMgr.getDisks("bj-worker-1")).thenReturn(disks);

      // mock findByName(String, String, String)
      NodeEntity node = new NodeEntity();
      node.setVmName(NODE_1_NAME);
      node.setHostName(HOST_NAME);
      Mockito.when(
            entityMgr.findByName(CLUSTER_NAME, NODE_GROUP_NAME, NODE_1_NAME))
            .thenReturn(node);
      service.setClusterEntityMgr(entityMgr);
View Full Code Here

Examples of com.vmware.bdd.entity.NodeEntity

      Assert.assertTrue(cluster.getStatus() == ClusterStatus.UPDATING,
            "Cluster status should be UPDATING, but got " + cluster.getStatus());
      waitTaskFinished(jobExecutionId);
      assertTaskSuccess(jobExecutionId);
      assertDefinedInstanceNum(TEST_DHCP_CLUSTER_NAME, "worker", 2);
      NodeEntity node =
            clusterEntityMgr.findByName(TEST_DHCP_CLUSTER_NAME, "worker",
                  TEST_DHCP_CLUSTER_NAME + "-worker-0");
      Assert.assertTrue(
            node.getStatus() == NodeStatus.POWERED_OFF,
            "Stopped vm " + TEST_DHCP_CLUSTER_NAME + "-worker-0"
                  + " status should be Powered Off, but got "
                  + node.getStatus());
      cluster = clusterMgr.getClusterByName(TEST_DHCP_CLUSTER_NAME, false);
      Assert.assertTrue(cluster.getStatus() == ClusterStatus.RUNNING,
            "Cluster status should be RUNNING, but got " + cluster.getStatus());
   }
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.