You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by wi...@apache.org on 2013/02/26 15:14:12 UTC
[5/36] git commit: refs/heads/qemu-img - 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/qemu-img
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