Skip to content

Commit bd874ea

Browse files
committed
Merge release branch 4.20 to main
* 4.20: systemvm: fix keystore is reset when patch a systemvm (#9900) no retrieval of null hosts (#10175) upgrade: consider multiple hypervisors and secondary storages (#10046) CheckOnHostCommand: add missing timeout setting (#9677)
2 parents fadb39e + e2cfddb commit bd874ea

File tree

4 files changed

+21
-10
lines changed

4 files changed

+21
-10
lines changed

core/src/main/java/com/cloud/agent/api/CheckOnHostCommand.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,7 @@ public CheckOnHostCommand(Host host) {
3535
}
3636

3737
public CheckOnHostCommand(Host host, boolean reportCheckFailureIfOneStorageIsDown) {
38-
super();
39-
this.host = new HostTO(host);
38+
this(host);
4039
this.reportCheckFailureIfOneStorageIsDown = reportCheckFailureIfOneStorageIsDown;
4140
}
4241

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

+16-7
Original file line numberDiff line numberDiff line change
@@ -796,12 +796,16 @@ public void doInTransactionWithoutResult(final TransactionStatus status) {
796796
Long templateId = getRegisteredTemplateId(hypervisorAndTemplateName);
797797
if (templateId != null) {
798798
VMTemplateVO templateVO = vmTemplateDao.findById(templateId);
799-
TemplateDataStoreVO templateDataStoreVO = templateDataStoreDao.findByTemplate(templateId, DataStoreRole.Image);
800-
String installPath = templateDataStoreVO.getInstallPath();
801-
if (validateIfSeeded(storeUrlAndId.first(), installPath, nfsVersion)) {
802-
continue;
803-
} else if (templateVO != null) {
799+
TemplateDataStoreVO templateDataStoreVO = templateDataStoreDao.findByStoreTemplate(storeUrlAndId.second(), templateId);
800+
if (templateDataStoreVO != null) {
801+
String installPath = templateDataStoreVO.getInstallPath();
802+
if (validateIfSeeded(storeUrlAndId.first(), installPath, nfsVersion)) {
803+
continue;
804+
}
805+
}
806+
if (templateVO != null) {
804807
registerTemplate(hypervisorAndTemplateName, storeUrlAndId, templateVO, templateDataStoreVO, filePath);
808+
updateRegisteredTemplateDetails(templateId, hypervisorAndTemplateName);
805809
continue;
806810
}
807811
}
@@ -825,6 +829,11 @@ public void doInTransactionWithoutResult(final TransactionStatus status) {
825829
}
826830

827831
private void updateRegisteredTemplateDetails(Long templateId, Map.Entry<Hypervisor.HypervisorType, String> hypervisorAndTemplateName) {
832+
Pair<Hypervisor.HypervisorType, String> entry = new Pair<>(hypervisorAndTemplateName.getKey(), hypervisorAndTemplateName.getValue());
833+
updateRegisteredTemplateDetails(templateId, entry);
834+
}
835+
836+
private void updateRegisteredTemplateDetails(Long templateId, Pair<Hypervisor.HypervisorType, String> hypervisorAndTemplateName) {
828837
VMTemplateVO templateVO = vmTemplateDao.findById(templateId);
829838
templateVO.setTemplateType(Storage.TemplateType.SYSTEM);
830839
boolean updated = vmTemplateDao.update(templateVO.getId(), templateVO);
@@ -834,11 +843,11 @@ private void updateRegisteredTemplateDetails(Long templateId, Map.Entry<Hypervis
834843
throw new CloudRuntimeException(errMsg);
835844
}
836845

837-
updateSystemVMEntries(templateId, hypervisorAndTemplateName.getKey());
846+
updateSystemVMEntries(templateId, hypervisorAndTemplateName.first());
838847

839848
// Change value of global configuration parameter router.template.* for the corresponding hypervisor and minreq.sysvmtemplate.version for the ACS version
840849
Map<String, String> configParams = new HashMap<>();
841-
configParams.put(RouterTemplateConfigurationNames.get(hypervisorAndTemplateName.getKey()), hypervisorAndTemplateName.getValue());
850+
configParams.put(RouterTemplateConfigurationNames.get(hypervisorAndTemplateName.first()), hypervisorAndTemplateName.second());
842851
configParams.put("minreq.sysvmtemplate.version", getSystemVmTemplateVersion());
843852
updateConfigurationParams(configParams);
844853
}

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -3530,7 +3530,7 @@ public void doInTransactionWithoutResult(final TransactionStatus status) {
35303530
TemplateDataStoreVO templateVO = null;
35313531
if (templateId != null) {
35323532
vmTemplateVO = _templateDao.findById(templateId);
3533-
templateVO = _templateStoreDao.findByTemplate(templateId, DataStoreRole.Image);
3533+
templateVO = _templateStoreDao.findByStoreTemplate(store.getId(), templateId);
35343534
if (templateVO != null) {
35353535
try {
35363536
if (SystemVmTemplateRegistration.validateIfSeeded(

systemvm/patch-sysvms.sh

+3
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,9 @@ patch_systemvm() {
124124
echo "Restored keystore file and certs using backup" >> $logfile 2>&1
125125
fi
126126

127+
# Import global cacerts into 'cloud' service's keystore
128+
keytool -importkeystore -srckeystore /etc/ssl/certs/java/cacerts -destkeystore /usr/local/cloud/systemvm/certs/realhostip.keystore -srcstorepass changeit -deststorepass vmops.com -noprompt || true
129+
127130
update_checksum $newpath/cloud-scripts.tgz
128131

129132
if [ -f /opt/cloud/bin/setup/patch.sh ];then

0 commit comments

Comments
 (0)