mirror of https://github.com/apache/cloudstack.git
CLOUDSTACK-2987: Fixing dynamicallyScalable flag in register and update template API Previuos commit: 7b6b8d7a07 This fix is due to some changes made by the merges after this commit.
Signed-off-by: Abhinandan Prateek <aprateek@apache.org>
This commit is contained in:
parent
b948bbd552
commit
5dd1a1dd8e
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in New Issue