cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kis...@apache.org
Subject git commit: updated refs/heads/master to e55844c
Date Wed, 07 Aug 2013 13:21:07 GMT
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 <bharat.kumar@citrix.com>
Authored: Wed Aug 7 17:54:34 2013 +0530
Committer: Kishan Kavala <kishan@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


Mime
View raw message