Examples of HostNetworkTrafficShapingPolicy


Examples of com.vmware.vim25.HostNetworkTrafficShapingPolicy

            secPolicy = new HostNetworkSecurityPolicy();
            secPolicy.setAllowPromiscuous(Boolean.TRUE);
            secPolicy.setForgedTransmits(Boolean.TRUE);
            secPolicy.setMacChanges(Boolean.TRUE);
        }
        HostNetworkTrafficShapingPolicy shapingPolicy = null;
        if(networkRateMbps != null && networkRateMbps.intValue() > 0) {
            shapingPolicy = new HostNetworkTrafficShapingPolicy();
            shapingPolicy.setEnabled(true);
            shapingPolicy.setAverageBandwidth((long)networkRateMbps.intValue()*1024L*1024L);
       
            //
            // TODO : people may have different opinion on how to set the following
            //
           
            // give 50% premium to peek
            shapingPolicy.setPeakBandwidth((long)(shapingPolicy.getAverageBandwidth()*1.5));

            // allow 5 seconds of burst transfer
            shapingPolicy.setBurstSize(5*shapingPolicy.getAverageBandwidth()/8);
        }

        boolean bWaitPortGroupReady = false;
        if (!hostMo.hasPortGroup(vSwitch, networkName)) {
            hostMo.createPortGroup(vSwitch, networkName, vid, secPolicy, shapingPolicy);
View Full Code Here

Examples of com.vmware.vim25.HostNetworkTrafficShapingPolicy

      if(spec.getVlanId() != 0)
        return false;
    }

    // check traffic shaping configuration
    HostNetworkTrafficShapingPolicy policyInSpec = null;
    if(spec.getPolicy() != null)
      policyInSpec = spec.getPolicy().getShapingPolicy();
   
    if(policyInSpec != null && shapingPolicy == null || policyInSpec == null && shapingPolicy != null)
      return false;
   
    if(policyInSpec == null && shapingPolicy == null)
      return true;
   
    // so far policyInSpec and shapingPolicy should both not be null
    if(policyInSpec.getEnabled() == null || !policyInSpec.getEnabled().booleanValue())
      return false;
   
    if(policyInSpec.getAverageBandwidth() == null || policyInSpec.getAverageBandwidth().longValue() != shapingPolicy.getAverageBandwidth().longValue())
      return false;

    if(policyInSpec.getPeakBandwidth() == null || policyInSpec.getPeakBandwidth().longValue() != shapingPolicy.getPeakBandwidth().longValue())
      return false;

    if(policyInSpec.getBurstSize() == null || policyInSpec.getBurstSize().longValue() != shapingPolicy.getBurstSize().longValue())
      return false;
   
    return true;
  }
View Full Code Here

