diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/BridgeVifDriver.java b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/BridgeVifDriver.java index 3b034bb6409..b6814bad9c9 100644 --- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/BridgeVifDriver.java +++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/BridgeVifDriver.java @@ -46,6 +46,7 @@ public class BridgeVifDriver extends VifDriverBase { private String _modifyVlanPath; private String _modifyVxlanPath; private String bridgeNameSchema; + private Long libvirtVersion; @Override public void configure(Map params) throws ConfigurationException { @@ -74,6 +75,11 @@ public class BridgeVifDriver extends VifDriverBase { throw new ConfigurationException("Unable to find modifyvxlan.sh"); } + libvirtVersion = (Long) params.get("libvirtVersion"); + if (libvirtVersion == null) { + libvirtVersion = 0L; + } + try { createControlNetwork(); } catch (LibvirtException e) { @@ -102,8 +108,12 @@ public class BridgeVifDriver extends VifDriverBase { throw new InternalErrorException("Nicira NVP Logicalswitches are not supported by the BridgeVifDriver"); } String trafficLabel = nic.getName(); + Integer networkRateKBps = 0; + if (libvirtVersion > ((10 * 1000 + 10))) { + networkRateKBps = (nic.getNetworkRateMbps() != null && nic.getNetworkRateMbps().intValue() != -1) ? nic.getNetworkRateMbps().intValue() * 128 : 0; + } + if (nic.getType() == Networks.TrafficType.Guest) { - Integer networkRateKBps = (nic.getNetworkRateMbps() != null && nic.getNetworkRateMbps().intValue() != -1) ? nic.getNetworkRateMbps().intValue() * 128 : 0; if ((nic.getBroadcastType() == Networks.BroadcastDomainType.Vlan) && (vNetId != null) && (protocol != null) && (!vNetId.equalsIgnoreCase("untagged")) || (nic.getBroadcastType() == Networks.BroadcastDomainType.Vxlan)) { if (trafficLabel != null && !trafficLabel.isEmpty()) { @@ -122,7 +132,6 @@ public class BridgeVifDriver extends VifDriverBase { createControlNetwork(); intf.defBridgeNet(_bridges.get("linklocal"), null, nic.getMac(), getGuestNicModel(guestOsType, nicAdapter)); } else if (nic.getType() == Networks.TrafficType.Public) { - Integer networkRateKBps = (nic.getNetworkRateMbps() != null && nic.getNetworkRateMbps().intValue() != -1) ? nic.getNetworkRateMbps().intValue() * 128 : 0; if ((nic.getBroadcastType() == Networks.BroadcastDomainType.Vlan) && (vNetId != null) && (protocol != null) && (!vNetId.equalsIgnoreCase("untagged")) || (nic.getBroadcastType() == Networks.BroadcastDomainType.Vxlan)) { if (trafficLabel != null && !trafficLabel.isEmpty()) { diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java index d7b2af62409..9a4ae16cadb 100755 --- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java +++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java @@ -953,6 +953,7 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv params.put("libvirt.host.pifs", _pifs); params.put("libvirt.computing.resource", this); + params.put("libvirtVersion", _hypervisorLibvirtVersion); configureVifDrivers(params);