[ 
https://issues.apache.org/jira/browse/CLOUDSTACK-10039?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16292445#comment-16292445
 ] 

ASF GitHub Bot commented on CLOUDSTACK-10039:
---------------------------------------------

rhtyd closed pull request #2294: [CLOUDSTACK-10039] Adding allocated IOPS to 
storage pool response
URL: https://github.com/apache/cloudstack/pull/2294
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git 
a/api/src/org/apache/cloudstack/api/response/StoragePoolResponse.java 
b/api/src/org/apache/cloudstack/api/response/StoragePoolResponse.java
index 02d5c44a93a..a03c2d8d751 100644
--- a/api/src/org/apache/cloudstack/api/response/StoragePoolResponse.java
+++ b/api/src/org/apache/cloudstack/api/response/StoragePoolResponse.java
@@ -93,6 +93,10 @@
     @Param(description = "IOPS CloudStack can provision from this storage 
pool")
     private Long capacityIops;
 
+    @SerializedName("allocatediops")
+    @Param(description = "total min IOPS currently in use by volumes")
+    private Long allocatedIops;
+
     @SerializedName("tags")
     @Param(description = "the tags for the storage pool")
     private String tags;
@@ -288,6 +292,10 @@ public void setCapacityIops(Long capacityIops) {
         this.capacityIops = capacityIops;
     }
 
+    public void setAllocatedIops(Long allocatedIops) {
+       this.allocatedIops = allocatedIops;
+    }
+
     public String getTags() {
         return tags;
     }
diff --git a/server/src/com/cloud/api/query/dao/StoragePoolJoinDaoImpl.java 
b/server/src/com/cloud/api/query/dao/StoragePoolJoinDaoImpl.java
index 37fdaefefcf..b8b312bd267 100644
--- a/server/src/com/cloud/api/query/dao/StoragePoolJoinDaoImpl.java
+++ b/server/src/com/cloud/api/query/dao/StoragePoolJoinDaoImpl.java
@@ -19,6 +19,7 @@
 import com.cloud.api.ApiDBUtils;
 import com.cloud.api.query.vo.StoragePoolJoinVO;
 import com.cloud.capacity.CapacityManager;
+import com.cloud.storage.DataStoreRole;
 import com.cloud.storage.StoragePool;
 import com.cloud.storage.StorageStats;
 import com.cloud.utils.StringUtils;
@@ -26,7 +27,11 @@
 import com.cloud.utils.db.SearchBuilder;
 import com.cloud.utils.db.SearchCriteria;
 import org.apache.cloudstack.api.response.StoragePoolResponse;
+import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
+import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager;
+import 
org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreDriver;
 import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
+import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
 import org.apache.log4j.Logger;
 import org.springframework.stereotype.Component;
 
@@ -41,6 +46,12 @@
     @Inject
     private ConfigurationDao _configDao;
 
+    @Inject
+    private DataStoreManager dataStoreMgr;
+
+    @Inject
+    protected PrimaryDataStoreDao storagePoolDao;
+
     private final SearchBuilder<StoragePoolJoinVO> spSearch;
 
     private final SearchBuilder<StoragePoolJoinVO> spIdSearch;
@@ -60,6 +71,7 @@ protected StoragePoolJoinDaoImpl() {
 
     @Override
     public StoragePoolResponse newStoragePoolResponse(StoragePoolJoinVO pool) {
+        StoragePool storagePool = storagePoolDao.findById(pool.getId());
         StoragePoolResponse poolResponse = new StoragePoolResponse();
         poolResponse.setId(pool.getUuid());
         poolResponse.setName(pool.getName());
@@ -87,6 +99,13 @@ public StoragePoolResponse 
newStoragePoolResponse(StoragePoolJoinVO pool) {
         poolResponse.setDiskSizeAllocated(allocatedSize);
         poolResponse.setCapacityIops(pool.getCapacityIops());
 
+        if (storagePool.isManaged()) {
+            DataStore store = dataStoreMgr.getDataStore(pool.getId(), 
DataStoreRole.Primary);
+            PrimaryDataStoreDriver driver = (PrimaryDataStoreDriver) 
store.getDriver();
+            long usedIops = driver.getUsedIops(storagePool);
+            poolResponse.setAllocatedIops(usedIops);
+        }
+
         // TODO: StatsCollector does not persist data
         StorageStats stats = ApiDBUtils.getStoragePoolStatistics(pool.getId());
         if (stats != null) {
diff --git a/ui/l10n/en.js b/ui/l10n/en.js
index 39e70727ba1..86134647e0e 100644
--- a/ui/l10n/en.js
+++ b/ui/l10n/en.js
@@ -661,6 +661,7 @@ var dictionary = {"ICMP.code":"ICMP Code",
 "label.disk.iops.min":"Min IOPS",
 "label.disk.iops.read.rate":"Disk Read Rate (IOPS)",
 "label.disk.iops.total":"IOPS Total",
+"label.disk.iops.allocated":"IOPS Allocated",
 "label.disk.iops.write.rate":"Disk Write Rate (IOPS)",
 "label.disk.offering":"Disk Offering",
 "label.disk.offering.details":"Disk offering details",
diff --git a/ui/scripts/system.js b/ui/scripts/system.js
index aa7136459e5..d05bfd3132d 100755
--- a/ui/scripts/system.js
+++ b/ui/scripts/system.js
@@ -18725,6 +18725,15 @@
                                             return ""; else
                                             return args;
                                         }
+                                    },
+                                    allocatediops: {
+                                        label: 'label.disk.iops.allocated',
+                                        isEditable: false,
+                                        converter: function (args) {
+                                            if (args == null || args == 0)
+                                            return ""; else
+                                            return args;
+                                        }
                                     }
                                 }],
 


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Adding IOPS/GB offering
> -----------------------
>
>                 Key: CLOUDSTACK-10039
>                 URL: https://issues.apache.org/jira/browse/CLOUDSTACK-10039
>             Project: CloudStack
>          Issue Type: New Feature
>      Security Level: Public(Anyone can view this level - this is the 
> default.) 
>          Components: Storage Controller
>            Reporter: Syed Ahmed
>             Fix For: Future
>
>
> We want to add a disk offering where we can specify the Min/Max IOPS as a 
> function of size. The idea is the larger volume you create, the greater your 
> IOPS will be (this is similar to the way GCE handles IOPS). We also have 
> added limits to the IOPS (min and max) so that once the volume goes beyond a 
> certain size, the IOPS won't change and are capped to the given values.
> The following parameters are added to the `createDiskOffering` API:
> 1. `miniopspergb' : Minimum IOPS/GB for the offering
> 2. `maxiopspergb`: Maximum IOPS/GB for the offering
> 3. `highestminiops`: The highest `miniops` value that is allowed for this 
> offering
> 3. `highestmaxiops`: The highest `maxiops` value that is allowed for this 
> offering



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to