You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by bh...@apache.org on 2015/04/23 15:28:03 UTC

git commit: updated refs/heads/4.5 to 3e8b12b

Repository: cloudstack
Updated Branches:
  refs/heads/4.5 d91d16110 -> 3e8b12bbb


CLOUDSTACK-8399: Allow changing hvm flag in updateTemplate API

This allows changing the hvm flag for a template after the template has been
registered.

Signed-off-by: Rohit Yadav <ro...@shapeblue.com>


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

Branch: refs/heads/4.5
Commit: 3e8b12bbb12554baf7ba2a625bfa064f86bfa9cc
Parents: d91d161
Author: Rohit Yadav <ro...@shapeblue.com>
Authored: Thu Apr 23 15:23:28 2015 +0200
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Thu Apr 23 15:27:43 2015 +0200

----------------------------------------------------------------------
 .../apache/cloudstack/api/BaseUpdateTemplateOrIsoCmd.java   | 9 ++++++++-
 .../cloudstack/api/command/user/iso/UpdateIsoCmd.java       | 5 +++++
 server/src/com/cloud/template/TemplateManagerImpl.java      | 7 ++++++-
 3 files changed, 19 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3e8b12bb/api/src/org/apache/cloudstack/api/BaseUpdateTemplateOrIsoCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/BaseUpdateTemplateOrIsoCmd.java b/api/src/org/apache/cloudstack/api/BaseUpdateTemplateOrIsoCmd.java
index 2754b25..bf3febb 100644
--- a/api/src/org/apache/cloudstack/api/BaseUpdateTemplateOrIsoCmd.java
+++ b/api/src/org/apache/cloudstack/api/BaseUpdateTemplateOrIsoCmd.java
@@ -32,9 +32,12 @@ public abstract class BaseUpdateTemplateOrIsoCmd extends BaseCmd {
     //////////////// API parameters /////////////////////
     /////////////////////////////////////////////////////
 
-    @Parameter(name = ApiConstants.BOOTABLE, type = CommandType.BOOLEAN, description = "true if image is bootable, false otherwise")
+    @Parameter(name = ApiConstants.BOOTABLE, type = CommandType.BOOLEAN, description = "true if image is bootable, false otherwise; available only for updateIso API")
     private Boolean bootable;
 
+    @Parameter(name = ApiConstants.REQUIRES_HVM, type = CommandType.BOOLEAN, description = "true if the template requres HVM, false otherwise; available only for updateTemplate API")
+    private Boolean requiresHvm;
+
     @Parameter(name = ApiConstants.DISPLAY_TEXT, type = CommandType.STRING, description = "the display text of the image", length = 4096)
     private String displayText;
 
@@ -78,6 +81,10 @@ public abstract class BaseUpdateTemplateOrIsoCmd extends BaseCmd {
         return bootable;
     }
 
+    public Boolean getRequiresHvm() {
+        return requiresHvm;
+    }
+
     public String getDisplayText() {
         return displayText;
     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3e8b12bb/api/src/org/apache/cloudstack/api/command/user/iso/UpdateIsoCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/iso/UpdateIsoCmd.java b/api/src/org/apache/cloudstack/api/command/user/iso/UpdateIsoCmd.java
index b569d65..5e61160 100644
--- a/api/src/org/apache/cloudstack/api/command/user/iso/UpdateIsoCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/iso/UpdateIsoCmd.java
@@ -39,6 +39,11 @@ public class UpdateIsoCmd extends BaseUpdateTemplateOrIsoCmd {
     /////////////////////////////////////////////////////
 
     @Override
+    public Boolean getRequiresHvm() {
+        return null;
+    }
+
+    @Override
     public Boolean isPasswordEnabled() {
         return null;
     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3e8b12bb/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 8bd7b21..81f7535 100755
--- a/server/src/com/cloud/template/TemplateManagerImpl.java
+++ b/server/src/com/cloud/template/TemplateManagerImpl.java
@@ -1745,6 +1745,7 @@ public class TemplateManagerImpl extends ManagerBase implements TemplateManager,
         Boolean isDynamicallyScalable = cmd.isDynamicallyScalable();
         Boolean isRoutingTemplate = cmd.isRoutingType();
         Boolean bootable = cmd.isBootable();
+        Boolean requiresHvm = cmd.getRequiresHvm();
         Integer sortKey = cmd.getSortKey();
         Map details = cmd.getDetails();
         Account account = CallContext.current().getCallingAccount();
@@ -1768,7 +1769,7 @@ public class TemplateManagerImpl extends ManagerBase implements TemplateManager,
         }
 
         boolean updateNeeded =
-                !(name == null && displayText == null && format == null && guestOSId == null && passwordEnabled == null && bootable == null && sortKey == null &&
+                !(name == null && displayText == null && format == null && guestOSId == null && passwordEnabled == null && bootable == null && requiresHvm == null && sortKey == null &&
                         isDynamicallyScalable == null && isRoutingTemplate == null && details == null);
         if (!updateNeeded) {
             return template;
@@ -1817,6 +1818,10 @@ public class TemplateManagerImpl extends ManagerBase implements TemplateManager,
             template.setBootable(bootable);
         }
 
+        if (requiresHvm != null) {
+            template.setRequiresHvm(requiresHvm);
+        }
+
         if (isDynamicallyScalable != null) {
             template.setDynamicallyScalable(isDynamicallyScalable);
         }