diff --git a/core/src/main/java/com/cloud/agent/api/CheckOnHostCommand.java b/core/src/main/java/com/cloud/agent/api/CheckOnHostCommand.java index 982e10cf2eb..94239f2900e 100644 --- a/core/src/main/java/com/cloud/agent/api/CheckOnHostCommand.java +++ b/core/src/main/java/com/cloud/agent/api/CheckOnHostCommand.java @@ -35,8 +35,7 @@ public class CheckOnHostCommand extends Command { } public CheckOnHostCommand(Host host, boolean reportCheckFailureIfOneStorageIsDown) { - super(); - this.host = new HostTO(host); + this(host); this.reportCheckFailureIfOneStorageIsDown = reportCheckFailureIfOneStorageIsDown; } diff --git a/engine/schema/src/main/java/com/cloud/upgrade/SystemVmTemplateRegistration.java b/engine/schema/src/main/java/com/cloud/upgrade/SystemVmTemplateRegistration.java index 7314937ff5b..b197fb7c030 100644 --- a/engine/schema/src/main/java/com/cloud/upgrade/SystemVmTemplateRegistration.java +++ b/engine/schema/src/main/java/com/cloud/upgrade/SystemVmTemplateRegistration.java @@ -796,12 +796,16 @@ public class SystemVmTemplateRegistration { 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); + if (templateDataStoreVO != null) { + String installPath = templateDataStoreVO.getInstallPath(); + if (validateIfSeeded(storeUrlAndId.first(), installPath, nfsVersion)) { + continue; + } + } + if (templateVO != null) { registerTemplate(hypervisorAndTemplateName, storeUrlAndId, templateVO, templateDataStoreVO, filePath); + updateRegisteredTemplateDetails(templateId, hypervisorAndTemplateName); continue; } } @@ -825,6 +829,11 @@ public class SystemVmTemplateRegistration { } private void updateRegisteredTemplateDetails(Long templateId, Map.Entry hypervisorAndTemplateName) { + Pair entry = new Pair<>(hypervisorAndTemplateName.getKey(), hypervisorAndTemplateName.getValue()); + updateRegisteredTemplateDetails(templateId, entry); + } + + private void updateRegisteredTemplateDetails(Long templateId, Pair hypervisorAndTemplateName) { VMTemplateVO templateVO = vmTemplateDao.findById(templateId); templateVO.setTemplateType(Storage.TemplateType.SYSTEM); boolean updated = vmTemplateDao.update(templateVO.getId(), templateVO); @@ -834,11 +843,11 @@ public class SystemVmTemplateRegistration { throw new CloudRuntimeException(errMsg); } - updateSystemVMEntries(templateId, hypervisorAndTemplateName.getKey()); + updateSystemVMEntries(templateId, hypervisorAndTemplateName.first()); // Change value of global configuration parameter router.template.* for the corresponding hypervisor and minreq.sysvmtemplate.version for the ACS version Map configParams = new HashMap<>(); - configParams.put(RouterTemplateConfigurationNames.get(hypervisorAndTemplateName.getKey()), hypervisorAndTemplateName.getValue()); + configParams.put(RouterTemplateConfigurationNames.get(hypervisorAndTemplateName.first()), hypervisorAndTemplateName.second()); configParams.put("minreq.sysvmtemplate.version", getSystemVmTemplateVersion()); updateConfigurationParams(configParams); } diff --git a/server/src/main/java/com/cloud/storage/StorageManagerImpl.java b/server/src/main/java/com/cloud/storage/StorageManagerImpl.java index b0c208a3842..1c5da19fbbc 100644 --- a/server/src/main/java/com/cloud/storage/StorageManagerImpl.java +++ b/server/src/main/java/com/cloud/storage/StorageManagerImpl.java @@ -3530,7 +3530,7 @@ public class StorageManagerImpl extends ManagerBase implements StorageManager, C TemplateDataStoreVO templateVO = null; if (templateId != null) { vmTemplateVO = _templateDao.findById(templateId); - templateVO = _templateStoreDao.findByTemplate(templateId, DataStoreRole.Image); + templateVO = _templateStoreDao.findByStoreTemplate(store.getId(), templateId); if (templateVO != null) { try { if (SystemVmTemplateRegistration.validateIfSeeded( diff --git a/systemvm/patch-sysvms.sh b/systemvm/patch-sysvms.sh index e7195436722..f24136155f8 100644 --- a/systemvm/patch-sysvms.sh +++ b/systemvm/patch-sysvms.sh @@ -124,6 +124,9 @@ patch_systemvm() { echo "Restored keystore file and certs using backup" >> $logfile 2>&1 fi + # Import global cacerts into 'cloud' service's keystore + keytool -importkeystore -srckeystore /etc/ssl/certs/java/cacerts -destkeystore /usr/local/cloud/systemvm/certs/realhostip.keystore -srcstorepass changeit -deststorepass vmops.com -noprompt || true + update_checksum $newpath/cloud-scripts.tgz if [ -f /opt/cloud/bin/setup/patch.sh ];then