You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by se...@apache.org on 2013/07/12 09:51:23 UTC

[28/50] git commit: updated refs/heads/sdnextensions to bcfb4e6

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/08669f5d
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/08669f5d
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/08669f5d

Branch: refs/heads/sdnextensions
Commit: 08669f5de20d9bc5e40693f128d7e48393eedb37
Parents: 429e6bd
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:16:57 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/08669f5d/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 cc60c10..b972628 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
@@ -82,6 +82,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;
@@ -325,7 +326,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),