You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by mc...@apache.org on 2013/02/25 21:46:46 UTC

[43/50] [abbrv] git commit: refs/heads/vim51_win8 - CLOUDSTACK-1380: add db upgrade for vm_template, in 4.1 to 4.2 upgrade procedure

CLOUDSTACK-1380: add db upgrade for vm_template, in 4.1 to 4.2 upgrade procedure


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

Branch: refs/heads/vim51_win8
Commit: 310e99087ff8f46ac903f2a28169f3ffe2d13ebd
Parents: c30da35
Author: Edison Su <su...@gmail.com>
Authored: Mon Feb 25 10:45:04 2013 -0800
Committer: Edison Su <su...@gmail.com>
Committed: Mon Feb 25 10:45:04 2013 -0800

----------------------------------------------------------------------
 .../src/com/cloud/upgrade/dao/Upgrade410to420.java |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/310e9908/server/src/com/cloud/upgrade/dao/Upgrade410to420.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/upgrade/dao/Upgrade410to420.java b/server/src/com/cloud/upgrade/dao/Upgrade410to420.java
index a059257..9000e15 100644
--- a/server/src/com/cloud/upgrade/dao/Upgrade410to420.java
+++ b/server/src/com/cloud/upgrade/dao/Upgrade410to420.java
@@ -59,6 +59,20 @@ public class Upgrade410to420 implements DbUpgrade {
 
 	@Override
 	public void performDataMigration(Connection conn) {
+	    PreparedStatement sql = null;
+	    try {
+	        sql = conn.prepareStatement("update vm_template set image_data_store_id = 1 where type = 'SYSTEM' or type = 'BUILTIN'");
+	        sql.executeUpdate();
+        } catch (SQLException e) {
+            throw new CloudRuntimeException("Failed to upgrade vm template data store uuid: " + e.toString());
+        } finally {
+            if (sql != null) {
+                try {
+                    sql.close();
+                } catch (SQLException e) {
+                }
+            }
+        }
 	}
 
 	@Override