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


##########
server/src/main/java/com/cloud/configuration/ConfigurationManagerImpl.java:
##########
@@ -3157,6 +3160,12 @@ public DataCenterVO doInTransaction(final 
TransactionStatus status) {
                 // Create default system networks
                 createDefaultSystemNetworks(zone.getId());
 
+                // Associate cross zone templates with the Edge Zones here 
because they don't have SSVMs
+                // For Core zones, this happens when the SSVM starts up.
+                if (isEdge) {
+                    
_templateService.associateCrossZoneTemplatesToZone(zone.getId());

Review Comment:
   the existing templates stay broken on existing zones after this change as 
well. we need to run the below SQL for fixing (need to verify once)
   ```sql
   INSERT INTO cloud.template_zone_ref (zone_id, template_id, created, 
last_updated)
   SELECT dc.id, vt.id, NOW(), NOW()
   FROM cloud.data_center dc
   JOIN cloud.vm_template vt ON vt.cross_zones = 1 AND vt.removed IS NULL
   WHERE dc.type = 'Edge' AND dc.removed IS NULL
     AND NOT EXISTS (SELECT 1 FROM cloud.template_zone_ref tzr
                     WHERE tzr.zone_id = dc.id AND tzr.template_id = vt.id AND 
tzr.removed IS NULL);
   ```



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