rafaelweingartner commented on a change in pull request #2293: 
CLOUDSTACK-10047: DVSwitch fixes and improvements
URL: https://github.com/apache/cloudstack/pull/2293#discussion_r144250258
 
 

 ##########
 File path: server/src/com/cloud/hypervisor/HypervisorGuruBase.java
 ##########
 @@ -138,7 +143,24 @@ protected VirtualMachineTO 
toVirtualMachineTO(VirtualMachineProfile vmProfile) {
             if(vm.getType() == VirtualMachine.Type.NetScalerVm) {
                 nicProfile.setBroadcastType(BroadcastDomainType.Native);
             }
-            nics[i++] = toNicTO(nicProfile);
+            NicTO nicTo = toNicTO(nicProfile);
+            final NetworkVO network = 
_networkDao.findByUuid(nicTo.getNetworkUuid());
+            if (network != null) {
+                final Map<NetworkOffering.Detail, String> details = 
networkOfferingDetailsDao.getNtwkOffDetails(network.getNetworkOfferingId());
+                if (details != null) {
 
 Review comment:
   You are right about the details, but I think I clicked on the wrong line 
(sorry for the mistake). I was talking about the ` if (network != null) ` 
check. if ` if (network == null)` you do not do anything, then it is the same 
as using a continue. I mean, you do a `nics[i++] = nicTo;`, but that can go 
inside the condition as well. Duplicated lines are not that great, so let's see 
what else could be done...
   
   We can do something else, we could extract lines 149-160 to a method; this 
would improve the readability of the code and enable unit tests and Java docs.
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to