CLOUDSTACK-9686: Fixed multiple entires for builtin template in template

store ref table so builtin template is never downloaded completely
 In handleSysTemplateDownload method creating template only if there exists no entry
handleTemplateSync will take care of other scenario

(cherry picked from commit 929595c114f1214f064419a305cc115a3e136803)
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
This commit is contained in:
Anshul Gangwar 2016-01-08 13:28:11 +05:30 committed by Rohit Yadav
parent 63997b3b19
commit 16b67b40fd

View File

@ -267,7 +267,7 @@ public class TemplateServiceImpl implements TemplateService {
for (VMTemplateVO template : toBeDownloaded) {
TemplateDataStoreVO tmpltHost = _vmTemplateStoreDao.findByStoreTemplate(store.getId(), template.getId());
if (tmpltHost == null || tmpltHost.getState() != ObjectInDataStoreStateMachine.State.Ready) {
if (tmpltHost == null) {
associateTemplateToZone(template.getId(), dcId);
s_logger.info("Downloading builtin template " + template.getUniqueName() + " to data center: " + dcId);
TemplateInfo tmplt = _templateFactory.getTemplate(template.getId(), DataStoreRole.Image);