Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
import com.cloud.utils.fsm.StateObject;

public interface VirtualMachineTemplate extends ControlledEntity, Identity, InternalIdentity, StateObject<VirtualMachineTemplate.State> {
int MAXIMUM_TEMPLATE_NAME_LENGTH = 255;

enum State {
Active,
Inactive,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1747,8 +1747,9 @@ public VMTemplateVO createPrivateTemplateRecord(CreateTemplateCmd cmd, Account t
_accountMgr.checkAccess(caller, null, true, templateOwner);

String name = cmd.getTemplateName();
if ((name == null) || (name.length() > 32)) {
throw new InvalidParameterValueException("Template name cannot be null and should be less than 32 characters");
if ((org.apache.commons.lang3.StringUtils.isBlank(name)
|| (name.length() > VirtualMachineTemplate.MAXIMUM_TEMPLATE_NAME_LENGTH))) {
throw new InvalidParameterValueException(String.format("Template name cannot be null and cannot be more %s characters", VirtualMachineTemplate.MAXIMUM_TEMPLATE_NAME_LENGTH));
}

if (cmd.getTemplateTag() != null) {
Expand Down