Skip to content

Commit 310e990

Browse files
committed
CLOUDSTACK-1380: add db upgrade for vm_template, in 4.1 to 4.2 upgrade procedure
1 parent c30da35 commit 310e990

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

‎server/src/com/cloud/upgrade/dao/Upgrade410to420.java‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,20 @@ public File[] getPrepareScripts() {
5959

6060
@Override
6161
public void performDataMigration(Connection conn) {
62+
PreparedStatement sql = null;
63+
try {
64+
sql = conn.prepareStatement("update vm_template set image_data_store_id = 1 where type = 'SYSTEM' or type = 'BUILTIN'");
65+
sql.executeUpdate();
66+
} catch (SQLException e) {
67+
throw new CloudRuntimeException("Failed to upgrade vm template data store uuid: " + e.toString());
68+
} finally {
69+
if (sql != null) {
70+
try {
71+
sql.close();
72+
} catch (SQLException e) {
73+
}
74+
}
75+
}
6276
}
6377

6478
@Override

0 commit comments

Comments
 (0)