Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ public DatabaseUpgradeChecker() {
.next("4.21.0.0", new Upgrade42100to42200())
.next("4.22.0.0", new Upgrade42200to42210())
.next("4.22.1.0", new Upgrade42210to42300())
.next("4.22.2.0", new Upgrade42300to2400())
.next("4.22.2.0", new Upgrade42210to42300())
.next("4.23.0.0", new Upgrade42300to2400())
.build();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ UPDATE `cloud`.`ip4_guest_subnet_network_map` m
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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,21 @@
-- Schema upgrade from 4.23.0.0 to 24.0.0
--;

------------------------------------------------------------------------------------------------
-- Including 4.22.2.0 schema changes
------------------------------------------------------------------------------------------------
-- Last backup usage metric published per VM and backup offering
CREATE TABLE IF NOT EXISTS `cloud`.`backup_usage_metric` (
`id` bigint unsigned NOT NULL auto_increment COMMENT 'id',
`vm_id` bigint unsigned NOT NULL COMMENT 'VM ID',
`backup_offering_id` bigint unsigned NOT NULL COMMENT 'Backup offering ID',
`size` bigint unsigned NOT NULL COMMENT 'Backup size last published',
`protected_size` bigint unsigned NOT NULL COMMENT 'Protected size last published',
`updated` datetime NOT NULL COMMENT 'Date the metric was last published',
PRIMARY KEY (`id`),
UNIQUE KEY `uk_backup_usage_metric__vm_id__backup_offering_id` (`vm_id`, `backup_offering_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- Widen the unique key on cloud_usage.usage_volume to include vm_id, so the cumulative and
-- per-VM volume usage records introduced in 4.22.1 can coexist. See #13399.
CALL `cloud_usage`.`IDEMPOTENT_DROP_INDEX`('id', 'cloud_usage.usage_volume');
Expand All @@ -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);
------------------------------------------------------------------------------------------------

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not applying, this is being added by PR: #14679


-- VMware CBT warm migration session state
CREATE TABLE IF NOT EXISTS `cloud`.`vmware_cbt_migration` (
`id` bigint unsigned NOT NULL auto_increment COMMENT 'id',
Expand Down
Loading