Skip to content

Commit 784578d

Browse files
committed
Merge remote-tracking branch 'origin/4.17'
2 parents 67024b0 + 89d9a70 commit 784578d

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

api/src/main/java/com/cloud/template/VirtualMachineTemplate.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
import com.cloud.utils.fsm.StateObject;
3131

3232
public interface VirtualMachineTemplate extends ControlledEntity, Identity, InternalIdentity, StateObject<VirtualMachineTemplate.State> {
33+
int MAXIMUM_TEMPLATE_NAME_LENGTH = 255;
34+
3335
enum State {
3436
Active,
3537
Inactive,

api/src/main/java/org/apache/cloudstack/api/command/user/tag/CreateTagsCmd.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,17 +106,17 @@ public void execute() {
106106
SuccessResponse response = new SuccessResponse(getCommandName());
107107
setResponseObject(response);
108108
} else {
109-
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to upload resource icon");
109+
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create resource tag(s)");
110110
}
111111
}
112112

113113
@Override
114114
public String getEventType() {
115-
return EventTypes.EVENT_RESOURCE_ICON_UPLOAD;
115+
return EventTypes.EVENT_TAGS_CREATE;
116116
}
117117

118118
@Override
119119
public String getEventDescription() {
120-
return "Uploading resource icon";
120+
return "Creating resource tag(s)";
121121
}
122122
}

server/src/main/java/com/cloud/template/TemplateManagerImpl.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1749,8 +1749,9 @@ public VMTemplateVO createPrivateTemplateRecord(CreateTemplateCmd cmd, Account t
17491749
_accountMgr.checkAccess(caller, null, true, templateOwner);
17501750

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

17561757
if (cmd.getTemplateTag() != null) {

0 commit comments

Comments
 (0)