shwstppr commented on a change in pull request #5642:
URL: https://github.com/apache/cloudstack/pull/5642#discussion_r740711242



##########
File path: 
engine/schema/src/main/java/com/cloud/upgrade/SystemVmTemplateRegistration.java
##########
@@ -458,10 +466,32 @@ private Long 
createTemplateObjectInDB(SystemVMTemplateDetails details) {
         template.setState(VirtualMachineTemplate.State.Inactive);
         
template.setDeployAsIs(Hypervisor.HypervisorType.VMware.equals(details.getHypervisorType()));
         template = vmTemplateDao.persist(template);
-        if (template == null) {
-            return null;
+        return template;
+    }
+
+    private VMTemplateZoneVO createOrUpdateTemplateZoneEntry(long zoneId, long 
templateId) {
+        VMTemplateZoneVO templateZoneVO = 
vmTemplateZoneDao.findByZoneTemplate(zoneId, templateId);
+        if (templateZoneVO == null) {
+            templateZoneVO = new VMTemplateZoneVO(zoneId, templateId, new 
java.util.Date());
+            templateZoneVO = vmTemplateZoneDao.persist(templateZoneVO);
+        } else {
+            templateZoneVO.setRemoved(GenericDaoBase.DATE_TO_NULL);
+            templateZoneVO.setLastUpdated(new java.util.Date());
+            if (vmTemplateZoneDao.update(templateZoneVO.getId(), 
templateZoneVO)) {
+                templateZoneVO = null;
+            }
+        }
+        return templateZoneVO;
+    }
+
+    private void createCrossZonesTemplateZoneRefEntries(VMTemplateVO template) 
{
+        List<DataCenterVO> dcs = dataCenterDao.listAll();

Review comment:
       That should be handled during zone creation same as earlier, 
https://github.com/apache/cloudstack/blob/main/engine/storage/image/src/main/java/org/apache/cloudstack/storage/image/TemplateServiceImpl.java#L615-L630

##########
File path: 
engine/schema/src/main/java/com/cloud/upgrade/SystemVmTemplateRegistration.java
##########
@@ -458,10 +466,32 @@ private Long 
createTemplateObjectInDB(SystemVMTemplateDetails details) {
         template.setState(VirtualMachineTemplate.State.Inactive);
         
template.setDeployAsIs(Hypervisor.HypervisorType.VMware.equals(details.getHypervisorType()));
         template = vmTemplateDao.persist(template);
-        if (template == null) {
-            return null;
+        return template;
+    }
+
+    private VMTemplateZoneVO createOrUpdateTemplateZoneEntry(long zoneId, long 
templateId) {
+        VMTemplateZoneVO templateZoneVO = 
vmTemplateZoneDao.findByZoneTemplate(zoneId, templateId);
+        if (templateZoneVO == null) {
+            templateZoneVO = new VMTemplateZoneVO(zoneId, templateId, new 
java.util.Date());
+            templateZoneVO = vmTemplateZoneDao.persist(templateZoneVO);
+        } else {
+            templateZoneVO.setRemoved(GenericDaoBase.DATE_TO_NULL);
+            templateZoneVO.setLastUpdated(new java.util.Date());
+            if (vmTemplateZoneDao.update(templateZoneVO.getId(), 
templateZoneVO)) {
+                templateZoneVO = null;
+            }
+        }
+        return templateZoneVO;

Review comment:
       Don't think it affects functionality




-- 
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]


Reply via email to