Pearl1594 commented on code in PR #12874:
URL: https://github.com/apache/cloudstack/pull/12874#discussion_r2990019221
##########
engine/storage/image/src/main/java/org/apache/cloudstack/storage/image/TemplateServiceImpl.java:
##########
@@ -881,17 +881,15 @@ public void associateTemplateToZone(long templateId, Long
zoneId) {
// update template_zone_ref for cross-zone template for newly added zone
@Override
- public void associateCrosszoneTemplatesToZone(long dcId) {
+ 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);
- }
+ List<VMTemplateVO> crossZoneTemplates =
_templateDao.listAllCrossZoneTemplates();
+ for (VMTemplateVO vt : crossZoneTemplates) {
+ tmpltZone = _vmTemplateZoneDao.findByZoneTemplate(dcId,
vt.getId());
+ if (tmpltZone == null) {
+ VMTemplateZoneVO vmTemplateZone = new VMTemplateZoneVO(dcId,
vt.getId(), new Date());
+ _vmTemplateZoneDao.persist(vmTemplateZone);
Review Comment:
This is repeated in 3 other places - SimulatorDiscoverer, StorageManagerImpl
and SecondaryStorageDiscoverer - can we find a way to extract this.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]