|
19 | 19 |
|
20 | 20 | package com.cloud.hypervisor.kvm.resource; |
21 | 21 |
|
| 22 | +import org.apache.commons.compress.utils.Sets; |
22 | 23 | import org.apache.log4j.Logger; |
23 | 24 | import org.libvirt.LibvirtException; |
24 | 25 |
|
@@ -47,12 +48,8 @@ public class DirectVifDriver extends VifDriverBase { |
47 | 48 | public LibvirtVMDef.InterfaceDef plug(NicTO nic, String guestOsType, String nicAdapter, Map<String, String> extraConfig) throws InternalErrorException, LibvirtException { |
48 | 49 | LibvirtVMDef.InterfaceDef intf = new LibvirtVMDef.InterfaceDef(); |
49 | 50 |
|
50 | | - if (nic.getType() == Networks.TrafficType.Guest) { |
51 | | - Integer networkRateKBps = (nic.getNetworkRateMbps() != null && nic.getNetworkRateMbps().intValue() != -1) ? nic.getNetworkRateMbps().intValue() * 128 : 0; |
52 | | - intf.defDirectNet(_libvirtComputingResource.getNetworkDirectDevice(), null, nic.getMac(), getGuestNicModel(guestOsType, nicAdapter), |
53 | | - _libvirtComputingResource.getNetworkDirectSourceMode(), networkRateKBps); |
54 | | - |
55 | | - } else if (nic.getType() == Networks.TrafficType.Public) { |
| 51 | + if (Sets.newHashSet(Networks.TrafficType.Guest, |
| 52 | + Networks.TrafficType.Public).contains(nic.getType())) { |
56 | 53 | Integer networkRateKBps = (nic.getNetworkRateMbps() != null && nic.getNetworkRateMbps().intValue() != -1) ? nic.getNetworkRateMbps().intValue() * 128 : 0; |
57 | 54 | intf.defDirectNet(_libvirtComputingResource.getNetworkDirectDevice(), null, nic.getMac(), getGuestNicModel(guestOsType, nicAdapter), |
58 | 55 | _libvirtComputingResource.getNetworkDirectSourceMode(), networkRateKBps); |
|
0 commit comments