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

git commit: updated refs/heads/4.2 to 8816d41

Updated Branches:
  refs/heads/4.2 b2a077dff -> 8816d41d3


CLOUDSTACK-2987: Fixing dynamicallyScalable flag in register and update template API Previuos commit: 7b6b8d7a077478620232ea1ac4ec2304289e8661 This fix is due to some changes made by the merges after this commit.

Signed-off-by: Abhinandan Prateek <ap...@apache.org>


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

Branch: refs/heads/4.2
Commit: 8816d41d3b62fe50bbeb70e541f54f8e232c362e
Parents: b2a077d
Author: Harikrishna Patnala <ha...@citrix.com>
Authored: Fri Jul 12 13:22:41 2013 +0530
Committer: Abhinandan Prateek <ap...@apache.org>
Committed: Fri Jul 12 15:27:25 2013 +0530

----------------------------------------------------------------------
 .../src/com/cloud/storage/VMTemplateVO.java     |  3 ++-
 .../com/cloud/template/TemplateAdapterBase.java |  2 +-
 .../com/cloud/template/TemplateManagerImpl.java | 21 +++++++++++++++++++-
 3 files changed, 23 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8816d41d/engine/schema/src/com/cloud/storage/VMTemplateVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/storage/VMTemplateVO.java b/engine/schema/src/com/cloud/storage/VMTemplateVO.java
index 3e71191..60c1a4e 100755
--- a/engine/schema/src/com/cloud/storage/VMTemplateVO.java
+++ b/engine/schema/src/com/cloud/storage/VMTemplateVO.java
@@ -175,12 +175,13 @@ public class VMTemplateVO implements VirtualMachineTemplate {
     public VMTemplateVO(long id, String name, ImageFormat format, boolean isPublic, boolean featured,
             boolean isExtractable, TemplateType type, String url, boolean requiresHvm, int bits, long accountId,
             String cksum, String displayText, boolean enablePassword, long guestOSId, boolean bootable,
-            HypervisorType hyperType, String templateTag, Map details, boolean sshKeyEnabled) {
+            HypervisorType hyperType, String templateTag, Map details, boolean sshKeyEnabled, boolean isDynamicallyScalable) {
         this(id, name, format, isPublic, featured, isExtractable, type, url, requiresHvm, bits, accountId, cksum,
                 displayText, enablePassword, guestOSId, bootable, hyperType, details);
         this.templateTag = templateTag;
         this.uuid = UUID.randomUUID().toString();
         this.enableSshKey = sshKeyEnabled;
+        this.dynamicallyScalable = isDynamicallyScalable;
     }
 
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8816d41d/server/src/com/cloud/template/TemplateAdapterBase.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/template/TemplateAdapterBase.java b/server/src/com/cloud/template/TemplateAdapterBase.java
index fce2506..4f29fcd 100755
--- a/server/src/com/cloud/template/TemplateAdapterBase.java
+++ b/server/src/com/cloud/template/TemplateAdapterBase.java
@@ -258,7 +258,7 @@ public abstract class TemplateAdapterBase extends AdapterBase implements Templat
 				profile.getFeatured(), profile.getIsExtractable(), profile.getTemplateType(), profile.getUrl(), profile.getRequiresHVM(),
 				profile.getBits(), profile.getAccountId(), profile.getCheckSum(), profile.getDisplayText(),
 				profile.getPasswordEnabled(), profile.getGuestOsId(), profile.getBootable(), profile.getHypervisorType(), profile.getTemplateTag(),
-				profile.getDetails(), profile.getSshKeyEnabled());
+				profile.getDetails(), profile.getSshKeyEnabled(), profile.IsDynamicallyScalable());
 
 
 		if (zoneId == null || zoneId.longValue() == -1) {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8816d41d/server/src/com/cloud/template/TemplateManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/template/TemplateManagerImpl.java b/server/src/com/cloud/template/TemplateManagerImpl.java
index 5a54656..8dcb0ed 100755
--- a/server/src/com/cloud/template/TemplateManagerImpl.java
+++ b/server/src/com/cloud/template/TemplateManagerImpl.java
@@ -1686,6 +1686,8 @@ public class TemplateManagerImpl extends ManagerBase implements TemplateManager,
         String format = cmd.getFormat();
         Long guestOSId = cmd.getOsTypeId();
         Boolean passwordEnabled = cmd.isPasswordEnabled();
+        Boolean isDynamicallyScalable = cmd.isDynamicallyScalable();
+        Boolean isRoutingTemplate = cmd.isRoutingType();
         Boolean bootable = cmd.isBootable();
         Integer sortKey = cmd.getSortKey();
         Account account = UserContext.current().getCaller();
@@ -1707,9 +1709,14 @@ public class TemplateManagerImpl extends ManagerBase implements TemplateManager,
 
         // do a permission check
         _accountMgr.checkAccess(account, AccessType.ModifyEntry, true, template);
+        if(cmd.isRoutingType() != null){
+            if(!_accountService.isRootAdmin(account.getType())){
+                throw new PermissionDeniedException("Parameter isrouting can only be specified by a Root Admin, permission denied");
+            }
+        }
 
         boolean updateNeeded = !(name == null && displayText == null && format == null && guestOSId == null && passwordEnabled == null
-                && bootable == null && sortKey == null);
+                && bootable == null && sortKey == null && isDynamicallyScalable == null && isRoutingTemplate == null);
         if (!updateNeeded) {
             return template;
         }
@@ -1758,6 +1765,18 @@ public class TemplateManagerImpl extends ManagerBase implements TemplateManager,
             template.setBootable(bootable);
         }
 
+        if (isDynamicallyScalable != null) {
+            template.setDynamicallyScalable(isDynamicallyScalable);
+        }
+
+        if (isRoutingTemplate != null) {
+            if (isRoutingTemplate) {
+                template.setTemplateType(TemplateType.ROUTING);
+            } else {
+                template.setTemplateType(TemplateType.USER);
+            }
+        }
+
         _tmpltDao.update(id, template);
 
         return _tmpltDao.findById(id);