Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -794,12 +794,16 @@
Long templateId = getRegisteredTemplateId(hypervisorAndTemplateName);
if (templateId != null) {
VMTemplateVO templateVO = vmTemplateDao.findById(templateId);
TemplateDataStoreVO templateDataStoreVO = templateDataStoreDao.findByTemplate(templateId, DataStoreRole.Image);
String installPath = templateDataStoreVO.getInstallPath();
if (validateIfSeeded(storeUrlAndId.first(), installPath, nfsVersion)) {
continue;
} else if (templateVO != null) {
TemplateDataStoreVO templateDataStoreVO = templateDataStoreDao.findByStoreTemplate(storeUrlAndId.second(), templateId);

Check warning on line 797 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#L797

Added line #L797 was not covered by tests
if (templateDataStoreVO != null) {
String installPath = templateDataStoreVO.getInstallPath();

Check warning on line 799 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#L799

Added line #L799 was not covered by tests
if (validateIfSeeded(storeUrlAndId.first(), installPath, nfsVersion)) {
continue;

Check warning on line 801 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#L801

Added line #L801 was not covered by tests
}
}
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 @@ -823,6 +827,11 @@
}

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 @@ -832,11 +841,11 @@
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
Original file line number Diff line number Diff line change
Expand Up @@ -3441,7 +3441,7 @@
TemplateDataStoreVO templateVO = null;
if (templateId != null) {
vmTemplateVO = _templateDao.findById(templateId);
templateVO = _templateStoreDao.findByTemplate(templateId, DataStoreRole.Image);
templateVO = _templateStoreDao.findByStoreTemplate(store.getId(), templateId);

Check warning on line 3444 in server/src/main/java/com/cloud/storage/StorageManagerImpl.java

View check run for this annotation

Codecov / codecov/patch

server/src/main/java/com/cloud/storage/StorageManagerImpl.java#L3444

Added line #L3444 was not covered by tests
if (templateVO != null) {
try {
if (SystemVmTemplateRegistration.validateIfSeeded(
Expand Down
Loading