backport: default system vm template update implementation (#12935)

Fixes #12934

Backported from 889fc62

Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
This commit is contained in:
Abhishek Kumar 2026-04-01 15:34:04 +05:30 committed by GitHub
parent d38c1f8d12
commit e2497cfc4d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 15 additions and 5 deletions

View File

@ -17,9 +17,23 @@
package com.cloud.upgrade.dao;
import com.cloud.upgrade.SystemVmTemplateRegistration;
import com.cloud.utils.exception.CloudRuntimeException;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.sql.Connection;
public interface DbUpgradeSystemVmTemplate {
void updateSystemVmTemplates(Connection conn);
default void updateSystemVmTemplates(Connection conn) {
Logger logger = LogManager.getLogger(getClass());
logger.debug("Updating System Vm template IDs");
try {
SystemVmTemplateRegistration systemVmTemplateRegistration = new SystemVmTemplateRegistration("");
systemVmTemplateRegistration.updateSystemVmTemplates(conn);
} catch (Exception e) {
throw new CloudRuntimeException("Failed to find / register SystemVM template(s)");
}
}
}

View File

@ -57,8 +57,4 @@ public class Upgrade42020to42030 extends DbUpgradeAbstractImpl implements DbUpgr
public InputStream[] getCleanupScripts() {
return null;
}
@Override
public void updateSystemVmTemplates(Connection conn) {
}
}