Skip to content

Commit d4ea9d1

Browse files
committed
Adding IOPS/GB offering
1 parent c384239 commit d4ea9d1

13 files changed

Lines changed: 1066 additions & 172 deletions

File tree

api/src/com/cloud/offering/DiskOffering.java

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,12 @@
1616
// under the License.
1717
package com.cloud.offering;
1818

19-
import java.util.Date;
20-
19+
import com.cloud.storage.Storage.ProvisioningType;
2120
import org.apache.cloudstack.acl.InfrastructureEntity;
2221
import org.apache.cloudstack.api.Identity;
2322
import org.apache.cloudstack.api.InternalIdentity;
2423

25-
import com.cloud.storage.Storage.ProvisioningType;
24+
import java.util.Date;
2625

2726
/**
2827
* Represents a disk offering that specifies what the end user needs in
@@ -111,6 +110,22 @@ public String toString() {
111110

112111
Long getIopsWriteRate();
113112

113+
Long getMinIopsPerGb();
114+
115+
void setMinIopsPerGb(Long minIopsPerGB);
116+
117+
Long getMaxIopsPerGb();
118+
119+
void setMaxIopsPerGb(Long maxIopsPerGB);
120+
121+
Long getHighestMinIops();
122+
123+
void setHighestMinIops(Long highestMinIops);
124+
125+
Long getHighestMaxIops();
126+
127+
void setHighestMaxIops(Long highestMaxIops);
128+
114129
void setHypervisorSnapshotReserve(Integer hypervisorSnapshotReserve);
115130

116131
Integer getHypervisorSnapshotReserve();

api/src/org/apache/cloudstack/api/ApiConstants.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -654,6 +654,10 @@ public class ApiConstants {
654654
public static final String CLEAN_UP_DETAILS = "cleanupdetails";
655655
public static final String NETSCALER_CONTROLCENTER_ID = "netscalercontrolcenterid";
656656
public static final String NETSCALER_SERVICEPACKAGE_ID = "netscalerservicepackageid";
657+
public static final String MIN_IOPS_PER_GB = "miniopspergb";
658+
public static final String MAX_IOPS_PER_GB = "maxiopspergb";
659+
public static final String HIGHEST_MIN_IOPS = "highestminiops";
660+
public static final String HIGHEST_MAX_IOPS = "highestmaxiops";
657661

658662
public static final String ZONE_ID_LIST = "zoneids";
659663
public static final String DESTINATION_ZONE_ID_LIST = "destzoneids";

api/src/org/apache/cloudstack/api/command/admin/offering/CreateDiskOfferingCmd.java

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,18 @@ public class CreateDiskOfferingCmd extends BaseCmd {
9898
@Parameter(name = ApiConstants.MAX_IOPS, type = CommandType.LONG, required = false, description = "max iops of the disk offering")
9999
private Long maxIops;
100100

101+
@Parameter(name = ApiConstants.MIN_IOPS_PER_GB, type = CommandType.LONG, required = false, description = "IOPS/GB rate for min IOPS. miniops = size * miniopspergb")
102+
private Long minIopsPerGb;
103+
104+
@Parameter(name = ApiConstants.MAX_IOPS_PER_GB, type = CommandType.LONG, required = false, description = "IOPS/GB rate for max IOPS. maxiops = size * maxiopspergb")
105+
private Long maxIopsPerGb;
106+
107+
@Parameter(name = ApiConstants.HIGHEST_MIN_IOPS, type = CommandType.LONG, required = false, description = "Highest Min IOPS value that is allowed for this offering")
108+
private Long highestMinIops;
109+
110+
@Parameter(name = ApiConstants.HIGHEST_MAX_IOPS, type = CommandType.LONG, required = false, description = "Highest Max IOPS value that is allowed for this offering")
111+
private Long highestMaxIops;
112+
101113
@Parameter(name = ApiConstants.HYPERVISOR_SNAPSHOT_RESERVE,
102114
type = CommandType.INTEGER,
103115
required = false,
@@ -176,6 +188,21 @@ public Integer getHypervisorSnapshotReserve() {
176188
return hypervisorSnapshotReserve;
177189
}
178190

191+
public Long getMinIopsPerGb() {
192+
return minIopsPerGb;
193+
}
194+
195+
public Long getMaxIopsPerGb() {
196+
return maxIopsPerGb;
197+
}
198+
199+
public Long getHighestMinIops() {
200+
return highestMinIops;
201+
}
202+
203+
public Long getHighestMaxIops() {
204+
return highestMaxIops;
205+
}
179206
/////////////////////////////////////////////////////
180207
/////////////// API Implementation///////////////////
181208
/////////////////////////////////////////////////////

engine/schema/src/com/cloud/storage/DiskOfferingVO.java

Lines changed: 58 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,8 @@
1616
// under the License.
1717
package com.cloud.storage;
1818

19-
import java.util.Date;
20-
import java.util.List;
21-
import java.util.UUID;
19+
import com.cloud.offering.DiskOffering;
20+
import com.cloud.utils.db.GenericDao;
2221

2322
import javax.persistence.Column;
2423
import javax.persistence.DiscriminatorColumn;
@@ -35,9 +34,9 @@
3534
import javax.persistence.Temporal;
3635
import javax.persistence.TemporalType;
3736
import javax.persistence.Transient;
38-
39-
import com.cloud.offering.DiskOffering;
40-
import com.cloud.utils.db.GenericDao;
37+
import java.util.Date;
38+
import java.util.List;
39+
import java.util.UUID;
4140

4241
@Entity
4342
@Table(name = "disk_offering")
@@ -117,6 +116,18 @@ public class DiskOfferingVO implements DiskOffering {
117116
@Column(name = "iops_write_rate")
118117
Long iopsWriteRate;
119118

119+
@Column(name = "min_iops_per_gb")
120+
Long minIopsPerGb;
121+
122+
@Column(name = "max_iops_per_gb")
123+
Long maxIopsPerGb;
124+
125+
@Column(name = "highest_min_iops")
126+
Long highestMinIops;
127+
128+
@Column(name = "highest_max_iops")
129+
Long highestMaxIops;
130+
120131
@Column(name = "cache_mode", updatable = true, nullable = false)
121132
@Enumerated(value = EnumType.STRING)
122133
private DiskCacheMode cacheMode;
@@ -465,7 +476,7 @@ public void setDisplayOffering(boolean displayOffering) {
465476
this.displayOffering = displayOffering;
466477
}
467478

468-
@Override
479+
@Override
469480
public void setBytesReadRate(Long bytesReadRate) {
470481
this.bytesReadRate = bytesReadRate;
471482
}
@@ -505,6 +516,46 @@ public Long getIopsWriteRate() {
505516
return iopsWriteRate;
506517
}
507518

519+
@Override
520+
public Long getMinIopsPerGb() {
521+
return this.minIopsPerGb;
522+
}
523+
524+
@Override
525+
public void setMinIopsPerGb(Long minIopsPerGb) {
526+
this.minIopsPerGb = minIopsPerGb;
527+
}
528+
529+
@Override
530+
public Long getMaxIopsPerGb() {
531+
return maxIopsPerGb;
532+
}
533+
534+
@Override
535+
public void setMaxIopsPerGb(Long maxIopsPerGb) {
536+
this.maxIopsPerGb = maxIopsPerGb;
537+
}
538+
539+
@Override
540+
public Long getHighestMinIops() {
541+
return this.highestMinIops;
542+
}
543+
544+
@Override
545+
public void setHighestMinIops(Long highestMinIops) {
546+
this.highestMinIops = highestMinIops;
547+
}
548+
549+
@Override
550+
public Long getHighestMaxIops() {
551+
return this.highestMaxIops;
552+
}
553+
554+
@Override
555+
public void setHighestMaxIops(Long highestMaxIops) {
556+
this.highestMaxIops = highestMaxIops;
557+
}
558+
508559
@Override
509560
public void setHypervisorSnapshotReserve(Integer hypervisorSnapshotReserve) {
510561
this.hypervisorSnapshotReserve = hypervisorSnapshotReserve;

0 commit comments

Comments
 (0)