[GitHub] cloudstack issue #865: CLOUDSTACK-8856 Primary Storage Used(type tag with va...

2016-12-30 Thread koteswararavipati
Github user koteswararavipati commented on the issue:

https://github.com/apache/cloudstack/pull/865
  
LGTM:
I tested this issue manually and looks good.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request #865: CLOUDSTACK-8856 Primary Storage Used(type tag ...

2016-12-30 Thread koteswararavipati
Github user koteswararavipati commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/865#discussion_r94215572
  
--- 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 dcList = _dcDao.listEnabledZones();
+for (DataCenterVO dc : dcList) {
+List capacities=new 
ArrayList();
+
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 tested this issue manually and looks good.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request #865: CLOUDSTACK-8856 Primary Storage Used(type tag ...

2016-12-30 Thread koteswararavipati
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 dcList = _dcDao.listEnabledZones();
+for (DataCenterVO dc : dcList) {
+List capacities=new 
ArrayList();
+
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.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---