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;
|
package com.cloud.hypervisor.kvm.resource;
|
||||||
|
|
||||||
|
import org.apache.commons.compress.utils.Sets;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
import org.libvirt.LibvirtException;
|
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 {
|
public LibvirtVMDef.InterfaceDef plug(NicTO nic, String guestOsType, String nicAdapter, Map<String, String> extraConfig) throws InternalErrorException, LibvirtException {
|
||||||
LibvirtVMDef.InterfaceDef intf = new LibvirtVMDef.InterfaceDef();
|
LibvirtVMDef.InterfaceDef intf = new LibvirtVMDef.InterfaceDef();
|
||||||
|
|
||||||
if (nic.getType() == Networks.TrafficType.Guest) {
|
if (Sets.newHashSet(Networks.TrafficType.Guest,
|
||||||
Integer networkRateKBps = (nic.getNetworkRateMbps() != null && nic.getNetworkRateMbps().intValue() != -1) ? nic.getNetworkRateMbps().intValue() * 128 : 0;
|
Networks.TrafficType.Public).contains(nic.getType())) {
|
||||||
intf.defDirectNet(_libvirtComputingResource.getNetworkDirectDevice(), null, nic.getMac(), getGuestNicModel(guestOsType, nicAdapter),
|
|
||||||
_libvirtComputingResource.getNetworkDirectSourceMode(), networkRateKBps);
|
|
||||||
|
|
||||||
} else if (nic.getType() == Networks.TrafficType.Public) {
|
|
||||||
Integer networkRateKBps = (nic.getNetworkRateMbps() != null && nic.getNetworkRateMbps().intValue() != -1) ? nic.getNetworkRateMbps().intValue() * 128 : 0;
|
Integer networkRateKBps = (nic.getNetworkRateMbps() != null && nic.getNetworkRateMbps().intValue() != -1) ? nic.getNetworkRateMbps().intValue() * 128 : 0;
|
||||||
intf.defDirectNet(_libvirtComputingResource.getNetworkDirectDevice(), null, nic.getMac(), getGuestNicModel(guestOsType, nicAdapter),
|
intf.defDirectNet(_libvirtComputingResource.getNetworkDirectDevice(), null, nic.getMac(), getGuestNicModel(guestOsType, nicAdapter),
|
||||||
_libvirtComputingResource.getNetworkDirectSourceMode(), networkRateKBps);
|
_libvirtComputingResource.getNetworkDirectSourceMode(), networkRateKBps);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user