Skip to content

Commit 2bb0791

Browse files
authored
make NoopDbUpgrade do a systemvm template check (#7564)
1 parent fd13184 commit 2bb0791

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

engine/schema/src/main/java/com/cloud/upgrade/DatabaseUpgradeChecker.java

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -444,10 +444,11 @@ private void decryptInit(Connection conn) throws SQLException {
444444
}
445445

446446
@VisibleForTesting
447-
protected static final class NoopDbUpgrade implements DbUpgrade {
447+
protected static final class NoopDbUpgrade implements DbUpgrade, DbUpgradeSystemVmTemplate {
448448

449449
private final String upgradedVersion;
450450
private final String[] upgradeRange;
451+
private SystemVmTemplateRegistration systemVmTemplateRegistration;
451452

452453
private NoopDbUpgrade(final CloudStackVersion fromVersion, final CloudStackVersion toVersion) {
453454

@@ -488,5 +489,19 @@ public InputStream[] getCleanupScripts() {
488489
return new InputStream[0];
489490
}
490491

492+
private void initSystemVmTemplateRegistration() {
493+
systemVmTemplateRegistration = new SystemVmTemplateRegistration("");
494+
}
495+
496+
@Override
497+
public void updateSystemVmTemplates(Connection conn) {
498+
s_logger.debug("Updating System Vm template IDs");
499+
initSystemVmTemplateRegistration();
500+
try {
501+
systemVmTemplateRegistration.updateSystemVmTemplates(conn);
502+
} catch (Exception e) {
503+
throw new CloudRuntimeException("Failed to find / register SystemVM template(s)");
504+
}
505+
}
491506
}
492507
}

0 commit comments

Comments
 (0)