[
https://issues.apache.org/jira/browse/CLOUDSTACK-8856?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15787367#comment-15787367
]
ASF GitHub Bot commented on CLOUDSTACK-8856:
--------------------------------------------
Github user koteswararavipati commented on a diff in the pull request:
https://github.com/apache/cloudstack/pull/865#discussion_r94215553
--- Diff: server/src/com/cloud/server/ManagementServerImpl.java ---
@@ -2488,6 +2479,23 @@ public int compare(final SummedCapacity arg0, final
SummedCapacity arg1) {
final SummedCapacity summedCapacity = new
SummedCapacity(capacity.getUsedCapacity(), capacity.getTotalCapacity(),
capacity.getUsedPercentage(),
capacity.getCapacityType(),
capacity.getDataCenterId(), capacity.getPodId(), capacity.getClusterId());
list.add(summedCapacity);
+ }
+ } else {
+ List<DataCenterVO> dcList = _dcDao.listEnabledZones();
+ for (DataCenterVO dc : dcList) {
+ List<CapacityVO> capacities=new
ArrayList<CapacityVO>();
+
capacities.add(_storageMgr.getSecondaryStorageUsedStats(null, dc.getId()));
+
capacities.add(_storageMgr.getStoragePoolUsedStats(null, null, null,
dc.getId()));
+ for (CapacityVO capacity : capacities) {
+ if (capacity.getTotalCapacity() != 0) {
+
capacity.setUsedPercentage((float)capacity.getUsedCapacity() /
capacity.getTotalCapacity());
+ } else {
+ capacity.setUsedPercentage(0);
+ }
+ SummedCapacity summedCapacity = new
SummedCapacity(capacity.getUsedCapacity(), capacity.getTotalCapacity(),
capacity.getUsedPercentage(),
+ capacity.getCapacityType(),
capacity.getDataCenterId(), capacity.getPodId(), capacity.getClusterId());
+ list.add(summedCapacity);
+ }
}// End of for
--- End diff --
I test this issue manually and looks good.
> Primary Storage Used(type tag with value 2) related tag is not showing in
> listCapacity api response
> ---------------------------------------------------------------------------------------------------
>
> Key: CLOUDSTACK-8856
> URL: https://issues.apache.org/jira/browse/CLOUDSTACK-8856
> Project: CloudStack
> Issue Type: Bug
> Security Level: Public(Anyone can view this level - this is the
> default.)
> Reporter: Bharat Kumar
> Assignee: Bharat Kumar
>
> Actual behavior:
> Primary Storage Used(type tag with value 2) related tag is showing in
> listCapacity api response when 'sortby=Usage' parameter is removed in
> listCapacity api.
> Expected behavior:
> Primary Storage Used(type tag with value 2) related tag should be shown in
> listCapacity api response when 'sortby=Usage' parameter is included in
> listCapacity api.
> Steps to reproduce:
> 1.Login cloudstack as admin and launch one vm successfully.
> 2.Make sure that firebug tool is enable and navigate to Dashboard.
> 3.Right click on 'listCapacity' api and select 'Copy Location'.
> 4.Remove 'response=json' parameter from above copied url and paste the
> modified url in new tab.
> 5.Check for 'type tag with value 2' in 'listCapcity' api xml response.
> listCapacity API Command:
> http://10.81.29.87/client/api?command=listCapacity&sessionkey=Qp0XOEUVLrZHBZrQp7ame96IzXE%3D&fetchLatest=true&sortBy=usage&_=1417697306264
> Response:
> <?xml version="1.0" encoding="UTF-8"?>
> -<listcapacityresponse cloud-stack-version="4.5.0-SNAPSHOT">
> <count>9</count>
> -<capacity>
> <type>5</type>
> <zoneid>25cb4986-c286-4937-a0ec-b290307eaa4f</zoneid>
> <zonename>XenRT-Zone-0</zonename>
> <capacityused>3</capacityused>
> <capacitytotal>5</capacitytotal>
> <percentused>60</percentused>
> </capacity>
> -<capacity>
> <type>4</type>
> <zoneid>25cb4986-c286-4937-a0ec-b290307eaa4f</zoneid>
> <zonename>XenRT-Zone-0</zonename>
> <capacityused>3</capacityused>
> <capacitytotal>15</capacitytotal>
> <percentused>20</percentused>
> </capacity>
> -<capacity>
> <type>7</type>
> <zoneid>25cb4986-c286-4937-a0ec-b290307eaa4f</zoneid>
> <zonename>XenRT-Zone-0</zonename>
> <capacityused>1</capacityused>
> <capacitytotal>5</capacitytotal>
> <percentused>20</percentused>
> </capacity>
> -<capacity>
> <type>6</type>
> <zoneid>25cb4986-c286-4937-a0ec-b290307eaa4f</zoneid>
> <zonename>XenRT-Zone-0</zonename>
> <capacityused>227751755776</capacityused>
> <capacitytotal>4395909513216</capacitytotal>
> <percentused>5.18</percentused>
> </capacity>
> -<capacity>
> <type>0</type>
> <zoneid>25cb4986-c286-4937-a0ec-b290307eaa4f</zoneid>
> <zonename>XenRT-Zone-0</zonename>
> <capacityused>2952790016</capacityused>
> <capacitytotal>124470096896</capacitytotal>
> <percentused>2.37</percentused>
> </capacity>
> -<capacity>
> <type>1</type>
> <zoneid>25cb4986-c286-4937-a0ec-b290307eaa4f</zoneid>
> <zonename>XenRT-Zone-0</zonename>
> <capacityused>2000</capacityused>
> <capacitytotal>100800</capacitytotal>
> <percentused>1.98</percentused>
> </capacity>
> -<capacity>
> <type>3</type>
> <zoneid>25cb4986-c286-4937-a0ec-b290307eaa4f</zoneid>
> <zonename>XenRT-Zone-0</zonename>
> <capacityused>29339156480</capacityused>
> <capacitytotal>8791819026432</capacitytotal>
> <percentused>0.33</percentused>
> </capacity>
> -<capacity>
> <type>9</type>
> <zoneid>25cb4986-c286-4937-a0ec-b290307eaa4f</zoneid>
> <zonename>XenRT-Zone-0</zonename>
> <capacityused>8388608</capacityused>
> <capacitytotal>981911732224</capacitytotal>
> <percentused>0</percentused>
> </capacity>
> -<capacity>
> <type>19</type>
> <zoneid>25cb4986-c286-4937-a0ec-b290307eaa4f</zoneid>
> <zonename>XenRT-Zone-0</zonename>
> <capacityused>0</capacityused>
> <capacitytotal>0</capacitytotal>
> <percentused>0</percentused>
> </capacity>
> </listcapacityresponse>
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)