CLOUDSTACK-6322 - Don't allow service instance creation with empty or null service-instance "name".

Signed-off-by: Daan Hoogland <daan@onecht.net>
(cherry picked from commit 085911f0a6)
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>

Conflicts:
	plugins/network-elements/juniper-contrail/src/org/apache/cloudstack/network/contrail/api/command/CreateServiceInstanceCmd.java
This commit is contained in:
Sachchidanand Vaidya 2014-04-02 01:57:07 -07:00 committed by Rohit Yadav
parent 192c706164
commit df6172f938
1 changed files with 6 additions and 1 deletions

View File

@ -90,7 +90,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
@ -126,6 +127,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) {