GutoVeronezi commented on a change in pull request #5875:
URL: https://github.com/apache/cloudstack/pull/5875#discussion_r792679604
##########
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:
@DaanHoogland, what I'm suggesting is:
```java
Set<Networks.TrafficType> anyName =
Sets.newHashSet(Networks.TrafficType.Guest, Networks.TrafficType.Public);
if (anyName.contains(nic.getType()) {
....
```
I normally suggest this type of change to show other ways of seeing things.
There are cases that we go on automatic and just add `OR` operators, making the
statement giant and less readable.
--
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]