Merge remote-tracking branch 'origin/4.17'

This commit is contained in:
Rohit Yadav 2022-09-30 13:48:27 +05:30
commit 784578d46c
3 changed files with 8 additions and 5 deletions

View File

@ -30,6 +30,8 @@ import com.cloud.utils.fsm.StateMachine2;
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,

View File

@ -106,17 +106,17 @@ public class CreateTagsCmd extends BaseAsyncCmd {
SuccessResponse response = new SuccessResponse(getCommandName());
setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to upload resource icon");
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create resource tag(s)");
}
}
@Override
public String getEventType() {
return EventTypes.EVENT_RESOURCE_ICON_UPLOAD;
return EventTypes.EVENT_TAGS_CREATE;
}
@Override
public String getEventDescription() {
return "Uploading resource icon";
return "Creating resource tag(s)";
}
}

View File

@ -1749,8 +1749,9 @@ public class TemplateManagerImpl extends ManagerBase implements TemplateManager,
_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) {