mirror of https://github.com/apache/cloudstack.git
server: set template type to ROUTING or USER if template type is not specified when upload a template (#12768)
This commit is contained in:
parent
e10c066cc1
commit
470812100e
|
|
@ -35,3 +35,6 @@ UPDATE `cloud`.`alert` SET type = 34 WHERE name = 'ALERT.VR.PRIVATE.IFACE.MTU';
|
|||
UPDATE `cloud`.`configuration` SET description = 'True if the management server will restart the agent service via SSH into the KVM hosts after or during maintenance operations', is_dynamic = 1 WHERE name = 'kvm.ssh.to.agent';
|
||||
|
||||
UPDATE `cloud`.`vm_template` SET guest_os_id = 99 WHERE name = 'kvm-default-vm-import-dummy-template';
|
||||
|
||||
-- Update existing vm_template records with NULL type to "USER"
|
||||
UPDATE `cloud`.`vm_template` SET `type` = 'USER' WHERE `type` IS NULL;
|
||||
|
|
|
|||
|
|
@ -2416,7 +2416,7 @@ public class TemplateManagerImpl extends ManagerBase implements TemplateManager,
|
|||
} else if ((cmd instanceof RegisterVnfTemplateCmd || cmd instanceof UpdateVnfTemplateCmd) && !TemplateType.VNF.equals(templateType)) {
|
||||
throw new InvalidParameterValueException("The template type must be VNF for VNF templates, but the actual type is " + templateType);
|
||||
}
|
||||
} else if (cmd instanceof RegisterTemplateCmd) {
|
||||
} else if (cmd instanceof RegisterTemplateCmd || cmd instanceof GetUploadParamsForTemplateCmd) {
|
||||
boolean isRouting = Boolean.TRUE.equals(isRoutingType);
|
||||
templateType = (cmd instanceof RegisterVnfTemplateCmd) ? TemplateType.VNF : (isRouting ? TemplateType.ROUTING : TemplateType.USER);
|
||||
}
|
||||
|
|
@ -2426,6 +2426,8 @@ public class TemplateManagerImpl extends ManagerBase implements TemplateManager,
|
|||
throw new InvalidParameterValueException(String.format("Users can not register Template with template type %s.", templateType));
|
||||
} else if (cmd instanceof UpdateTemplateCmd) {
|
||||
throw new InvalidParameterValueException(String.format("Users can not update Template to template type %s.", templateType));
|
||||
} else if (cmd instanceof GetUploadParamsForTemplateCmd) {
|
||||
throw new InvalidParameterValueException(String.format("Users can not request upload parameters for Template with template type %s.", templateType));
|
||||
}
|
||||
}
|
||||
return templateType;
|
||||
|
|
|
|||
Loading…
Reference in New Issue