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/4.2 to 95f3679
Date Wed, 07 Aug 2013 13:15:20 GMT
Updated Branches:
  refs/heads/4.2 5dd155d02 -> 95f367985


Cloudstack-4100 preserve data in iso_id column while upgrading from 3.0.7 to 4.2


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

Branch: refs/heads/4.2
Commit: 95f36798559c71d1de9f34fedad597d12f09766b
Parents: 5dd155d
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:36:58 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/95f36798/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 0941408..5a6c5b0 100644
--- a/engine/schema/src/com/cloud/upgrade/dao/Upgrade410to420.java
+++ b/engine/schema/src/com/cloud/upgrade/dao/Upgrade410to420.java
@@ -102,6 +102,7 @@ public class Upgrade410to420 implements DbUpgrade {
         fixNiciraKeys(conn);
         fixRouterKeys(conn);
         updateConcurrentConnectionsInNetworkOfferings(conn);
+        migrateDatafromIsoIdInVolumesTable(conn);
     }
 
     private void fixBaremetalForeignKeys(Connection conn) {
@@ -2075,4 +2076,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/95f36798/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