You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by mt...@apache.org on 2015/07/28 22:15:20 UTC

[34/50] git commit: updated refs/heads/sf-plugins to bcf1c72

Perform basic verification on the passed-in IOPS values


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

Branch: refs/heads/sf-plugins
Commit: 7871e772690f7cac74f23b039b8625d6ab219ea1
Parents: 03f60e6
Author: Mike Tutkowski <mi...@solidfire.com>
Authored: Sun Jul 12 22:35:33 2015 -0600
Committer: CloudStack <cloudstack@cloudstack-virtual-machine.(none)>
Committed: Tue Jul 28 13:42:43 2015 -0600

----------------------------------------------------------------------
 .../solidfire/ApiSolidFireServiceImpl2.java       | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7871e772/plugins/api/solidfire/src/org/apache/cloudstack/solidfire/ApiSolidFireServiceImpl2.java
----------------------------------------------------------------------
diff --git a/plugins/api/solidfire/src/org/apache/cloudstack/solidfire/ApiSolidFireServiceImpl2.java b/plugins/api/solidfire/src/org/apache/cloudstack/solidfire/ApiSolidFireServiceImpl2.java
index d91febc..7c585a8 100644
--- a/plugins/api/solidfire/src/org/apache/cloudstack/solidfire/ApiSolidFireServiceImpl2.java
+++ b/plugins/api/solidfire/src/org/apache/cloudstack/solidfire/ApiSolidFireServiceImpl2.java
@@ -639,6 +639,8 @@ public class ApiSolidFireServiceImpl2 extends AdapterBase implements APIChecker,
     }
 
     private SfVolume createVolume(String name, long size, long minIops, long maxIops, long burstIops, long accountId, long sfVirtualNetworkId) {
+        verifyIops(minIops, maxIops, burstIops);
+
         Account account = _accountDao.findById(accountId);
 
         SfVirtualNetwork sfVirtualNetwork = getSfVirtualNetwork(sfVirtualNetworkId);
@@ -740,6 +742,8 @@ public class ApiSolidFireServiceImpl2 extends AdapterBase implements APIChecker,
     }
 
     private SfVolumeVO updateVolume(SfVolumeVO sfVolumeVO, long size, long minIops, long maxIops, long burstIops) {
+        verifyIops(minIops, maxIops, burstIops);
+
         SfVirtualNetwork sfVirtualNetwork = getSfVirtualNetwork(sfVolumeVO.getSfVirtualNetworkId());
 
         Account account = _accountDao.findById(sfVirtualNetwork.getAccountId());
@@ -989,4 +993,18 @@ public class ApiSolidFireServiceImpl2 extends AdapterBase implements APIChecker,
 
         return sfVirtualNetworkVOsToReturn;
     }
+
+    private static void verifyIops(long minIops, long maxIops, long burstIops) {
+        if (minIops <= 0 || maxIops <= 0 || burstIops <= 0) {
+            throw new IllegalArgumentException("The 'Min IOPS', 'Max IOPS', and 'Burst IOPS' values must be greater than 0.");
+        }
+
+        if (minIops > maxIops) {
+            throw new IllegalArgumentException("The 'Min IOPS' value cannot exceed the 'Max IOPS' value.");
+        }
+
+        if (maxIops > burstIops) {
+            throw new IllegalArgumentException("The 'Max IOPS' value cannot exceed the 'Burst IOPS' value.");
+        }
+    }
 }