Package com.vmware.bdd.entity

Examples of com.vmware.bdd.entity.ClusterEntity


   public Long fixDiskFailures(String clusterName, String groupName)
         throws Exception {
      opsBlocker.blockUnsupportedOpsByCluster("fixDisk", clusterName);

      ClusterEntity cluster = clusterEntityMgr.findByName(clusterName);
      if (cluster == null) {
         logger.error("cluster " + clusterName + " does not exist");
         throw BddException.NOT_FOUND("Cluster", clusterName);
      }
      SoftwareManager softMgr =
         softwareManagerCollector
               .getSoftwareManager(cluster.getAppManager());

      ValidationUtils.validateVersion(clusterEntityMgr, clusterName);

      ClusterStatus oldStatus = cluster.getStatus();

      if (!oldStatus.isActiveServiceStatus()) {
         throw ClusterHealServiceException.NOT_SUPPORTED(clusterName,
               "The cluster status must be RUNNING");
      }
View Full Code Here


   @Autowired
   private IAppManagerDAO appManager;


   public void blockUnsupportedOpsByCluster(String ops, String clusterName) {
      ClusterEntity clusterEntity = clusterEntityManager.findByName(clusterName);

      if (clusterEntity == null) {
         LOGGER.error(String.format("cluster %1s not found!", clusterName));
         throw BddException.NOT_FOUND("Cluster", clusterName);
      }

      if (CommonUtil.isBlank(clusterEntity.getAppManager())) {
         LOGGER.error(String.format("cluster %1s has no app manager!", clusterName));
         throw BddException.CLUSTER_HAS_NO_APP_MGR(clusterName);
      }

      AppManagerEntity appMgrEntity = appManager.findByName(clusterEntity.getAppManager());

      if (appMgrEntity == null) {
         LOGGER.error(String.format("app manager %1s not found!", clusterEntity.getAppManager()));
         throw BddException.APP_MGR_NOT_FOUND(clusterName);
      }

      if (CommonUtil.isBlank(appMgrEntity.getType())) {
         LOGGER.error(String.format("app manager %1s has no type!", appMgrEntity.getName()));
View Full Code Here

   @BeforeMethod
   public void setUp() {
      Mockit.setUpMock(MockVcContext.class);
      Mockit.setUpMock(MockVcCache.class);
      ClusterEntity cluster = clusterEntityMgr.findByName(TEST_CLUSTER_NAME);
      if (cluster != null) {
         clusterEntityMgr.delete(cluster);
      }
      cluster =
            TestClusterEntityManager.assembleClusterEntity(TEST_CLUSTER_NAME);
      int i = 0;
      for (NodeGroupEntity group : cluster.getNodeGroups()) {
         for (NodeEntity node : group.getNodes()) {
            node.setMoId(VM_MOB_PREFIX + i++);
         }
      }
      nodeNum = i;
View Full Code Here

      clusterEntityMgr.insert(cluster);
   }

   @AfterMethod
   public void tearDown() {
      ClusterEntity cluster = clusterEntityMgr.findByName(TEST_CLUSTER_NAME);
      if (cluster != null) {
         clusterEntityMgr.delete(cluster);
      }
      Mockit.tearDownMocks();
   }
View Full Code Here

   }

   @Transactional
   private void replaceNodeEntity(BaseNode vNode) {
      logger.info("Add or replace node info for VM " + vNode.getVmName());
      ClusterEntity cluster =
            getClusterEntityMgr().findByName(vNode.getClusterName());
      AuAssert.check(cluster != null);
      NodeGroupEntity nodeGroupEntity =
            getClusterEntityMgr().findByName(vNode.getClusterName(),
                  vNode.getGroupName());
      AuAssert.check(nodeGroupEntity != null);
      if (nodeGroupEntity.getNodes() == null) {
         nodeGroupEntity.setNodes(new LinkedList<NodeEntity>());
      }

      boolean insert = false;
      NodeEntity nodeEntity =
            getClusterEntityMgr()
                  .findByName(nodeGroupEntity, vNode.getVmName());
      // if node already exists, replace the value with new one from vNode.
      if (nodeEntity == null) {
         nodeEntity = new NodeEntity();
         nodeGroupEntity.getNodes().add(nodeEntity);
         insert = true;
      }
      nodeEntity.setVmName(vNode.getVmName());
      setNodeStatus(nodeEntity, vNode);
      if (vNode.getVmMobId() == null && nodeEntity.getMoId() != null) {
         vNode.setVmMobId(nodeEntity.getMoId());
      }

      // set node version
      nodeEntity.setVersion(cluster.getVersion());

      //set vc resource pool entity
      nodeEntity.setVcRp(rpDao.findByClusterAndRp(vNode.getTargetVcCluster(),
            vNode.getTargetRp()));
View Full Code Here

      if (success == null || success) {
         success = (je.getExitStatus().equals(ExitStatus.COMPLETED));
      }
      if (success) {
         IClusterEntityManager clusterEntityMgr = getClusterEntityMgr();
         ClusterEntity cluster = clusterEntityMgr.findByName(clusterName);

         cluster.setVersion(clusterEntityMgr.getServerVersion());
         cluster.setStatus(cluster.getLastStatus());
         cluster.setLastStatus(null);

         logger.info("cluster " + clusterName + "upgrade job succeeds");
      }
   }
View Full Code Here

   }

   private void updateDefinedInstanceNum(String clusterName, String groupName,
         Long instanceNum) {
      int intNum = instanceNum.intValue();
      ClusterEntity cluster = getClusterEntityMgr().findByName(clusterName);
      NodeGroupEntity groupEntity =
            getClusterEntityMgr().findByName(cluster, groupName);
      if (instanceNum < 0) {
         intNum = groupEntity.getNodes().size();
      }
View Full Code Here

    */
   public static List<BaseNode> getExistingNodes(ClusterCreate cluster,
         IClusterEntityManager entityMgr) {

      List<BaseNode> existingNodes = new ArrayList<BaseNode>();
      ClusterEntity clusterEntity = entityMgr.findByName(cluster.getName());
      for (NodeGroupCreate group : cluster.getNodeGroups()) {
         NodeGroupEntity groupEntity =
               entityMgr.findByName(clusterEntity, group.getName());
         List<NodeEntity> nodeEntities = groupEntity.getNodes();
         List<NodeEntity> listEntities = new ArrayList<NodeEntity>();
View Full Code Here

      }
      if (clusterName == null) {
         logger.error("Cluster name is not specified in method");
         throw BddException.INTERNAL(null, "Wrong annotation usage. Cluster name must be specified in method.");
      }
      ClusterEntity cluster = clusterEntityMgr.findByName(clusterName);
      if (cluster == null) {
         throw BddException.NOT_FOUND("Cluster", clusterName);
      }
      preStartServices(clusterName, maxWaitingSeconds);
      return pjp.proceed();
View Full Code Here

    * @param name
    * @return null if cluster name does not have a corresponding software
    *         manager instance
    */
   public SoftwareManager getSoftwareManagerByClusterName(String name) {
      ClusterEntity clusterEntity = clusterEntityManager.findByName(name);
      if (clusterEntity == null) {
         logger.warn("Can't find cluster with name: " + name);
         return null;
      }
      return getSoftwareManager(clusterEntity.getAppManager());
   }
View Full Code Here

TOP

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

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.