diff --git a/api/src/com/cloud/api/commands/ListCapacityByTypeCmd.java b/api/src/com/cloud/api/commands/ListCapacityByTypeCmd.java
new file mode 100755
index 00000000000..df2d25ae16e
--- /dev/null
+++ b/api/src/com/cloud/api/commands/ListCapacityByTypeCmd.java
@@ -0,0 +1,97 @@
+/**
+ * Copyright (C) 2010 Cloud.com, Inc. All rights reserved.
+ *
+ * This software is licensed under the GNU General Public License v3 or later.
+ *
+ * It is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or any later version.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ *
+ */
+
+package com.cloud.api.commands;
+
+import java.text.DecimalFormat;
+import java.util.List;
+
+import org.apache.log4j.Logger;
+
+import com.cloud.api.ApiConstants;
+import com.cloud.api.BaseListCmd;
+import com.cloud.api.Implementation;
+import com.cloud.api.Parameter;
+import com.cloud.api.response.CapacityResponse;
+import com.cloud.api.response.ListResponse;
+import com.cloud.capacity.Capacity;
+
+@Implementation(description="Lists capacity By Type.", responseObject=CapacityResponse.class)
+public class ListCapacityByTypeCmd extends BaseListCmd {
+
+ public static final Logger s_logger = Logger.getLogger(ListCapacityCmd.class.getName());
+ private static final DecimalFormat s_percentFormat = new DecimalFormat("##.##");
+
+ private static final String s_name = "listcapacityresponse";
+
+ /////////////////////////////////////////////////////
+ //////////////// API parameters /////////////////////
+ /////////////////////////////////////////////////////
+
+ @Parameter(name=ApiConstants.TYPE, type=CommandType.INTEGER, required=true, description="lists capacity by type")
+ private Integer type;
+
+ @Parameter(name=ApiConstants.CLUSTER_ID, type=CommandType.LONG, description="lists capacity by the Cluster ID")
+ private Long clusterId;
+
+ @Parameter(name=ApiConstants.POD_ID, type=CommandType.LONG, description="lists capacity by the Pod ID")
+ private Long podId;
+
+ @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, description="lists capacity by the Zone ID")
+ private Long zoneId;
+
+
+ /////////////////////////////////////////////////////
+ /////////////////// Accessors ///////////////////////
+ /////////////////////////////////////////////////////
+
+ public Integer getType() {
+ return type;
+ }
+
+ public Long getClusterId() {
+ return clusterId;
+ }
+
+ public Long getPodId() {
+ return podId;
+ }
+
+ public Long getZoneId() {
+ return zoneId;
+ }
+
+ /////////////////////////////////////////////////////
+ /////////////// API Implementation///////////////////
+ /////////////////////////////////////////////////////
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ @Override
+ public void execute(){
+ List extends Capacity> result = _mgr.listCapacityByType(this);
+ ListResponse response = new ListResponse();
+ List capacityResponses = _responseGenerator.createCapacityResponse(result, s_percentFormat);
+ response.setResponses(capacityResponses);
+ response.setResponseName(getCommandName());
+ this.setResponseObject(response);
+ }
+}
diff --git a/api/src/com/cloud/server/ManagementService.java b/api/src/com/cloud/server/ManagementService.java
old mode 100644
new mode 100755
index 0f540a644ca..b0ec7b3e62c
--- a/api/src/com/cloud/server/ManagementService.java
+++ b/api/src/com/cloud/server/ManagementService.java
@@ -37,6 +37,7 @@ import com.cloud.api.commands.ListAccountsCmd;
import com.cloud.api.commands.ListAlertsCmd;
import com.cloud.api.commands.ListAsyncJobsCmd;
import com.cloud.api.commands.ListCapabilitiesCmd;
+import com.cloud.api.commands.ListCapacityByTypeCmd;
import com.cloud.api.commands.ListCapacityCmd;
import com.cloud.api.commands.ListCfgsByCmd;
import com.cloud.api.commands.ListClustersCmd;
@@ -299,6 +300,14 @@ public interface ManagementService {
*/
List extends Capacity> listCapacities(ListCapacityCmd cmd);
+ /**
+ * lists the capacity rows in capacity operations table
+ *
+ * @param cmd
+ * @return List of capacities
+ */
+ List extends Capacity> listCapacityByType(ListCapacityByTypeCmd cmd);
+
/**
* List the permissions on a template. This will return a list of account names that have been granted permission to launch
* instances from the template.
diff --git a/client/tomcatconf/commands.properties.in b/client/tomcatconf/commands.properties.in
index e2eb920db39..bb24ae65463 100755
--- a/client/tomcatconf/commands.properties.in
+++ b/client/tomcatconf/commands.properties.in
@@ -170,6 +170,7 @@ listAlerts=com.cloud.api.commands.ListAlertsCmd;3
#### system capacity commands
listCapacity=com.cloud.api.commands.ListCapacityCmd;3
+listCapacityByType=com.cloud.api.commands.ListCapacityByTypeCmd;3
#### host commands
addHost=com.cloud.api.commands.AddHostCmd;3
diff --git a/server/src/com/cloud/server/ManagementServerImpl.java b/server/src/com/cloud/server/ManagementServerImpl.java
index 25cc7a39acd..6b7661f096f 100755
--- a/server/src/com/cloud/server/ManagementServerImpl.java
+++ b/server/src/com/cloud/server/ManagementServerImpl.java
@@ -75,6 +75,7 @@ import com.cloud.api.commands.ListAccountsCmd;
import com.cloud.api.commands.ListAlertsCmd;
import com.cloud.api.commands.ListAsyncJobsCmd;
import com.cloud.api.commands.ListCapabilitiesCmd;
+import com.cloud.api.commands.ListCapacityByTypeCmd;
import com.cloud.api.commands.ListCapacityCmd;
import com.cloud.api.commands.ListCfgsByCmd;
import com.cloud.api.commands.ListClustersCmd;
@@ -3218,6 +3219,12 @@ public class ManagementServerImpl implements ManagementServer {
return _alertDao.search(sc, searchFilter);
}
+ @Override
+ public List listCapacityByType(ListCapacityByTypeCmd cmd) {
+ return null;
+
+ }
+
@Override
public List listCapacities(ListCapacityCmd cmd) {