From afc95f1ccc56500032955afb010190eb293d8d34 Mon Sep 17 00:00:00 2001 From: Rene Peinthor Date: Wed, 8 Jan 2025 14:02:43 +0100 Subject: [PATCH 1/4] CheckOnHostCommand: add missing timeout setting (#9677) --- core/src/main/java/com/cloud/agent/api/CheckOnHostCommand.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) 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; } From 7adc73299222fcb60ad704a19743022ee734cffe Mon Sep 17 00:00:00 2001 From: Wei Zhou Date: Mon, 13 Jan 2025 09:28:18 +0100 Subject: [PATCH 2/4] upgrade: consider multiple hypervisors and secondary storages (#10046) --- .../upgrade/SystemVmTemplateRegistration.java | 23 +++++++++++++------ .../com/cloud/storage/StorageManagerImpl.java | 2 +- 2 files changed, 17 insertions(+), 8 deletions(-) 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 671fb8c95d5..40a8cb4b11f 100644 --- a/engine/schema/src/main/java/com/cloud/upgrade/SystemVmTemplateRegistration.java +++ b/engine/schema/src/main/java/com/cloud/upgrade/SystemVmTemplateRegistration.java @@ -794,12 +794,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; } } @@ -823,6 +827,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); @@ -832,11 +841,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 f966098c959..36e0f582df8 100644 --- a/server/src/main/java/com/cloud/storage/StorageManagerImpl.java +++ b/server/src/main/java/com/cloud/storage/StorageManagerImpl.java @@ -3441,7 +3441,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( From fce77733a5dd030046b20c12c746da0c89ffc2e3 Mon Sep 17 00:00:00 2001 From: dahn Date: Mon, 13 Jan 2025 09:28:47 +0100 Subject: [PATCH 3/4] no retrieval of null hosts (#10175) --- .../java/com/cloud/deploy/DeploymentPlanningManagerImpl.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/server/src/main/java/com/cloud/deploy/DeploymentPlanningManagerImpl.java b/server/src/main/java/com/cloud/deploy/DeploymentPlanningManagerImpl.java index 1f1a9c22358..ae88a92b3b6 100644 --- a/server/src/main/java/com/cloud/deploy/DeploymentPlanningManagerImpl.java +++ b/server/src/main/java/com/cloud/deploy/DeploymentPlanningManagerImpl.java @@ -448,8 +448,6 @@ StateListener, Configurable { HostVO host = _hostDao.findById(vm.getLastHostId()); lastHost = host; - _hostDao.loadHostTags(host); - _hostDao.loadDetails(host); ServiceOfferingDetailsVO offeringDetails = null; if (host == null) { s_logger.debug("The last host of this VM cannot be found"); From 35fe19f096dd38987bd1f892c78e9cce42c05c49 Mon Sep 17 00:00:00 2001 From: Wei Zhou Date: Mon, 13 Jan 2025 09:40:12 +0100 Subject: [PATCH 4/4] systemvm: fix keystore is reset when patch a systemvm (#9900) --- systemvm/patch-sysvms.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/systemvm/patch-sysvms.sh b/systemvm/patch-sysvms.sh index 554218c9878..dfe39fd8e00 100644 --- a/systemvm/patch-sysvms.sh +++ b/systemvm/patch-sysvms.sh @@ -122,6 +122,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 [ "$TYPE" == "consoleproxy" ] || [ "$TYPE" == "secstorage" ] || [[ "$TYPE" == *router ]]; then