weizhouapache commented on a change in pull request #4582:
URL: https://github.com/apache/cloudstack/pull/4582#discussion_r560006121
##########
File path:
engine/schema/src/main/java/com/cloud/upgrade/DatabaseUpgradeChecker.java
##########
@@ -237,6 +238,32 @@ protected void upgrade(CloudStackVersion dbVersion,
CloudStackVersion currentVer
final DbUpgrade[] upgrades = calculateUpgradePath(dbVersion,
currentVersion);
+ 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:
@DaanHoogland yes, done
----------------------------------------------------------------
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]