Package com.vmware.bdd.placement.entity

Examples of com.vmware.bdd.placement.entity.VirtualNode


      }
   }

   @Test
   public void testGetBaseNodeNames() {
      VirtualNode vNode = new VirtualNode();
      vNode.addNode(new BaseNode("base1"));
      vNode.addNode(new BaseNode("base2"));
      Assert.assertEquals(
            PlacementUtil.getBaseNodeNames(vNode), Arrays.asList("base1", "base2")
      );
   }
View Full Code Here


      List<AbstractCluster> sharedClusters = vGroup.getJointAbstractClusters();

      if (sharedClusters == null || sharedClusters.size() == 0)
         return dsFilteredOutHosts;

      VirtualNode vNode = vGroup.getvNodes().get(0);

      for (AbstractCluster cluster : sharedClusters) {
         /*
          *  retrieve the cluster object, as the AbstractCluster object from getJointAbstractClusters
          *  is made up.
          */
         String vcClusterName = cluster.getName();
         cluster = this.dc.findAbstractCluster(cluster.getName());
         if (cluster == null) {
            logger.warn("VC Cluster " + vcClusterName
                  + " specified in the cluster spec is not found in VC");
            continue;
         }

         for (AbstractHost host : cluster.getHosts()) {
            if (vNode.hasEnoughStorage(host, true)) {
               logger.info("host "
                     + host.getName()
                     + " is filtered out by datastores specified to place virtual node "
                     + vNode.getBaseNodeNames());
               dsFilteredOutHosts.add(host.getName());
            }
         }
      }

View Full Code Here

      }

      List<VirtualNode> vNodes = new ArrayList<VirtualNode>();

      for (int i = 0; i < vNodeNum; i++) {
         VirtualNode vNode = new VirtualNode(vGroup);
         int count = 0;
         boolean primaryExisted = false;
         String primaryGroup = null;
         for (NodeGroupCreate nodeGroup : vGroup.getNodeGroups()) {
            /*
             * by default, if there are no instance_per_host policy, one virtual node contains
             * one base node
             */
            int baseNodeNum = 1;
            if (nodeGroup.instancePerHost() != null) {
               // multiple base nodes inside a virtual node
               baseNodeNum = nodeGroup.instancePerHost();
            }

            /*
             * imagine a dc-split case, where a virtual group contains a data group (4 nodes), and a
             * compute group (3 nodes). Apparently, the last virtual node should contain only one data
             * node.
             */
            if (i * baseNodeNum >= nodeGroup.getInstanceNum()) {
               baseNodeNum = 0;
            }

            for (int j = 0; j < baseNodeNum; j++) {
               BaseNode newGuy =
                     getBaseNode(cluster, nodeGroup, i * baseNodeNum + j);
               boolean existed = false;

               if (existedNodes != null && existedNodes.size() > 0) {
                  // existedNodes -> Map<NodeName>
                  for (BaseNode node : existedNodes) {
                     if (newGuy.getVmName().equalsIgnoreCase(node.getVmName())) {
                        existed = true;
                        // handle the special data node existence case here
                        if (mixed
                              && newGuy.getNodeGroup().getReferredGroup() == null) {
                           primaryExisted = true;
                           primaryGroup = newGuy.getNodeGroup().getName();
                        }
                        break;
                     }
                  }
               }
               if (!existed) {
                  vNode.addNode(newGuy);
                  count++;
               }
            }
         }
         if (count == 0)
            continue;
         logger.info("put " + count + " base nodes into one virtual node");
         if (primaryExisted) {
            vNode.setReferToGroup(primaryGroup);
            vNode.setStrictAssociated(true);
         }
         vNodes.add(vNode);
      }

      return vNodes;
View Full Code Here

TOP

Related Classes of com.vmware.bdd.placement.entity.VirtualNode

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.