nvazquez commented on code in PR #14851:
URL: https://github.com/apache/cloudstack/pull/14851#discussion_r4700720908
##########
engine/schema/src/main/resources/META-INF/db/schema-42300to2400.sql:
##########
@@ -32,6 +47,37 @@ UPDATE op_dc_vnet_alloc a
a.taken = NULL
WHERE n.removed IS NOT NULL;
+-- Scope routed network/VPC subnets to a zone, so that the same CIDR can be
used in more than one zone. See #14419.
+CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.ip4_guest_subnet_network_map',
'data_center_id', 'bigint unsigned DEFAULT NULL COMMENT "zone it belongs to"');
+
+UPDATE `cloud`.`ip4_guest_subnet_network_map` m
+ JOIN `cloud`.`dc_ip4_guest_subnets` p ON p.id = m.parent_id
+ SET m.data_center_id = p.data_center_id
+WHERE m.data_center_id IS NULL;
+
+UPDATE `cloud`.`ip4_guest_subnet_network_map` m
+ JOIN `cloud`.`vpc` v ON v.id = m.vpc_id
+ SET m.data_center_id = v.zone_id
+WHERE m.data_center_id IS NULL;
+
+UPDATE `cloud`.`ip4_guest_subnet_network_map` m
+ JOIN `cloud`.`networks` n ON n.id = m.network_id
+ SET m.data_center_id = n.data_center_id
+WHERE m.data_center_id IS NULL;
+
+CALL
`cloud`.`IDEMPOTENT_DROP_FOREIGN_KEY`('cloud.ip4_guest_subnet_network_map',
'fk_ip4_guest_subnet_network_map__data_center_id');
+CALL
`cloud`.`IDEMPOTENT_ADD_FOREIGN_KEY`('cloud.ip4_guest_subnet_network_map',
'fk_ip4_guest_subnet_network_map__data_center_id', '(`data_center_id`)',
'`data_center`(`id`)');
+
+--- Add existing cross zone templates to the missing edge zones
+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);
+------------------------------------------------------------------------------------------------
Review Comment:
Not applying, this is being added by PR:
https://github.com/apache/cloudstack/pull/14679
--
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]