Repository: cloudstack Updated Branches: refs/heads/4.4 dcb0db608 -> 8d371ab03
CLOUDSTACK-6322 - Don't allow service instance creation with empty or null service-instance "name". Signed-off-by: Daan Hoogland <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/8d371ab0 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/8d371ab0 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/8d371ab0 Branch: refs/heads/4.4 Commit: 8d371ab031e14c04328a02117ba1435858b25bd3 Parents: dcb0db6 Author: Sachchidanand Vaidya <[email protected]> Authored: Wed Apr 2 01:57:07 2014 -0700 Committer: Daan Hoogland <[email protected]> Committed: Thu Apr 17 03:47:43 2014 -0600 ---------------------------------------------------------------------- .../contrail/api/command/CreateServiceInstanceCmd.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d371ab0/plugins/network-elements/juniper-contrail/src/org/apache/cloudstack/network/contrail/api/command/CreateServiceInstanceCmd.java ---------------------------------------------------------------------- diff --git a/plugins/network-elements/juniper-contrail/src/org/apache/cloudstack/network/contrail/api/command/CreateServiceInstanceCmd.java b/plugins/network-elements/juniper-contrail/src/org/apache/cloudstack/network/contrail/api/command/CreateServiceInstanceCmd.java index d2cb4de..59c4e61 100644 --- a/plugins/network-elements/juniper-contrail/src/org/apache/cloudstack/network/contrail/api/command/CreateServiceInstanceCmd.java +++ b/plugins/network-elements/juniper-contrail/src/org/apache/cloudstack/network/contrail/api/command/CreateServiceInstanceCmd.java @@ -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");
