cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mtutkow...@apache.org
Subject git commit: updated refs/heads/master to 2042660
Date Wed, 12 Nov 2014 20:39:08 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/master 52bc08423 -> 2042660a6


Added a "long getUsedIops(StoragePool)" method to the PrimaryDataStoreDriver interface


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/2042660a
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/2042660a
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/2042660a

Branch: refs/heads/master
Commit: 2042660a68576b366a3478c6c6ee10516f9c21e7
Parents: 52bc084
Author: Mike Tutkowski <mike.tutkowski@solidfire.com>
Authored: Wed Nov 12 12:50:33 2014 -0700
Committer: Mike Tutkowski <mike.tutkowski@solidfire.com>
Committed: Wed Nov 12 13:38:58 2014 -0700

----------------------------------------------------------------------
 .../api/storage/PrimaryDataStoreDriver.java     |  5 +++++
 .../test/FakePrimaryDataStoreDriver.java        |  5 +++++
 .../CloudStackPrimaryDataStoreDriverImpl.java   |  5 +++++
 .../driver/NexentaPrimaryDataStoreDriver.java   |  5 +++++
 .../SamplePrimaryDataStoreDriverImpl.java       |  5 +++++
 .../driver/SolidFirePrimaryDataStoreDriver.java | 22 +++++++++++++++-----
 .../com/cloud/capacity/CapacityManagerImpl.java | 14 ++++++-------
 7 files changed, 48 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2042660a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/PrimaryDataStoreDriver.java
