Skip to content

Commit

Permalink
PR#10046: add Daan's changes
Browse files Browse the repository at this point in the history
  • Loading branch information
weizhouapache committed Jan 8, 2025
1 parent 208f410 commit e2221b0
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -803,6 +803,7 @@ public void doInTransactionWithoutResult(final TransactionStatus status) {
}
if (templateVO != null) {
registerTemplate(hypervisorAndTemplateName, storeUrlAndId, templateVO, templateDataStoreVO, filePath);
updateRegisteredTemplateDetails(templateId, hypervisorAndTemplateName);

Check warning on line 806 in engine/schema/src/main/java/com/cloud/upgrade/SystemVmTemplateRegistration.java

View check run for this annotation

Codecov / codecov/patch

engine/schema/src/main/java/com/cloud/upgrade/SystemVmTemplateRegistration.java#L806

Added line #L806 was not covered by tests
continue;
}
}
Expand All @@ -826,6 +827,11 @@ public void doInTransactionWithoutResult(final TransactionStatus status) {
}

private void updateRegisteredTemplateDetails(Long templateId, Map.Entry<Hypervisor.HypervisorType, String> hypervisorAndTemplateName) {
Pair<Hypervisor.HypervisorType, String> entry = new Pair<>(hypervisorAndTemplateName.getKey(), hypervisorAndTemplateName.getValue());
updateRegisteredTemplateDetails(templateId, entry);
}

Check warning on line 832 in engine/schema/src/main/java/com/cloud/upgrade/SystemVmTemplateRegistration.java

View check run for this annotation

Codecov / codecov/patch

engine/schema/src/main/java/com/cloud/upgrade/SystemVmTemplateRegistration.java#L830-L832

Added lines #L830 - L832 were not covered by tests

private void updateRegisteredTemplateDetails(Long templateId, Pair<Hypervisor.HypervisorType, String> hypervisorAndTemplateName) {

Check warning on line 834 in engine/schema/src/main/java/com/cloud/upgrade/SystemVmTemplateRegistration.java

View check run for this annotation

Codecov / codecov/patch

engine/schema/src/main/java/com/cloud/upgrade/SystemVmTemplateRegistration.java#L834

Added line #L834 was not covered by tests
VMTemplateVO templateVO = vmTemplateDao.findById(templateId);
templateVO.setTemplateType(Storage.TemplateType.SYSTEM);
boolean updated = vmTemplateDao.update(templateVO.getId(), templateVO);
Expand All @@ -835,11 +841,11 @@ private void updateRegisteredTemplateDetails(Long templateId, Map.Entry<Hypervis
throw new CloudRuntimeException(errMsg);
}

updateSystemVMEntries(templateId, hypervisorAndTemplateName.getKey());
updateSystemVMEntries(templateId, hypervisorAndTemplateName.first());

Check warning on line 844 in engine/schema/src/main/java/com/cloud/upgrade/SystemVmTemplateRegistration.java

View check run for this annotation

Codecov / codecov/patch

engine/schema/src/main/java/com/cloud/upgrade/SystemVmTemplateRegistration.java#L844

Added line #L844 was not covered by tests

// Change value of global configuration parameter router.template.* for the corresponding hypervisor and minreq.sysvmtemplate.version for the ACS version
Map<String, String> configParams = new HashMap<>();
configParams.put(RouterTemplateConfigurationNames.get(hypervisorAndTemplateName.getKey()), hypervisorAndTemplateName.getValue());
configParams.put(RouterTemplateConfigurationNames.get(hypervisorAndTemplateName.first()), hypervisorAndTemplateName.second());

Check warning on line 848 in engine/schema/src/main/java/com/cloud/upgrade/SystemVmTemplateRegistration.java

View check run for this annotation

Codecov / codecov/patch

engine/schema/src/main/java/com/cloud/upgrade/SystemVmTemplateRegistration.java#L848

Added line #L848 was not covered by tests
configParams.put("minreq.sysvmtemplate.version", getSystemVmTemplateVersion());
updateConfigurationParams(configParams);
}
Expand Down

0 comments on commit e2221b0

Please sign in to comment.