You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by de...@apache.org on 2013/07/11 11:06:43 UTC

[2/2] git commit: updated refs/heads/4.2 to 4a9c665

CLOUDSTACK-3462: NumberFormatException with TemplateService while performing template synchronization.


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/4a9c665c
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/4a9c665c
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/4a9c665c

Branch: refs/heads/4.2
Commit: 4a9c665c190c5a9842d1106fbf8b9ea45bbe4dc6
Parents: 5dda98c
Author: Sanjay Tripathi <sa...@citrix.com>
Authored: Thu Jul 11 13:44:32 2013 +0530
Committer: Devdeep Singh <de...@gmail.com>
Committed: Thu Jul 11 14:29:05 2013 +0530

----------------------------------------------------------------------
 .../apache/cloudstack/storage/image/TemplateServiceImpl.java    | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4a9c665c/engine/storage/image/src/org/apache/cloudstack/storage/image/TemplateServiceImpl.java
----------------------------------------------------------------------
diff --git a/engine/storage/image/src/org/apache/cloudstack/storage/image/TemplateServiceImpl.java b/engine/storage/image/src/org/apache/cloudstack/storage/image/TemplateServiceImpl.java
index 22eb010..8e4c60c 100644
--- a/engine/storage/image/src/org/apache/cloudstack/storage/image/TemplateServiceImpl.java
+++ b/engine/storage/image/src/org/apache/cloudstack/storage/image/TemplateServiceImpl.java
@@ -79,6 +79,7 @@ import com.cloud.storage.dao.VMTemplateZoneDao;
 import com.cloud.storage.template.TemplateConstants;
 import com.cloud.storage.template.TemplateProp;
 import com.cloud.template.TemplateManager;
+import com.cloud.user.Account;
 import com.cloud.user.AccountManager;
 import com.cloud.user.ResourceLimitService;
 import com.cloud.utils.UriUtils;
@@ -319,7 +320,9 @@ public class TemplateServiceImpl implements TemplateService {
                         tmlpt.setSize(tmpltInfo.getSize());
                         _templateDao.update(tmplt.getId(), tmlpt);
 
-                        if (tmpltInfo.getSize() > 0 && tmplt.getUrl() != null) {
+                        // Skipping limit checks for SYSTEM Account and for the templates created from volumes or snapshots
+                        // which already got checked and incremented during createTemplate API call.
+                        if (tmpltInfo.getSize() > 0 && tmplt.getAccountId() != Account.ACCOUNT_ID_SYSTEM && tmplt.getUrl() != null) {
                             long accountId = tmplt.getAccountId();
                             try {
                                 _resourceLimitMgr.checkResourceLimit(_accountMgr.getAccount(accountId),