vishesh92 commented on code in PR #13032:
URL: https://github.com/apache/cloudstack/pull/13032#discussion_r3324205028


##########
server/src/main/java/com/cloud/network/NetworkModelImpl.java:
##########
@@ -1201,9 +1311,87 @@ public List<? extends Provider> 
listSupportedNetworkServiceProviders(String serv
             }
         }
 
+        // Also include extension-backed NetworkExtension providers.
+        // resolveProvider() creates a transient Provider (not added to the 
static list)
+        // for extension names that are not in the built-in registry.
+        try {
+            List<PhysicalNetworkServiceProviderVO> nsps = _pNSPDao.listAll();
+            if (CollectionUtils.isNotEmpty(nsps)) {
+                Set<String> extensionProviderNames = new HashSet<>();
+                List<Extension> extensions = 
extensionHelper.listExtensionsByType(Extension.Type.NetworkOrchestrator);
+                if (extensions != null) {
+                    for (Extension extension : extensions) {
+                        if (extension == null || 
StringUtils.isBlank(extension.getName())) {
+                            continue;
+                        }
+                        
extensionProviderNames.add(extension.getName().toLowerCase());
+                    }
+                }
+
+                if (!extensionProviderNames.isEmpty()) {
+                    // Avoid duplicate provider names across multiple physical 
networks.
+                    Set<String> addedExtProviders = new HashSet<>();
+                    for (PhysicalNetworkServiceProviderVO nsp : nsps) {
+                        String provName = nsp.getProviderName();
+                        if (StringUtils.isBlank(provName)) {
+                            continue;
+                        }
+
+                        if (addedExtProviders.contains(provName) || 
!extensionProviderNames.contains(provName)) {
+                            continue;
+                        }

Review Comment:
   @weizhouapache this seems valid.



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