Examples of GroupRacksType


Examples of com.vmware.bdd.apitypes.PlacementPolicy.GroupRacks.GroupRacksType

         if (nodeGroup.getGroupRacks() != null) {
            GroupRacks groupRacks =
                  new Gson().fromJson(nodeGroup.getGroupRacks(),
                        GroupRacks.class);
            GroupRacksType rackType = groupRacks.getType();

            List<RackInfo> racksInfo = rackInfoMgr.getRackInfos();

            Set<String> specifiedRacks =
                  new HashSet<String>(Arrays.asList(groupRacks.getRacks()));
            List<String> IntersecRacks = new ArrayList<String>();
            Integer IntersecHostNum = 0;
            Integer maxIntersecHostNum = 0;
            for (RackInfo rackInfo : racksInfo) {
               if (specifiedRacks.isEmpty() || specifiedRacks.size() == 0
                     || specifiedRacks.contains(rackInfo.getName())) {
                  IntersecHostNum += rackInfo.getHosts().size();
                  IntersecRacks.add(rackInfo.getName());
                  if (rackInfo.getHosts().size() > maxIntersecHostNum) {
                     maxIntersecHostNum = rackInfo.getHosts().size();
                  }
               }
            }

            if (rackType.equals(GroupRacksType.ROUNDROBIN)
                  && IntersecHostNum < requiredHostNum) {
               throw ClusterConfigException.LACK_PHYSICAL_HOSTS(
                     requiredHostNum, nodeGroup.getName(), IntersecHostNum);
            } else if (rackType.equals(GroupRacksType.SAMERACK)
                  && requiredHostNum > maxIntersecHostNum) {
               throw ClusterConfigException.LACK_PHYSICAL_HOSTS(
                     requiredHostNum, nodeGroup.getName(), maxIntersecHostNum);
            }
View Full Code Here

Examples of com.vmware.bdd.apitypes.PlacementPolicy.GroupRacks.GroupRacksType

               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)
                  && specifiedRacks.size() != 1) {
               throw ClusterConfigException.MUST_DEFINE_ONE_RACK(ngc.getName());
            }

            List<String> intersecRacks = new ArrayList<String>();
            int intersecHostNum = 0;
            int maxIntersecHostNum = 0;

            for (RackInfo rackInfo : racksInfo) {
               if (specifiedRacks.isEmpty() || specifiedRacks.size() == 0
                     || specifiedRacks.contains(rackInfo.getName())) {
                  intersecHostNum += rackInfo.getHosts().size();
                  intersecRacks.add(rackInfo.getName());
                  if (rackInfo.getHosts().size() > maxIntersecHostNum) {
                     maxIntersecHostNum = rackInfo.getHosts().size();
                  }
               }
            }

            if (intersecRacks.size() == 0) {
               valid = false;
               throw ClusterConfigException.NO_VALID_RACK(ngc.getName());
            }

            if (ngc.calculateHostNum() != null) {
               if (rackType.equals(GroupRacksType.ROUNDROBIN)
                     && ngc.calculateHostNum() > intersecHostNum) {
                  valid = false;
                  throw ClusterConfigException.LACK_PHYSICAL_HOSTS(
                        ngc.calculateHostNum(), ngc.getName(), intersecHostNum);
               } else if (rackType.equals(GroupRacksType.SAMERACK)
                     && ngc.calculateHostNum() > maxIntersecHostNum) {
                  valid = false;
                  throw ClusterConfigException.LACK_PHYSICAL_HOSTS(
                        ngc.calculateHostNum(), ngc.getName(),
                        maxIntersecHostNum);
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.