----------------------------------------------------------------------
diff --git a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/PrimaryDataStoreDriver.java
b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/PrimaryDataStoreDriver.java
index ebaa260..5e7090d 100644
--- a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/PrimaryDataStoreDriver.java
+++ b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/PrimaryDataStoreDriver.java
@@ -41,6 +41,11 @@ public interface PrimaryDataStoreDriver extends DataStoreDriver {
     // if not managed storage, return 0
     public long getUsedBytes(StoragePool storagePool);
 
+    // intended for managed storage (cloud.storage_pool.managed = true)
+    // if managed storage, return the total number of IOPS currently in use for the storage
pool in question
+    // if not managed storage, return 0
+    public long getUsedIops(StoragePool storagePool);
+
     public void takeSnapshot(SnapshotInfo snapshot, AsyncCompletionCallback<CreateCmdResult>
callback);
 
     public void revertSnapshot(SnapshotInfo snapshot, AsyncCompletionCallback<CommandResult>
callback);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2042660a/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/FakePrimaryDataStoreDriver.java
----------------------------------------------------------------------
diff --git a/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/FakePrimaryDataStoreDriver.java
b/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/FakePrimaryDataStoreDriver.java
index 4810fbd..1f1ba24 100644
--- a/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/FakePrimaryDataStoreDriver.java
+++ b/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/FakePrimaryDataStoreDriver.java
@@ -60,6 +60,11 @@ public class FakePrimaryDataStoreDriver implements PrimaryDataStoreDriver
{
     }
 
     @Override
+    public long getUsedIops(StoragePool storagePool) {
+        return 0;
+    }
+
+    @Override
     public long getVolumeSizeIncludingHypervisorSnapshotReserve(Volume volume, StoragePool
pool) {
         return volume.getSize();
     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2042660a/plugins/storage/volume/default/src/org/apache/cloudstack/storage/datastore/driver/CloudStackPrimaryDataStoreDriverImpl.java
----------------------------------------------------------------------
diff --git a/plugins/storage/volume/default/src/org/apache/cloudstack/storage/datastore/driver/CloudStackPrimaryDataStoreDriverImpl.java
b/plugins/storage/volume/default/src/org/apache/cloudstack/storage/datastore/driver/CloudStackPrimaryDataStoreDriverImpl.java
index 9421102..e416bf8 100644
--- a/plugins/storage/volume/default/src/org/apache/cloudstack/storage/datastore/driver/CloudStackPrimaryDataStoreDriverImpl.java
+++ b/plugins/storage/volume/default/src/org/apache/cloudstack/storage/datastore/driver/CloudStackPrimaryDataStoreDriverImpl.java
@@ -163,6 +163,11 @@ public class CloudStackPrimaryDataStoreDriverImpl implements PrimaryDataStoreDri
     }
 
     @Override
+    public long getUsedIops(StoragePool storagePool) {
+        return 0;
+    }
+
+    @Override
     public long getVolumeSizeIncludingHypervisorSnapshotReserve(Volume volume, StoragePool
pool) {
         return volume.getSize();
     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2042660a/plugins/storage/volume/nexenta/src/org/apache/cloudstack/storage/datastore/driver/NexentaPrimaryDataStoreDriver.java
----------------------------------------------------------------------
diff --git a/plugins/storage/volume/nexenta/src/org/apache/cloudstack/storage/datastore/driver/NexentaPrimaryDataStoreDriver.java
b/plugins/storage/volume/nexenta/src/org/apache/cloudstack/storage/datastore/driver/NexentaPrimaryDataStoreDriver.java
index bae54f1..7ce46a2 100644
--- a/plugins/storage/volume/nexenta/src/org/apache/cloudstack/storage/datastore/driver/NexentaPrimaryDataStoreDriver.java
+++ b/plugins/storage/volume/nexenta/src/org/apache/cloudstack/storage/datastore/driver/NexentaPrimaryDataStoreDriver.java
@@ -73,6 +73,11 @@ public class NexentaPrimaryDataStoreDriver implements PrimaryDataStoreDriver
{
     }
 
     @Override
+    public long getUsedIops(StoragePool storagePool) {
+        return 0;
+    }
+
+    @Override
     public long getVolumeSizeIncludingHypervisorSnapshotReserve(Volume volume, StoragePool
pool) {
         return 0;  //To change body of implemented methods use File | Settings | File Templates.
     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2042660a/plugins/storage/volume/sample/src/org/apache/cloudstack/storage/datastore/driver/SamplePrimaryDataStoreDriverImpl.java
----------------------------------------------------------------------
diff --git a/plugins/storage/volume/sample/src/org/apache/cloudstack/storage/datastore/driver/SamplePrimaryDataStoreDriverImpl.java
b/plugins/storage/volume/sample/src/org/apache/cloudstack/storage/datastore/driver/SamplePrimaryDataStoreDriverImpl.java
index 6ff62e9..7c989d2 100644
--- a/plugins/storage/volume/sample/src/org/apache/cloudstack/storage/datastore/driver/SamplePrimaryDataStoreDriverImpl.java
+++ b/plugins/storage/volume/sample/src/org/apache/cloudstack/storage/datastore/driver/SamplePrimaryDataStoreDriverImpl.java
@@ -93,6 +93,11 @@ public class SamplePrimaryDataStoreDriverImpl implements PrimaryDataStoreDriver
     }
 
     @Override
+    public long getUsedIops(StoragePool storagePool) {
+        return 0;
+    }
+
+    @Override
     public long getVolumeSizeIncludingHypervisorSnapshotReserve(Volume volume, StoragePool
pool) {
         return volume.getSize();
     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2042660a/plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/driver/SolidFirePrimaryDataStoreDriver.java
----------------------------------------------------------------------
diff --git a/plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/driver/SolidFirePrimaryDataStoreDriver.java
b/plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/driver/SolidFirePrimaryDataStoreDriver.java
index 008693c..485cffa 100644
--- a/plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/driver/SolidFirePrimaryDataStoreDriver.java
+++ b/plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/driver/SolidFirePrimaryDataStoreDriver.java
@@ -48,7 +48,6 @@ import com.cloud.agent.api.to.DataObjectType;
 import com.cloud.agent.api.to.DataStoreTO;
 import com.cloud.agent.api.to.DataTO;
 import com.cloud.agent.api.to.DiskTO;
-import com.cloud.capacity.CapacityManager;
 import com.cloud.dc.ClusterVO;
 import com.cloud.dc.ClusterDetailsVO;
 import com.cloud.dc.ClusterDetailsDao;
@@ -79,7 +78,6 @@ public class SolidFirePrimaryDataStoreDriver implements PrimaryDataStoreDriver
{
 
     @Inject private AccountDao _accountDao;
     @Inject private AccountDetailsDao _accountDetailsDao;
-    @Inject private CapacityManager _capacityMgr;
     @Inject private ClusterDao _clusterDao;
     @Inject private ClusterDetailsDao _clusterDetailsDao;
     @Inject private HostDao _hostDao;
@@ -306,6 +304,21 @@ public class SolidFirePrimaryDataStoreDriver implements PrimaryDataStoreDriver
{
     }
 
     @Override
+    public long getUsedIops(StoragePool storagePool) {
+        long usedIops = 0;
+
+        List<VolumeVO> volumes = _volumeDao.findByPoolId(storagePool.getId(), null);
+
+        if (volumes != null) {
+            for (VolumeVO volume : volumes) {
+                usedIops += volume.getMinIops() != null ? volume.getMinIops() : 0;
+            }
+        }
+
+        return usedIops;
+    }
+
+    @Override
     public long getVolumeSizeIncludingHypervisorSnapshotReserve(Volume volume, StoragePool
pool) {
         long volumeSize = volume.getSize();
         Integer hypervisorSnapshotReserve = volume.getHypervisorSnapshotReserve();
@@ -536,9 +549,8 @@ public class SolidFirePrimaryDataStoreDriver implements PrimaryDataStoreDriver
{
 
             storagePool.setUsedBytes(usedBytes);
 
-            /** @todo Mike T. fill in the CloudStackVolumeSize */
             long sfNewVolumeId = SolidFireUtil.createSolidFireVolume(sfConnection, snapshotInfo.getUuid(),
sfVolume.getAccountId(), sfVolumeSize,
-                    sfVolume.isEnable512e(), "", sfVolume.getMinIops(), sfVolume.getMaxIops(),
sfVolume.getBurstIops());
+                    sfVolume.isEnable512e(), NumberFormat.getInstance().format(volumeInfo.getSize()),
sfVolume.getMinIops(), 50000, 75000);
 
             // Now that we have successfully created a volume, update the space usage in
the storage_pool table
             // (even though storage_pool.used_bytes is likely no longer in use).
@@ -691,7 +703,7 @@ public class SolidFirePrimaryDataStoreDriver implements PrimaryDataStoreDriver
{
 
         // if the desire is for more IOPS
         if (diffInMinIops > 0) {
-            long usedIops = _capacityMgr.getUsedIops(storagePool);
+            long usedIops = getUsedIops(storagePool);
             long capacityIops = storagePool.getCapacityIops();
 
             if (usedIops + diffInMinIops > capacityIops) {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2042660a/server/src/com/cloud/capacity/CapacityManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/capacity/CapacityManagerImpl.java b/server/src/com/cloud/capacity/CapacityManagerImpl.java
index 6866444..a5521cc 100755
--- a/server/src/com/cloud/capacity/CapacityManagerImpl.java
+++ b/server/src/com/cloud/capacity/CapacityManagerImpl.java
@@ -77,7 +77,6 @@ import com.cloud.service.dao.ServiceOfferingDao;
 import com.cloud.storage.StorageManager;
 import com.cloud.storage.VMTemplateStoragePoolVO;
 import com.cloud.storage.VMTemplateVO;
-import com.cloud.storage.VolumeVO;
 import com.cloud.storage.dao.VMTemplatePoolDao;
 import com.cloud.storage.dao.VolumeDao;
 import com.cloud.utils.DateUtil;
@@ -531,17 +530,16 @@ public class CapacityManagerImpl extends ManagerBase implements CapacityManager,
 
     @Override
     public long getUsedIops(StoragePoolVO pool) {
-        long usedIops = 0;
+        DataStoreProvider storeProvider = _dataStoreProviderMgr.getDataStoreProvider(pool.getStorageProviderName());
+        DataStoreDriver storeDriver = storeProvider.getDataStoreDriver();
 
-        List<VolumeVO> volumes = _volumeDao.findByPoolId(pool.getId(), null);
+        if (storeDriver instanceof PrimaryDataStoreDriver) {
+            PrimaryDataStoreDriver primaryStoreDriver = (PrimaryDataStoreDriver)storeDriver;
 
-        if (volumes != null) {
-            for (VolumeVO volume : volumes) {
-                usedIops += volume.getMinIops() != null ? volume.getMinIops() : 0;
-            }
+            return primaryStoreDriver.getUsedIops(pool);
         }
 
-        return usedIops;
+        throw new CloudRuntimeException("Storage driver in CapacityManagerImpl.getUsedIops(StoragePoolVO)
is not a PrimaryDataStoreDriver.");
     }
 
     @Override


Mime
View raw message