server: Fix template garbage collection cleanup (#4944)

This commit is contained in:
Nicolas Vazquez 2021-04-24 10:27:47 -03:00 committed by GitHub
parent a30d518e8a
commit f728287aa2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -68,7 +68,11 @@ public class TemplateDataFactoryImpl implements TemplateDataFactory {
@Override
public TemplateInfo getTemplateOnPrimaryStorage(long templateId, DataStore store, String configuration) {
VMTemplateVO templ = imageDataDao.findById(templateId);
VMTemplateVO templ = imageDataDao.findByIdIncludingRemoved(templateId);
if (templ == null) {
s_logger.error("Could not find a template with id " + templateId);
return null;
}
if (store.getRole() == DataStoreRole.Primary) {
VMTemplateStoragePoolVO templatePoolVO = templatePoolDao.findByPoolTemplate(store.getId(), templateId, configuration);
if (templatePoolVO != null) {