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.
This commit is contained in:
Prachi Damle 2013-08-29 14:33:36 -07:00
parent ca0679951e
commit 0b9b36cbca
2 changed files with 10 additions and 1 deletions

View File

@ -392,6 +392,15 @@ public class Upgrade410to420 implements DbUpgrade {
if (rs2.next()) {
affinityGroupId = rs2.getLong(1);
}
// add the domain map
String sqlMap = "INSERT INTO `cloud`.`affinity_group_domain_map` (`domain_id`, `affinity_group_id`) VALUES (?, ?)";
pstmtUpdate = conn.prepareStatement(sqlMap);
pstmtUpdate.setLong(1, domainId);
pstmtUpdate.setLong(2, affinityGroupId);
pstmtUpdate.executeUpdate();
pstmtUpdate.close();
}
rs2.close();

View File

@ -440,7 +440,7 @@ CREATE TABLE `cloud`.`affinity_group_domain_map` (
`id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
`domain_id` bigint unsigned NOT NULL COMMENT 'domain id',
`affinity_group_id` bigint unsigned NOT NULL COMMENT 'affinity group id',
`subdomain_access` int(1) unsigned COMMENT '1 if affinity group can be accessible from the subdomain',
`subdomain_access` int(1) unsigned DEFAULT 1 COMMENT '1 if affinity group can be accessible from the subdomain',
PRIMARY KEY (`id`),
CONSTRAINT `fk_affinity_group_domain_map__domain_id` FOREIGN KEY (`domain_id`) REFERENCES `domain`(`id`) ON DELETE CASCADE,
CONSTRAINT `fk_affinity_group_domain_map__affinity_group_id` FOREIGN KEY (`affinity_group_id`) REFERENCES `affinity_group`(`id`) ON DELETE CASCADE