make NoopDbUpgrade do a systemvm template check (#7564)

This commit is contained in:
dahn 2023-07-31 16:08:14 +02:00 committed by GitHub
parent fd13184dda
commit 2bb079189c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 16 additions and 1 deletions

View File

@ -444,10 +444,11 @@ public class DatabaseUpgradeChecker implements SystemIntegrityChecker {
}
@VisibleForTesting
protected static final class NoopDbUpgrade implements DbUpgrade {
protected static final class NoopDbUpgrade implements DbUpgrade, DbUpgradeSystemVmTemplate {
private final String upgradedVersion;
private final String[] upgradeRange;
private SystemVmTemplateRegistration systemVmTemplateRegistration;
private NoopDbUpgrade(final CloudStackVersion fromVersion, final CloudStackVersion toVersion) {
@ -488,5 +489,19 @@ public class DatabaseUpgradeChecker implements SystemIntegrityChecker {
return new InputStream[0];
}
private void initSystemVmTemplateRegistration() {
systemVmTemplateRegistration = new SystemVmTemplateRegistration("");
}
@Override
public void updateSystemVmTemplates(Connection conn) {
s_logger.debug("Updating System Vm template IDs");
initSystemVmTemplateRegistration();
try {
systemVmTemplateRegistration.updateSystemVmTemplates(conn);
} catch (Exception e) {
throw new CloudRuntimeException("Failed to find / register SystemVM template(s)");
}
}
}
}