cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mtutkow...@apache.org
Subject [23/50] git commit: updated refs/heads/sf-plugins to 157efc3
Date Sat, 19 Sep 2015 01:31:29 GMT
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/ab601866
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/ab601866
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/ab601866

Branch: refs/heads/sf-plugins
Commit: ab6018665911a6c744baf43629ff79fdbc3e441b
Parents: 6bee875
Author: Mike Tutkowski <mike.tutkowski@solidfire.com>
Authored: Sun Jul 12 22:35:33 2015 -0600
Committer: Mike Tutkowski <mike.tutkowski@solidfire.com>
Committed: Fri Sep 18 19:28:20 2015 -0600

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


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ab601866/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.");
+        }
+    }
 }


Mime
View raw message