Skip to content

Commit 026bd09

Browse files
review changes
1 parent a02e455 commit 026bd09

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ public String getUpgradedVersion() {
3838

3939
@Override
4040
public void performDataMigration(Connection conn) {
41-
removeDuplicateDummyTemplates(conn);
41+
removeDuplicateKVMImportTemplates(conn);
4242
}
4343

44-
private void removeDuplicateDummyTemplates(Connection conn) {
44+
private void removeDuplicateKVMImportTemplates(Connection conn) {
4545
List<Long> templateIds = new ArrayList<>();
4646
try (PreparedStatement selectStmt = conn.prepareStatement(String.format("SELECT id FROM cloud.vm_template WHERE name='%s' ORDER BY id ASC", UnmanagedVMsManager.KVM_VM_IMPORT_DEFAULT_TEMPLATE_NAME))) {
4747
ResultSet rs = selectStmt.executeQuery();
@@ -53,6 +53,7 @@ private void removeDuplicateDummyTemplates(Connection conn) {
5353
return;
5454
}
5555

56+
logger.info("Removing duplicate template " + UnmanagedVMsManager.KVM_VM_IMPORT_DEFAULT_TEMPLATE_NAME + " entries");
5657
Long firstTemplateId = templateIds.get(0);
5758

5859
String updateTemplateSql = "UPDATE cloud.vm_instance SET vm_template_id = ? WHERE vm_template_id = ?";
@@ -74,7 +75,7 @@ private void removeDuplicateDummyTemplates(Connection conn) {
7475
}
7576
}
7677
} catch (Exception e) {
77-
logger.warn("Failed to clean duplicate kvm-default-vm-import-dummy-template entries", e);
78+
logger.warn("Failed to remove duplicate template " + UnmanagedVMsManager.KVM_VM_IMPORT_DEFAULT_TEMPLATE_NAME + " entries", e);
7879
}
7980
}
8081
}

0 commit comments

Comments
 (0)