Skip to content

Commit e2497cf

Browse files
authored
backport: default system vm template update implementation (#12935)
Fixes #12934 Backported from 889fc62 Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
1 parent d38c1f8 commit e2497cf

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

engine/schema/src/main/java/com/cloud/upgrade/dao/DbUpgradeSystemVmTemplate.java

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,23 @@
1717

1818
package com.cloud.upgrade.dao;
1919

20+
import com.cloud.upgrade.SystemVmTemplateRegistration;
21+
import com.cloud.utils.exception.CloudRuntimeException;
22+
import org.apache.logging.log4j.LogManager;
23+
import org.apache.logging.log4j.Logger;
24+
2025
import java.sql.Connection;
2126

2227
public interface DbUpgradeSystemVmTemplate {
2328

24-
void updateSystemVmTemplates(Connection conn);
29+
default void updateSystemVmTemplates(Connection conn) {
30+
Logger logger = LogManager.getLogger(getClass());
31+
logger.debug("Updating System Vm template IDs");
32+
try {
33+
SystemVmTemplateRegistration systemVmTemplateRegistration = new SystemVmTemplateRegistration("");
34+
systemVmTemplateRegistration.updateSystemVmTemplates(conn);
35+
} catch (Exception e) {
36+
throw new CloudRuntimeException("Failed to find / register SystemVM template(s)");
37+
}
38+
}
2539
}

engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade42020to42030.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,4 @@ public void performDataMigration(Connection conn) {
5757
public InputStream[] getCleanupScripts() {
5858
return null;
5959
}
60-
61-
@Override
62-
public void updateSystemVmTemplates(Connection conn) {
63-
}
6460
}

0 commit comments

Comments
 (0)