sureshanaparti commented on a change in pull request #4561:
URL: https://github.com/apache/cloudstack/pull/4561#discussion_r566692617



##########
File path: 
engine/orchestration/src/main/java/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java
##########
@@ -1187,6 +1202,86 @@ boolean isNetworkImplemented(final NetworkVO network) {
         return implemented;
     }
 
+    /**
+     *
+     * Creates a dummy NicTO object which is used by the respective 
hypervisors to setup network elements / resources
+     * - bridges(KVM), VLANs(Xen) and portgroups(VMWare) for L2 network
+     */
+    private NicTO createNicTOFromNetworkAndOffering(NetworkVO networkVO, 
NetworkOfferingVO networkOfferingVO, HostVO hostVO) {
+        NicTO to = new NicTO();
+        to.setName(_networkModel.getNetworkTag(hostVO.getHypervisorType(), 
networkVO));
+        to.setBroadcastType(networkVO.getBroadcastDomainType());
+        to.setType(networkVO.getTrafficType());
+        to.setBroadcastUri(networkVO.getBroadcastUri());
+        to.setIsolationuri(networkVO.getBroadcastUri());
+        
to.setNetworkRateMbps(_configMgr.getNetworkOfferingNetworkRate(networkOfferingVO.getId(),
 networkVO.getDataCenterId()));
+        
to.setSecurityGroupEnabled(_networkModel.isSecurityGroupSupportedInNetwork(networkVO));
+        return to;
+    }
+
+    private Pair<Boolean, NicTO> isNtwConfiguredInCluster(HostVO hostVO, 
Map<Long, List<Long>> clusterToHostsMap, NetworkVO networkVO, NetworkOfferingVO 
networkOfferingVO) {
+        Long clusterId = hostVO.getClusterId();
+        List<Long> hosts = clusterToHostsMap.get(clusterId);
+        if (hosts == null) {
+            hosts = new ArrayList<>();
+        }
+        if (hostVO.getHypervisorType() == HypervisorType.KVM || 
hostVO.getHypervisorType() == HypervisorType.XenServer ) {
+            hosts.add(hostVO.getId());
+            clusterToHostsMap.put(clusterId, hosts);
+            return new Pair<>(false, 
createNicTOFromNetworkAndOffering(networkVO, networkOfferingVO, hostVO));
+        }
+        if (hosts != null && !hosts.isEmpty()) {
+            return new Pair<>(true, 
createNicTOFromNetworkAndOffering(networkVO, networkOfferingVO, hostVO));
+        }
+        hosts.add(hostVO.getId());
+        clusterToHostsMap.put(clusterId, hosts);
+        return new Pair<>(false, createNicTOFromNetworkAndOffering(networkVO, 
networkOfferingVO, hostVO));
+    }
+
+    private void setupPersistentNetwork(NetworkVO network, NetworkOfferingVO 
offering, Long dcId) throws AgentUnavailableException, 
OperationTimedoutException {
+        List<ClusterVO> clusterVOS = clusterDao.listClustersByDcId(dcId);

Review comment:
       ```suggestion
           List<ClusterVO> clusterVOs = clusterDao.listClustersByDcId(dcId);
   ```




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

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to