mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
cleanup: Network Throttling for Additional Networks code in DirectVifDriver.java (#5875)
This commit is contained in:
parent
b275c29709
commit
143b72d67e
@ -19,6 +19,7 @@
|
||||
|
||||
package com.cloud.hypervisor.kvm.resource;
|
||||
|
||||
import org.apache.commons.compress.utils.Sets;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.libvirt.LibvirtException;
|
||||
|
||||
@ -47,12 +48,8 @@ public class DirectVifDriver extends VifDriverBase {
|
||||
public LibvirtVMDef.InterfaceDef plug(NicTO nic, String guestOsType, String nicAdapter, Map<String, String> extraConfig) throws InternalErrorException, LibvirtException {
|
||||
LibvirtVMDef.InterfaceDef intf = new LibvirtVMDef.InterfaceDef();
|
||||
|
||||
if (nic.getType() == Networks.TrafficType.Guest) {
|
||||
Integer networkRateKBps = (nic.getNetworkRateMbps() != null && nic.getNetworkRateMbps().intValue() != -1) ? nic.getNetworkRateMbps().intValue() * 128 : 0;
|
||||
intf.defDirectNet(_libvirtComputingResource.getNetworkDirectDevice(), null, nic.getMac(), getGuestNicModel(guestOsType, nicAdapter),
|
||||
_libvirtComputingResource.getNetworkDirectSourceMode(), networkRateKBps);
|
||||
|
||||
} else if (nic.getType() == Networks.TrafficType.Public) {
|
||||
if (Sets.newHashSet(Networks.TrafficType.Guest,
|
||||
Networks.TrafficType.Public).contains(nic.getType())) {
|
||||
Integer networkRateKBps = (nic.getNetworkRateMbps() != null && nic.getNetworkRateMbps().intValue() != -1) ? nic.getNetworkRateMbps().intValue() * 128 : 0;
|
||||
intf.defDirectNet(_libvirtComputingResource.getNetworkDirectDevice(), null, nic.getMac(), getGuestNicModel(guestOsType, nicAdapter),
|
||||
_libvirtComputingResource.getNetworkDirectSourceMode(), networkRateKBps);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user