erikbocks commented on code in PR #14378:
URL: https://github.com/apache/cloudstack/pull/14378#discussion_r4739453862


##########
engine/orchestration/src/main/java/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java:
##########
@@ -2263,6 +2264,37 @@ public void doInTransactionWithoutResult(final 
TransactionStatus status) {
         });
     }
 
+    private void setGuestNetworkVrNicMultiqueueNumber(Pair<NetworkVO, VpcVO> 
networks, NetworkVO implementedNetwork, NicProfile nicProfile) {
+        if (networks == null) {
+            logger.debug("Skipping the assignment of multiqueue for VR because 
it is not related with any network.");
+            return;
+        }
+
+        VpcVO vpcVO = networks.second();
+        boolean isVpcVr = vpcVO != null;
+        if (isVpcVr) {
+            logger.trace("The multiqueue number for NICs of VPCs VRs is not 
defined at this step, skipping it.");
+            return;
+        }
+
+        if (implementedNetwork.getTrafficType() == TrafficType.Control) {
+            logger.trace("The multiqueue number is not applied for NICs of 
control networks, skipping it.");
+            return;
+        }
+
+        Network guestNetwork = networks.first();
+        NetworkOffering networkOffering = 
_entityMgr.findByIdIncludingRemoved(NetworkOfferingVO.class, 
guestNetwork.getNetworkOfferingId());
+        Integer offeringMultiqueueNumber = implementedNetwork.getTrafficType() 
== TrafficType.Public ? networkOffering.getPublicMultiqueueNumber() : 
networkOffering.getPrivateMultiqueueNumber();
+        Integer multiqueueNumber = 
NetworkOrchestrationService.getRouterNicMultiqueueNumber(offeringMultiqueueNumber);
+        if (multiqueueNumber == null) {
+            logger.debug("Multiqueue for NIC [{}] will not be defined because 
neither the network offering nor the [{}] configuration define it.",
+                    nicProfile.getUuid(), RouterNicMultiqueueNumber.key());
+        } else {
+            logger.debug("Setting [{}] as the multiqueue for NIC [{}].", 
multiqueueNumber, nicProfile.getUuid());
+            nicProfile.setMultiqueueNumber(multiqueueNumber);
+        }

Review Comment:
   ```suggestion
           Integer multiqueueNumber = 
NetworkOrchestrationService.getRouterNicMultiqueueNumber(offeringMultiqueueNumber);
           if (multiqueueNumber == null) {
               logger.debug("Multiqueue for NIC [{}] will not be defined 
because neither the network offering nor the [{}] configuration define it.",
                       nicProfile.getUuid(), RouterNicMultiqueueNumber.key());
                       return;
           } 
   
           logger.debug("Setting [{}] as the multiqueue for NIC [{}].", 
multiqueueNumber, nicProfile.getUuid());
           nicProfile.setMultiqueueNumber(multiqueueNumber);
   ```
   
   Just a minor nit here, but I like to avoid else blocks. This suggestion is 
totally optional and can be ignored



-- 
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]

Reply via email to