Skip to content

Commit e2221b0

Browse files
committed
PR#10046: add Daan's changes
1 parent 208f410 commit e2221b0

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -803,6 +803,7 @@ public void doInTransactionWithoutResult(final TransactionStatus status) {
803803
}
804804
if (templateVO != null) {
805805
registerTemplate(hypervisorAndTemplateName, storeUrlAndId, templateVO, templateDataStoreVO, filePath);
806+
updateRegisteredTemplateDetails(templateId, hypervisorAndTemplateName);
806807
continue;
807808
}
808809
}
@@ -826,6 +827,11 @@ public void doInTransactionWithoutResult(final TransactionStatus status) {
826827
}
827828

828829
private void updateRegisteredTemplateDetails(Long templateId, Map.Entry<Hypervisor.HypervisorType, String> hypervisorAndTemplateName) {
830+
Pair<Hypervisor.HypervisorType, String> entry = new Pair<>(hypervisorAndTemplateName.getKey(), hypervisorAndTemplateName.getValue());
831+
updateRegisteredTemplateDetails(templateId, entry);
832+
}
833+
834+
private void updateRegisteredTemplateDetails(Long templateId, Pair<Hypervisor.HypervisorType, String> hypervisorAndTemplateName) {
829835
VMTemplateVO templateVO = vmTemplateDao.findById(templateId);
830836
templateVO.setTemplateType(Storage.TemplateType.SYSTEM);
831837
boolean updated = vmTemplateDao.update(templateVO.getId(), templateVO);
@@ -835,11 +841,11 @@ private void updateRegisteredTemplateDetails(Long templateId, Map.Entry<Hypervis
835841
throw new CloudRuntimeException(errMsg);
836842
}
837843

838-
updateSystemVMEntries(templateId, hypervisorAndTemplateName.getKey());
844+
updateSystemVMEntries(templateId, hypervisorAndTemplateName.first());
839845

840846
// Change value of global configuration parameter router.template.* for the corresponding hypervisor and minreq.sysvmtemplate.version for the ACS version
841847
Map<String, String> configParams = new HashMap<>();
842-
configParams.put(RouterTemplateConfigurationNames.get(hypervisorAndTemplateName.getKey()), hypervisorAndTemplateName.getValue());
848+
configParams.put(RouterTemplateConfigurationNames.get(hypervisorAndTemplateName.first()), hypervisorAndTemplateName.second());
843849
configParams.put("minreq.sysvmtemplate.version", getSystemVmTemplateVersion());
844850
updateConfigurationParams(configParams);
845851
}

0 commit comments

Comments
 (0)