mirror of https://github.com/apache/cloudstack.git
CLOUDSTACK-4600:Registered Cross-zone template does not populate
template_zone_ref for later added zones.
This commit is contained in:
parent
d0ffc9e339
commit
3dc8b8863a
|
|
@ -61,4 +61,6 @@ public interface TemplateService {
|
|||
void downloadBootstrapSysTemplate(DataStore store);
|
||||
|
||||
void addSystemVMTemplatesToSecondary(DataStore store);
|
||||
|
||||
void associateCrosszoneTemplatesToZone(long dcId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -487,6 +487,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) {
|
||||
ListTemplateCommand cmd = new ListTemplateCommand(ssStore.getTO());
|
||||
EndPoint ep = _epSelector.select(ssStore);
|
||||
|
|
|
|||
|
|
@ -289,6 +289,8 @@ public class DownloadListener implements Listener {
|
|||
return;
|
||||
}
|
||||
_imageSrv.handleSysTemplateDownload(hostHyper, agent.getDataCenterId());
|
||||
// update template_zone_ref for cross-zone templates
|
||||
_imageSrv.associateCrosszoneTemplatesToZone(agent.getDataCenterId());
|
||||
}
|
||||
/* This can be removed
|
||||
else if ( cmd instanceof StartupStorageCommand) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue