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 <rohit.yadav@shapeblue.com>
This commit is contained in:
Rohit Yadav 2015-04-23 15:23:28 +02:00
parent d91d161107
commit 3e8b12bbb1
3 changed files with 19 additions and 2 deletions

View File

@ -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;
}

View File

@ -38,6 +38,11 @@ public class UpdateIsoCmd extends BaseUpdateTemplateOrIsoCmd {
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
@Override
public Boolean getRequiresHvm() {
return null;
}
@Override
public Boolean isPasswordEnabled() {
return null;

View File

@ -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);
}