weizhouapache commented on a change in pull request #4582:
URL: https://github.com/apache/cloudstack/pull/4582#discussion_r568469930
##########
File path:
engine/schema/src/main/java/com/cloud/upgrade/DatabaseUpgradeChecker.java
##########
@@ -232,11 +233,41 @@ protected void runScript(Connection conn, InputStream
file) {
}
+ private void updateSystemVmTemplates(DbUpgrade[] upgrades) {
+ for (int i = upgrades.length - 1; i >= 0; i--) {
+ DbUpgrade upgrade = upgrades[i];
+ if (upgrade instanceof DbUpgradeSystemVmTemplate) {
+ TransactionLegacy txn = TransactionLegacy.open("Upgrade");
+ txn.start();
+ try {
+ Connection conn;
+ try {
+ conn = txn.getConnection();
+ } catch (SQLException e) {
+ String errorMessage = "Unable to upgrade the database";
+ s_logger.error(errorMessage, e);
+ throw new CloudRuntimeException(errorMessage, e);
+ }
+
((DbUpgradeSystemVmTemplate)upgrade).updateSystemVmTemplates(conn);
+ break;
+ } catch (CloudRuntimeException e) {
+ String errorMessage = "Unable to upgrade the database";
+ s_logger.error(errorMessage, e);
+ throw new CloudRuntimeException(errorMessage, e);
+ } finally {
+ txn.close();
Review comment:
@Pearl1594 yeah, you are right !
pushed a change.
thanks for review and testing.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]