DaanHoogland commented on a change in pull request #5875:
URL: https://github.com/apache/cloudstack/pull/5875#discussion_r792746289
##########
File path:
plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/DirectVifDriver.java
##########
@@ -47,12 +47,7 @@
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 (nic.getType() == Networks.TrafficType.Guest || nic.getType() ==
Networks.TrafficType.Public) {
Review comment:
I would considder
```suggestion
if (Sets.newHashSet(Networks.TrafficType.Guest,
Networks.TrafficType.Public).contains(nic.getType()) {
```
but I don't think it is an improvement with only two elements to check. Like
the pattern for larger sets, but At only two elements it doesn't make it more
readable, certainily not with the separate construction above the condition.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]