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

This commit is contained in:
Edison Su 2013-02-25 10:45:04 -08:00
parent c30da35811
commit 310e99087f
1 changed files with 14 additions and 0 deletions

View File

@ -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