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.


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/6a8043e0
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/6a8043e0
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/6a8043e0

Branch: refs/heads/master
Commit: 6a8043e040c5bc1d5b2eb75a11f8b335dfd518cb
Parents: 6a0bda0
Author: Prachi Damle <[email protected]>
Authored: Thu Aug 29 14:33:36 2013 -0700
Committer: Prachi Damle <[email protected]>
Committed: Tue Sep 3 20:03:01 2013 -0700

----------------------------------------------------------------------
 .../schema/src/com/cloud/upgrade/dao/Upgrade410to420.java   | 9 +++++++++
 setup/db/db/schema-410to420.sql                             | 2 +-
 2 files changed, 10 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6a8043e0/engine/schema/src/com/cloud/upgrade/dao/Upgrade410to420.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/upgrade/dao/Upgrade410to420.java 
b/engine/schema/src/com/cloud/upgrade/dao/Upgrade410to420.java
index e9aa043..c1db30e 100755
--- a/engine/schema/src/com/cloud/upgrade/dao/Upgrade410to420.java
+++ b/engine/schema/src/com/cloud/upgrade/dao/Upgrade410to420.java
@@ -329,6 +329,15 @@ public class Upgrade410to420 implements DbUpgrade {
                         affinityGroupId = rs2.getLong(1);
                         dedicateZone(conn, zoneId, domainId, affinityGroupId);
                     }
+
+                    // 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();
                 pstmt2.close();

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6a8043e0/setup/db/db/schema-410to420.sql
----------------------------------------------------------------------
diff --git a/setup/db/db/schema-410to420.sql b/setup/db/db/schema-410to420.sql
index 0180e50..b459832 100644
--- a/setup/db/db/schema-410to420.sql
+++ b/setup/db/db/schema-410to420.sql
@@ -432,7 +432,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

Reply via email to