Repository: cloudstack
Updated Branches:
  refs/heads/master eb195d057 -> 085911f0a


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/085911f0
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/085911f0
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/085911f0

Branch: refs/heads/master
Commit: 085911f0a6c256c5f2a439ec0bf79b5027cdc078
Parents: eb195d0
Author: Sachchidanand Vaidya <[email protected]>
Authored: Wed Apr 2 01:57:07 2014 -0700
Committer: Daan Hoogland <[email protected]>
Committed: Wed Apr 16 14:29:33 2014 +0200

----------------------------------------------------------------------
 .../contrail/api/command/CreateServiceInstanceCmd.java        | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/085911f0/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");

Reply via email to