mirror of
https://github.com/apache/cloudstack.git
synced 2025-12-15 18:12:35 +01:00
CLOUDSTACK-4600:Registered Cross-zone template does not populate
template_zone_ref for later added zones.
This commit is contained in:
parent
bf967eb622
commit
e92d46bfd4
@ -61,4 +61,6 @@ public interface TemplateService {
|
|||||||
void downloadBootstrapSysTemplate(DataStore store);
|
void downloadBootstrapSysTemplate(DataStore store);
|
||||||
|
|
||||||
void addSystemVMTemplatesToSecondary(DataStore store);
|
void addSystemVMTemplatesToSecondary(DataStore store);
|
||||||
|
|
||||||
|
void associateCrosszoneTemplatesToZone(long dcId);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -488,6 +488,23 @@ public class TemplateServiceImpl implements TemplateService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// update template_zone_ref for cross-zone template for newly added zone
|
||||||
|
@Override
|
||||||
|
public void associateCrosszoneTemplatesToZone(long dcId){
|
||||||
|
VMTemplateZoneVO tmpltZone;
|
||||||
|
|
||||||
|
List<VMTemplateVO> allTemplates = _templateDao.listAll();
|
||||||
|
for (VMTemplateVO vt: allTemplates){
|
||||||
|
if (vt.isCrossZones()) {
|
||||||
|
tmpltZone = _vmTemplateZoneDao.findByZoneTemplate(dcId, vt.getId());
|
||||||
|
if (tmpltZone == null) {
|
||||||
|
VMTemplateZoneVO vmTemplateZone = new VMTemplateZoneVO(dcId, vt.getId(), new Date());
|
||||||
|
_vmTemplateZoneDao.persist(vmTemplateZone);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private Map<String, TemplateProp> listTemplate(DataStore ssStore) {
|
private Map<String, TemplateProp> listTemplate(DataStore ssStore) {
|
||||||
ListTemplateCommand cmd = new ListTemplateCommand(ssStore.getTO());
|
ListTemplateCommand cmd = new ListTemplateCommand(ssStore.getTO());
|
||||||
EndPoint ep = _epSelector.select(ssStore);
|
EndPoint ep = _epSelector.select(ssStore);
|
||||||
|
|||||||
@ -289,6 +289,8 @@ public class DownloadListener implements Listener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_imageSrv.handleSysTemplateDownload(hostHyper, agent.getDataCenterId());
|
_imageSrv.handleSysTemplateDownload(hostHyper, agent.getDataCenterId());
|
||||||
|
// update template_zone_ref for cross-zone templates
|
||||||
|
_imageSrv.associateCrosszoneTemplatesToZone(agent.getDataCenterId());
|
||||||
}
|
}
|
||||||
/* This can be removed
|
/* This can be removed
|
||||||
else if ( cmd instanceof StartupStorageCommand) {
|
else if ( cmd instanceof StartupStorageCommand) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user