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


##########
engine/orchestration/src/main/java/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java:
##########
@@ -1821,13 +1823,19 @@ protected boolean prepareElement(final NetworkElement 
element, final Network net
                 if (!sp.addDnsEntry(network, profile, vmProfile, dest, 
context)) {
                     return false;
                 }
+                buildConfigDrive = true;
             }
             if (_networkModel.areServicesSupportedInNetwork(network.getId(), 
Service.UserData)
                     && 
_networkModel.isProviderSupportServiceInNetwork(network.getId(), 
Service.UserData, element.getProvider()) && element instanceof 
UserDataServiceProvider) {
                 final UserDataServiceProvider sp = (UserDataServiceProvider) 
element;
                 if (!sp.addPasswordAndUserdata(network, profile, vmProfile, 
dest, context)) {
                     return false;
                 }
+                buildConfigDrive = true;
+            }
+            if (buildConfigDrive && element instanceof 
ConfigDriveNetworkElement) {

Review Comment:
   We execute `prepareElement` for all network elements.
   If we want to remove `buildConfigDrive`, this check will become something 
like this:
   ```java
   if ((_networkModel.areServicesSupportedInNetwork(network.getId(), 
Service.UserData)
                       && 
_networkModel.isProviderSupportServiceInNetwork(network.getId(), 
Service.UserData, element.getProvider()
   || _networkModel.areServicesSupportedInNetwork(network.getId(), Service.Dns)
                       && 
_networkModel.isProviderSupportServiceInNetwork(network.getId(), Service.Dns, 
element.getProvider()) && element instanceof DnsServiceProvider
   || _networkModel.areServicesSupportedInNetwork(network.getId(), Service.Dhcp)
                       && 
_networkModel.isProviderSupportServiceInNetwork(network.getId(), Service.Dhcp, 
element.getProvider())) || element instanceof ConfigDriveNetworkElement) {
   
   ```



-- 
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: commits-unsubscr...@cloudstack.apache.org

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

Reply via email to