File tree Expand file tree Collapse file tree
plugins/dedicated-resources/src/org/apache/cloudstack/api/commands Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -105,14 +105,12 @@ public void execute() {
105105 List <? extends DedicatedResources > result = dedicatedService .dedicateCluster (getClusterId (), getDomainId (), getAccountName ());
106106 ListResponse <DedicateClusterResponse > response = new ListResponse <DedicateClusterResponse >();
107107 List <DedicateClusterResponse > clusterResponseList = new ArrayList <DedicateClusterResponse >();
108- if (result != null ) {
109- for (DedicatedResources resource : result ) {
110- DedicateClusterResponse clusterResponse = dedicatedService .createDedicateClusterResponse (resource );
111- clusterResponseList .add (clusterResponse );
112- }
113- response .setResponses (clusterResponseList );
114- response .setResponseName (getCommandName ());
115- this .setResponseObject (response );
108+
109+ // List of result should always contain single element as only one cluster will be associated with each cluster ID.
110+ if (result != null && result .size () == 1 ) {
111+ DedicateClusterResponse clusterResponse = dedicatedService .createDedicateClusterResponse (result .get (0 ));
112+ clusterResponse .setResponseName (getCommandName ());
113+ this .setResponseObject (clusterResponse );
116114 } else {
117115 throw new ServerApiException (ApiErrorCode .INTERNAL_ERROR , "Failed to dedicate cluster" );
118116 }
You can’t perform that action at this time.
0 commit comments