Skip to content

Commit 0b9b36c

Browse files
author
Prachi Damle
committed
CLOUDSTACK-4561: DeployVm failed after upgrading from earlier version having a private zone to 4.2
Changes: - In the upgrade path, for a private zone, entry needs to be added in the affinity_group_domain_map to provide access to the private zone for the domains it belongs too.
1 parent ca06799 commit 0b9b36c

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

‎engine/schema/src/com/cloud/upgrade/dao/Upgrade410to420.java‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,15 @@ private void movePrivateZoneToDedicatedResource(Connection conn) {
392392
if (rs2.next()) {
393393
affinityGroupId = rs2.getLong(1);
394394
}
395+
396+
// add the domain map
397+
String sqlMap = "INSERT INTO `cloud`.`affinity_group_domain_map` (`domain_id`, `affinity_group_id`) VALUES (?, ?)";
398+
pstmtUpdate = conn.prepareStatement(sqlMap);
399+
pstmtUpdate.setLong(1, domainId);
400+
pstmtUpdate.setLong(2, affinityGroupId);
401+
pstmtUpdate.executeUpdate();
402+
pstmtUpdate.close();
403+
395404
}
396405

397406
rs2.close();

‎setup/db/db/schema-410to420.sql‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@ CREATE TABLE `cloud`.`affinity_group_domain_map` (
440440
`id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
441441
`domain_id` bigint unsigned NOT NULL COMMENT 'domain id',
442442
`affinity_group_id` bigint unsigned NOT NULL COMMENT 'affinity group id',
443-
`subdomain_access` int(1) unsigned COMMENT '1 if affinity group can be accessible from the subdomain',
443+
`subdomain_access` int(1) unsigned DEFAULT 1 COMMENT '1 if affinity group can be accessible from the subdomain',
444444
PRIMARY KEY (`id`),
445445
CONSTRAINT `fk_affinity_group_domain_map__domain_id` FOREIGN KEY (`domain_id`) REFERENCES `domain`(`id`) ON DELETE CASCADE,
446446
CONSTRAINT `fk_affinity_group_domain_map__affinity_group_id` FOREIGN KEY (`affinity_group_id`) REFERENCES `affinity_group`(`id`) ON DELETE CASCADE

0 commit comments

Comments
 (0)