rafaelweingartner commented on a change in pull request #3007: Add missing 
ConfigDrive entries on existing zones after upgrade
URL: https://github.com/apache/cloudstack/pull/3007#discussion_r231508606
 
 

 ##########
 File path: server/src/com/cloud/network/NetworkServiceImpl.java
 ##########
 @@ -623,11 +624,42 @@ public boolean configure(final String name, final 
Map<String, Object> params) th
 
         _allowSubdomainNetworkAccess = 
Boolean.valueOf(_configs.get(Config.SubDomainNetworkAccess.key()));
 
+        verifyConfigDriveEntriesOnZones();
+
         s_logger.info("Network Service is configured.");
 
         return true;
     }
 
+    /**
+     * Verifies ConfigDrive entries on a zone. Adds Diabled ConfigDrive 
provider if missing
+     */
+    private void checkConfigDriveEntriesOnZone(DataCenterVO zone) {
+        if (zone.getNetworkType() == NetworkType.Advanced) {
+            List<PhysicalNetworkVO> physicalNetworks = 
_physicalNetworkDao.listByZoneAndTrafficType(
+                    zone.getId(), TrafficType.Guest);
+            for (PhysicalNetworkVO physicalNetworkVO : physicalNetworks) {
+                PhysicalNetworkServiceProviderVO provider = 
_pNSPDao.findByServiceProvider(
+                        physicalNetworkVO.getId(), 
Provider.ConfigDrive.getName());
+                if (provider == null) {
+                    addConfigDriveToPhysicalNetwork(physicalNetworkVO.getId());
+                }
+            }
+        }
+    }
+
+    /**
+     * Verifies ConfigDrive entries on enabled zones. Adds Diabled ConfigDrive 
provider if missing.
+     */
+    private void verifyConfigDriveEntriesOnZones() {
 
 Review comment:
   What about some test cases here as well?

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