Examples of PlacementPolicy


Examples of com.vmware.bdd.apitypes.PlacementPolicy

         association.setReference(relation.getReferencedGroup());
         association.setType(relation.getAssociationType());
         associations.add(association);
      }

      PlacementPolicy policy = new PlacementPolicy();
      policy.setInstancePerHost(instancePerHost);
      policy.setGroupAssociations(associations);
      policy.setGroupRacks(new Gson().fromJson(groupRacks, GroupRacks.class));

      nodeGroupRead.setPlacementPolicies(policy);

      return nodeGroupRead;
   }
View Full Code Here

Examples of com.vmware.bdd.apitypes.PlacementPolicy

      for (NodeGroupCreate nodeGroupCreate : cluster.getNodeGroups()) {
         allGroups.put(nodeGroupCreate.getName(), nodeGroupCreate);
      }

      for (NodeGroupCreate ngc : cluster.getNodeGroups()) {
         PlacementPolicy policies = ngc.getPlacementPolicies();
         if (policies != null && policies.getGroupAssociations() != null) {
            continue;
         }

         if (ngc.getStorage() != null
               && ngc.getStorage().getType() != null
               && ngc.getStorage().getType()
                     .equals(DatastoreType.SHARED.toString())) {
            continue;
         }

         if (policies != null && policies.getGroupRacks() != null) {
            if (racksInfo.isEmpty()) {
               valid = false;
               throw ClusterConfigException
                     .RACKPOLICY_WITH_NO_MAPPING_INFO_EXIST(ngc.getName());
            }

            GroupRacks r = policies.getGroupRacks();
            GroupRacksType rackType = r.getType();
            Set<String> specifiedRacks =
                  new HashSet<String>(Arrays.asList(r.getRacks()));

            if (rackType.equals(GroupRacksType.SAMERACK)
View Full Code Here

Examples of com.vmware.bdd.apitypes.PlacementPolicy

            .getMemCapacityMB());
      groupEntity.setSwapRatio(group.getSwapRatio());
      groupEntity.setName(group.getName());
      groupEntity.setNodeType(group.getInstanceType());

      PlacementPolicy policies = group.getPlacementPolicies();
      if (policies != null) {
         List<GroupAssociation> associons = policies.getGroupAssociations();
         if (associons != null) {
            Set<NodeGroupAssociation> associonEntities =
                  new HashSet<NodeGroupAssociation>();
            for (GroupAssociation a : associons) {
               NodeGroupAssociation ae = new NodeGroupAssociation();
               ae.setAssociationType(a.getType());
               ae.setNodeGroup(groupEntity);
               ae.setReferencedGroup(a.getReference());
               associonEntities.add(ae);
            }
            groupEntity.setGroupAssociations(associonEntities);
         }
         if (policies.getInstancePerHost() != null) {
            groupEntity.setInstancePerHost(policies.getInstancePerHost());
         }

         if (policies.getGroupRacks() != null) {
            groupEntity.setGroupRacks((new Gson()).toJson(policies
                  .getGroupRacks()));
         }
      }

      if (group.getRpNames() != null && group.getRpNames().size() > 0) {
View Full Code Here

Examples of com.vmware.bdd.apitypes.PlacementPolicy

      if (instancePerHost == null
            && (associonEntities == null || associonEntities.isEmpty())
            && ngRacks == null) {
         group.setPlacementPolicies(null);
      } else {
         PlacementPolicy policies = new PlacementPolicy();
         policies.setInstancePerHost(instancePerHost);
         if (ngRacks != null) {
            policies.setGroupRacks((GroupRacks) new Gson().fromJson(ngRacks,
                  GroupRacks.class));
         }
         if (associonEntities != null) {
            List<GroupAssociation> associons =
                  new ArrayList<GroupAssociation>(associonEntities.size());
            for (NodeGroupAssociation ae : associonEntities) {
               GroupAssociation a = new GroupAssociation();
               a.setReference(ae.getReferencedGroup());
               a.setType(ae.getAssociationType());
               associons.add(a);
            }
            policies.setGroupAssociations(associons);
         }

         group.setPlacementPolicies(policies);
      }
View Full Code Here

Examples of com.vmware.bdd.apitypes.PlacementPolicy

      ngs[2].setInstanceType(InstanceType.MEDIUM);
      StorageRead storageCompute = new StorageRead();
      storageCompute.setType("TEMPFS");
      storageCompute.setSizeGB(50);
      ngs[2].setStorage(storageCompute);
      PlacementPolicy policy = new PlacementPolicy();
      policy.setInstancePerHost(2);
      List<GroupAssociation> associates = new ArrayList<GroupAssociation>();
      GroupAssociation associate = new GroupAssociation();
      associate.setReference("data");
      associate.setType(GroupAssociationType.STRICT);
      associates.add(associate);
      policy.setGroupAssociations(associates);
      ngs[2].setPlacementPolicies(policy);

      spec.setNodeGroups(ngs);
      spec = ClusterSpecFactory.getCustomizedSpec(spec, null);
      clusterConfigMgr.createClusterConfig(spec);
View Full Code Here

Examples of com.vmware.bdd.apitypes.PlacementPolicy

      for (NodeGroupCreate nodeGroup : cluster.getNodeGroups()) {
         boolean instancePerHost = false;
         boolean strictAssociated = false;
         String referToGroup = null;

         PlacementPolicy placement = nodeGroup.getPlacementPolicies();
         if (placement != null && placement.getInstancePerHost() != null) {
            instancePerHost = true;
         }

         if (placement != null && placement.getGroupAssociations() != null
               && placement.getGroupAssociations().size() > 0) {
            GroupAssociation association =
                  placement.getGroupAssociations().get(0);
            if (GroupAssociationType.STRICT.equals(association.getType())) {
               strictAssociated = true;
               referToGroup = association.getReference();
            }
         }

         int count = 0;
         Map<String, Integer> usage = hostMapByGroup.get(nodeGroup.getName());
         // this node group does not have any existed nodes
         if (usage == null)
            continue;
         for (String host : usage.keySet()) {
            count += usage.get(host);

            // instance_per_host validation
            if (instancePerHost)
               Assert.assertTrue(
                     placement.getInstancePerHost().equals(usage.get(host)),
                     "should follow instance_per_host policy");

            // strict association policy validation
            if (strictAssociated) {
               Assert.assertTrue(
View Full Code Here

Examples of com.vmware.bdd.apitypes.PlacementPolicy

   private void addTempFSServerRole(ClusterBlueprint blueprint) {
      Set<String> referencedNodeGroups = new HashSet<String>();
      for (NodeGroupInfo group : blueprint.getNodeGroups()) {
         if (DatastoreType.TEMPFS.name().equalsIgnoreCase(group.getStorageType())) {
            PlacementPolicy policies = group.getPlacement();
            if (policies != null) {
               List<GroupAssociation> associons = policies.getGroupAssociations();
               if (associons != null) {
                  for (GroupAssociation a : associons) {
                     referencedNodeGroups.add(a.getReference());
                  }
               }
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.