Examples of com.vmware.vim25.HostNetworkTrafficShapingPolicy

        assert (hostMo != null);

        String[] networks = vmMo.getNetworks();
        for (String networkName : networks) {
            HostPortGroupSpec portGroupSpec = hostMo.getHostPortGroupSpec(networkName);
            HostNetworkTrafficShapingPolicy shapingPolicy = null;
            if (portGroupSpec != null) {
                shapingPolicy = portGroupSpec.getPolicy().getShapingPolicy();
            }

            if (networkName.startsWith("cloud.private")) {
                String[] tokens = networkName.split("\\.");
                if (tokens.length == 3) {
                    Integer networkRateMbps = null;
                    if (shapingPolicy != null && shapingPolicy.getEnabled() != null && shapingPolicy.getEnabled().booleanValue()) {
                        networkRateMbps = (int) (shapingPolicy.getPeakBandwidth().longValue() / (1024 * 1024));
                    }
                    String vlanId = null;
                    if(!"untagged".equalsIgnoreCase(tokens[2]))
                        vlanId = tokens[2];

                    HypervisorHostHelper.prepareNetwork(this._privateNetworkVSwitchName, "cloud.private",
                        hostMo, vlanId, networkRateMbps, null, this._ops_timeout, false);
                } else {
                    s_logger.info("Skip suspecious cloud network " + networkName);
                }
            } else if (networkName.startsWith("cloud.public")) {
                String[] tokens = networkName.split("\\.");
                if (tokens.length == 3) {
                    Integer networkRateMbps = null;
                    if (shapingPolicy != null && shapingPolicy.getEnabled() != null && shapingPolicy.getEnabled().booleanValue()) {
                        networkRateMbps = (int) (shapingPolicy.getPeakBandwidth().longValue() / (1024 * 1024));
                    }
                    String vlanId = null;
                    if(!"untagged".equalsIgnoreCase(tokens[2]))
                        vlanId = tokens[2];

                    HypervisorHostHelper.prepareNetwork(this._publicNetworkVSwitchName, "cloud.public",
                        hostMo, vlanId, networkRateMbps, null, this._ops_timeout, false);
                } else {
                    s_logger.info("Skip suspecious cloud network " + networkName);
                }
            } else if (networkName.startsWith("cloud.guest")) {
                String[] tokens = networkName.split("\\.");
                if (tokens.length >= 3) {
                    Integer networkRateMbps = null;
                    if (shapingPolicy != null && shapingPolicy.getEnabled() != null && shapingPolicy.getEnabled().booleanValue()) {
                        networkRateMbps = (int) (shapingPolicy.getPeakBandwidth().longValue() / (1024 * 1024));
                    }

                    String vlanId = null;
                    if(!"untagged".equalsIgnoreCase(tokens[2]))
                        vlanId = tokens[2];
View Full Code Here

Examples of com.vmware.vim25.HostNetworkTrafficShapingPolicy

            secPolicy = new HostNetworkSecurityPolicy();
            secPolicy.setAllowPromiscuous(Boolean.TRUE);
            secPolicy.setForgedTransmits(Boolean.TRUE);
            secPolicy.setMacChanges(Boolean.TRUE);
        }
        HostNetworkTrafficShapingPolicy shapingPolicy = null;
        if(networkRateMbps != null && networkRateMbps.intValue() > 0) {
            shapingPolicy = new HostNetworkTrafficShapingPolicy();
            shapingPolicy.setEnabled(true);
            shapingPolicy.setAverageBandwidth((long)networkRateMbps.intValue()*1024L*1024L);
       
            //
            // TODO : people may have different opinion on how to set the following
            //
           
            // give 50% premium to peek
            shapingPolicy.setPeakBandwidth((long)(shapingPolicy.getAverageBandwidth()*1.5));

            // allow 5 seconds of burst transfer
            shapingPolicy.setBurstSize(5*shapingPolicy.getAverageBandwidth()/8);
        }

        boolean bWaitPortGroupReady = false;
        if (!hostMo.hasPortGroup(vSwitch, networkName)) {
            hostMo.createPortGroup(vSwitch, networkName, vid, secPolicy, shapingPolicy);
View Full Code Here

Examples of com.vmware.vim25.HostNetworkTrafficShapingPolicy

      if(spec.getVlanId() != 0)
        return false;
    }

    // check traffic shaping configuration
    HostNetworkTrafficShapingPolicy policyInSpec = null;
    if(spec.getPolicy() != null)
      policyInSpec = spec.getPolicy().getShapingPolicy();
   
    if(policyInSpec != null && shapingPolicy == null || policyInSpec == null && shapingPolicy != null)
      return false;
   
    if(policyInSpec == null && shapingPolicy == null)
      return true;
   
    // so far policyInSpec and shapingPolicy should both not be null
    if(policyInSpec.getEnabled() == null || !policyInSpec.getEnabled().booleanValue())
      return false;
   
    if(policyInSpec.getAverageBandwidth() == null || policyInSpec.getAverageBandwidth().longValue() != shapingPolicy.getAverageBandwidth().longValue())
      return false;

    if(policyInSpec.getPeakBandwidth() == null || policyInSpec.getPeakBandwidth().longValue() != shapingPolicy.getPeakBandwidth().longValue())
      return false;

    if(policyInSpec.getBurstSize() == null || policyInSpec.getBurstSize().longValue() != shapingPolicy.getBurstSize().longValue())
      return false;
   
    return true;
  }
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.