mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-03 04:12:31 +01:00
CLOUDSTACK-6322 - Don't allow service instance creation with empty or null service-instance "name".
Signed-off-by: Daan Hoogland <daan@onecht.net>
This commit is contained in:
parent
eb195d0575
commit
085911f0a6
@ -106,7 +106,8 @@ public class CreateServiceInstanceCmd extends BaseAsyncCreateCmd {
|
||||
description = "The service offering ID that defines the resources consumed by the service appliance")
|
||||
private Long serviceOfferingId;
|
||||
|
||||
@Parameter(name = ApiConstants.NAME, type = CommandType.STRING)
|
||||
@Parameter(name = ApiConstants.NAME, type = CommandType.STRING,
|
||||
required = true, description = "The name of the service instance")
|
||||
private String name;
|
||||
|
||||
/// Implementation
|
||||
@ -144,6 +145,10 @@ public class CreateServiceInstanceCmd extends BaseAsyncCreateCmd {
|
||||
throw new InvalidParameterValueException("Invalid ID for right network " + rightNetworkId);
|
||||
}
|
||||
|
||||
if (name.isEmpty()) {
|
||||
throw new InvalidParameterValueException("service instance name is empty");
|
||||
}
|
||||
|
||||
ServiceVirtualMachine svm = _vrouterService.createServiceInstance(zone, owner, template, serviceOffering, name, left, right);
|
||||
if (svm == null) {
|
||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Unable to create service instance");
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user