Skip to content

Commit 6a8043e

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 6a0bda0 commit 6a8043e

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
@@ -329,6 +329,15 @@ private void movePrivateZoneToDedicatedResource(Connection conn) {
329329
affinityGroupId = rs2.getLong(1);
330330
dedicateZone(conn, zoneId, domainId, affinityGroupId);
331331
}
332+
333+
// add the domain map
334+
String sqlMap = "INSERT INTO `cloud`.`affinity_group_domain_map` (`domain_id`, `affinity_group_id`) VALUES (?, ?)";
335+
pstmtUpdate = conn.prepareStatement(sqlMap);
336+
pstmtUpdate.setLong(1, domainId);
337+
pstmtUpdate.setLong(2, affinityGroupId);
338+
pstmtUpdate.executeUpdate();
339+
pstmtUpdate.close();
340+
332341
}
333342
rs2.close();
334343
pstmt2.close();

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ CREATE TABLE `cloud`.`affinity_group_domain_map` (
432432
`id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
433433
`domain_id` bigint unsigned NOT NULL COMMENT 'domain id',
434434
`affinity_group_id` bigint unsigned NOT NULL COMMENT 'affinity group id',
435-
`subdomain_access` int(1) unsigned COMMENT '1 if affinity group can be accessible from the subdomain',
435+
`subdomain_access` int(1) unsigned DEFAULT 1 COMMENT '1 if affinity group can be accessible from the subdomain',
436436
PRIMARY KEY (`id`),
437437
CONSTRAINT `fk_affinity_group_domain_map__domain_id` FOREIGN KEY (`domain_id`) REFERENCES `domain`(`id`) ON DELETE CASCADE,
438438
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)