You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ki...@apache.org on 2013/08/07 15:21:07 UTC
git commit: updated refs/heads/master to e55844c
Updated Branches:
refs/heads/master 3de6cdb4f -> e55844c36
Cloudstack-4100 preserve data in iso_id column while upgrading from 3.0.7 to 4.2
Conflicts:
engine/schema/src/com/cloud/upgrade/dao/Upgrade410to420.java
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/e55844c3
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/e55844c3
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/e55844c3
Branch: refs/heads/master
Commit: e55844c364818d4b9c103a9be485e9351091a906
Parents: 3de6cdb
Author: Bharat Kumar <bh...@citrix.com>
Authored: Wed Aug 7 17:54:34 2013 +0530
Committer: Kishan Kavala <ki...@cloud.com>
Committed: Wed Aug 7 18:47:05 2013 +0530
----------------------------------------------------------------------
.../com/cloud/upgrade/dao/Upgrade410to420.java | 20 ++++++++++++++++++++
setup/db/db/schema-307to410.sql | 2 +-
2 files changed, 21 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e55844c3/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 b5da56b..3f3f3bf 100644
--- a/engine/schema/src/com/cloud/upgrade/dao/Upgrade410to420.java
+++ b/engine/schema/src/com/cloud/upgrade/dao/Upgrade410to420.java
@@ -104,6 +104,7 @@ public class Upgrade410to420 implements DbUpgrade {
fixNiciraKeys(conn);
fixRouterKeys(conn);
encryptSite2SitePSK(conn);
+ migrateDatafromIsoIdInVolumesTable(conn);
}
private void fixBaremetalForeignKeys(Connection conn) {
@@ -2115,4 +2116,23 @@ public class Upgrade410to420 implements DbUpgrade {
}
}
}
+
+ private void migrateDatafromIsoIdInVolumesTable(Connection conn) {
+ PreparedStatement pstmt = null;
+ ResultSet rs = null;
+
+ try {
+ pstmt = conn.prepareStatement("SELECT iso_id1 From `cloud`.`volumes`");
+ rs = pstmt.executeQuery();
+ if (rs.next()) {
+ pstmt = conn.prepareStatement("ALTER TABLE `cloud`.`volumes` DROP COLUMN `iso_id`");
+ pstmt.executeUpdate();
+ pstmt = conn.prepareStatement("ALTER TABLE `cloud`.`volumes` CHANGE COLUMN `iso_id1` `iso_id` bigint(20) unsigned COMMENT 'The id of the iso from which the volume was created'");
+ pstmt.executeUpdate();
+ }
+ }catch (SQLException e) {
+ //implies iso_id1 is not present, so do nothing.
+ }
+
+ }
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e55844c3/setup/db/db/schema-307to410.sql
----------------------------------------------------------------------
diff --git a/setup/db/db/schema-307to410.sql b/setup/db/db/schema-307to410.sql
index af296ab..d9815b6 100644
--- a/setup/db/db/schema-307to410.sql
+++ b/setup/db/db/schema-307to410.sql
@@ -1572,4 +1572,4 @@ ALTER TABLE `cloud_usage`.`usage_storage` CHANGE COLUMN `virtual_size` `virtual_
ALTER TABLE `cloud_usage`.`cloud_usage` CHANGE COLUMN `virtual_size` `virtual_size1` bigint unsigned;
ALTER TABLE `cloud`.`network_offerings` CHANGE COLUMN `concurrent_connections` `concurrent_connections1` int(10) unsigned COMMENT 'Load Balancer(haproxy) maximum number of concurrent connections(global max)';
-ALTER TABLE `cloud`.`volumes` DROP COLUMN `iso_id`;
\ No newline at end of file
+ALTER TABLE `cloud`.`volumes` CHANGE COLUMN `iso_id` `iso_id1` bigint(20) unsigned COMMENT 'The id of the iso from which the volume was created';
\ No newline at end of file