Examples of VcResourcePoolEntity


Examples of com.vmware.bdd.entity.VcResourcePoolEntity

    */
   @Override
   public List<VcCluster> getVcResourcePoolByName(String name) {
      logger.info("get resource pool by name " + name);
      List<VcResourcePoolEntity> rps = new ArrayList<VcResourcePoolEntity>();
      VcResourcePoolEntity rp = rpDao.findByName(name);
      if (rp != null) {
         rps.add(rp);
      } else {
         logger.info("got null resource pool entity for name:" + name);
      }
View Full Code Here

Examples of com.vmware.bdd.entity.VcResourcePoolEntity

      if (names == null || names.length == 0) {
         return null;
      }
      Map<String, VcCluster> clusterMap = new HashMap<String, VcCluster>(); // key: cluster name
      for (String name : names) {
         VcResourcePoolEntity rpForName = rpDao.findByName(name);
         if (rpForName == null) {
            logger.warn("Specified resource pool "
                  + name
                  + ", but the resource pool is removed by others. Continue to use other resource pools.");
            continue;
View Full Code Here

Examples of com.vmware.bdd.entity.VcResourcePoolEntity

   @Override
   @Transactional
   public ResourcePoolRead getResourcePoolForRest(final String rpName) {
      logger.debug("get resource pool " + rpName);

      VcResourcePoolEntity entity = rpDao.findByName(rpName);
      if (entity == null) {
         return null;
      }
      return entity.toRest();
   }
View Full Code Here

Examples of com.vmware.bdd.entity.VcResourcePoolEntity

    */
   @Override
   @Transactional
   public synchronized void deleteResourcePool(final String rpName) {
      logger.debug("delete resource pool " + rpName);
      VcResourcePoolEntity entity = rpDao.findByName(rpName);
      if (entity == null) {
         throw VcProviderException.RESOURCE_POOL_NOT_FOUND(rpName);
      }

      List<String> clusterNames =
View Full Code Here

Examples of com.vmware.bdd.entity.VcResourcePoolEntity

   private String getAutoRandomName() {
      long ran = new Random().nextLong();
      String name = "auto-" + ran;
      boolean found = false;
      for (int i = 0; i < 10; i++) {
         VcResourcePoolEntity rpEntity = rpDao.findByName(name);
         if (rpEntity != null) {
            logger.debug("rp name " + name + " exists, get new one");
         } else {
            found = true;
            break;
View Full Code Here

Examples of com.vmware.bdd.entity.VcResourcePoolEntity

   public VcResourcePool getResourcePoolByName(String rpName)
         throws VcProviderException {
      if (StringUtils.isEmpty(rpName)) {
         throw VcProviderException.RESOURCE_POOL_NAME_INVALID(rpName);
      }
      VcResourcePoolEntity rp = rpDao.findByName(rpName);
      final String clusterName = rp.getVcCluster();
      final String vcRPName = rp.getVcResourcePool();

      VcResourcePool vcRP =
            VcResourceUtils.findRPInVCCluster(clusterName, vcRPName);
      if (vcRP == null) {
         throw VcProviderException.RESOURCE_POOL_NOT_FOUND(rpName);
View Full Code Here

Examples of com.vmware.bdd.entity.VcResourcePoolEntity

    * @see com.vmware.bdd.service.resmgmt.ResourceManager#getHostsByRpName(java.lang.String)
    */
   @Override
   public List<VcHost> getHostsByRpName(String rpName)
         throws VcProviderException {
      VcResourcePoolEntity rp = rpDao.findByName(rpName);
      final String clusterName = rp.getVcCluster();
      return VcResourceUtils.findAllHostsInVCCluster(clusterName);
   }
View Full Code Here

Examples of com.vmware.bdd.entity.VcResourcePoolEntity

   // get the parent vc resource pool of the node
   public static VcResourcePool getTargetRp(String clusterName,
         String groupName, NodeEntity node) {
      String clusterRpName = ConfigInfo.getSerengetiUUID() + "-" + clusterName;

      VcResourcePoolEntity rpEntity = node.getVcRp();
      String vcRPName = "";

      try {
         VcCluster cluster =
               VcResourceUtils.findVcCluster(rpEntity.getVcCluster());
         if (!cluster.getConfig().getDRSEnabled()) {
            logger.debug("DRS disabled for cluster " + rpEntity.getVcCluster()
                  + ", put VM under cluster directly.");
            return cluster.getRootRP();
         }
         if (CommonUtil.isBlank(rpEntity.getVcResourcePool())) {
            vcRPName = clusterRpName + "/" + groupName;
         } else {
            vcRPName =
                  rpEntity.getVcResourcePool() + "/" + clusterRpName + "/"
                        + groupName;
         }
         VcResourcePool rp =
               VcResourceUtils.findRPInVCCluster(rpEntity.getVcCluster(),
                     vcRPName);
         if (rp == null) {
            throw ClusteringServiceException.TARGET_VC_RP_NOT_FOUND(
                  rpEntity.getVcCluster(), vcRPName);
         }
         return rp;
      } catch (Exception e) {
         logger.error("Failed to get VC resource pool " + vcRPName
               + " in vc cluster " + rpEntity.getVcCluster(), e);

         throw ClusteringServiceException.TARGET_VC_RP_NOT_FOUND(
               rpEntity.getVcCluster(), vcRPName);
      }
   }
View Full Code Here

Examples of com.vmware.bdd.entity.VcResourcePoolEntity

   private static final String ENTITY_NAME = "RP1";
   private static final String CLUSTER_NAME = "Cluster1";
   private static final String VC_RP = "TestRP1";
   @Test
   public void testToRest() {
      VcResourcePoolEntity vcRpEntity = new VcResourcePoolEntity();
      vcRpEntity.setName(ENTITY_NAME);
      vcRpEntity.setVcCluster(CLUSTER_NAME);
      vcRpEntity.setVcResourcePool(VC_RP);

      Set<NodeEntity> nodes = new HashSet<NodeEntity>();
      NodeEntity node1 = new NodeEntity();
      node1.setVmName("node1");
      NodeEntity node2 = new NodeEntity();
      node2.setVmName("node2");
      NodeGroupEntity ng = new NodeGroupEntity();
      ng.setRoles(new Gson().toJson(new String[] { "hadoop_datanode" }));
      node1.setNodeGroup(ng);
      node2.setNodeGroup(ng);
      nodes.add(node1);
      nodes.add(node2);

      vcRpEntity.setHadoopNodes(nodes);

      ResourcePoolRead rpRead = vcRpEntity.toRest();
      Assert.assertTrue(rpRead != null);

      NodeRead[] nodeReads = rpRead.getNodes();
      Assert.assertTrue(nodeReads.length == 2);
      Assert.assertTrue(nodeReads[0].getName().equals("node1"));
View Full Code Here

Examples of com.vmware.bdd.entity.VcResourcePoolEntity

      IResourceInitializerService svc = ctx.getBean(IResourceInitializerService.class);

      IResourcePoolDAO rpDao = ctx.getBean(IResourcePoolDAO.class);
      IDatastoreDAO dsDao = ctx.getBean(IDatastoreDAO.class);
      INetworkDAO networkDao = ctx.getBean(INetworkDAO.class);
      VcResourcePoolEntity rpEntity = rpDao.findByName(ResourceInitializerService.DEFAULT_RP);
      if(rpEntity != null){
         rpDao.delete(rpEntity);
      }
      List<VcDatastoreEntity> dss = dsDao.findByName(ResourceInitializerService.DEFAULT_DS_SHARED);
      if(dss != null && dss.size() > 0){
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.