Skip to content

Commit 882220e

Browse files
committed
CLOUDSTACK-1301: VM Disk I/O Throttling
1 parent 9e2eeb2 commit 882220e

32 files changed

Lines changed: 1007 additions & 15 deletions

api/src/com/cloud/agent/api/to/VolumeTO.java

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ protected VolumeTO() {
3737
private long deviceId;
3838
private String chainInfo;
3939
private String guestOsType;
40+
private Long bytesReadRate;
41+
private Long bytesWriteRate;
42+
private Long iopsReadRate;
43+
private Long iopsWriteRate;
4044

4145
public VolumeTO(long id, Volume.Type type, StoragePoolType poolType, String poolUuid, String name, String mountPoint, String path, long size, String chainInfo) {
4246
this.id = id;
@@ -133,4 +137,37 @@ public void setPath(String path){
133137
public String toString() {
134138
return new StringBuilder("Vol[").append(id).append("|").append(type).append("|").append(path).append("|").append(size).append("]").toString();
135139
}
140+
141+
public void setBytesReadRate(Long bytesReadRate) {
142+
this.bytesReadRate = bytesReadRate;
143+
}
144+
145+
public Long getBytesReadRate() {
146+
return bytesReadRate;
147+
}
148+
149+
public void setBytesWriteRate(Long bytesWriteRate) {
150+
this.bytesWriteRate = bytesWriteRate;
151+
}
152+
153+
public Long getBytesWriteRate() {
154+
return bytesWriteRate;
155+
}
156+
157+
public void setIopsReadRate(Long iopsReadRate) {
158+
this.iopsReadRate = iopsReadRate;
159+
}
160+
161+
public Long getIopsReadRate() {
162+
return iopsReadRate;
163+
}
164+
165+
public void setIopsWriteRate(Long iopsWriteRate) {
166+
this.iopsWriteRate = iopsWriteRate;
167+
}
168+
169+
public Long getIopsWriteRate() {
170+
return iopsWriteRate;
171+
}
172+
136173
}

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,20 @@ public interface DiskOffering extends InfrastructureEntity, Identity, InternalId
5252
boolean isCustomized();
5353

5454
void setDiskSize(long diskSize);
55+
56+
void setBytesReadRate(Long bytesReadRate);
57+
58+
Long getBytesReadRate();
59+
60+
void setBytesWriteRate(Long bytesWriteRate);
61+
62+
Long getBytesWriteRate();
63+
64+
void setIopsReadRate(Long iopsReadRate);
65+
66+
Long getIopsReadRate();
67+
68+
void setIopsWriteRate(Long iopsWriteRate);
69+
70+
Long getIopsWriteRate();
5571
}

api/src/com/cloud/vm/DiskProfile.java

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ public class DiskProfile {
3535
private Long templateId;
3636
private long volumeId;
3737
private String path;
38+
private Long bytesReadRate;
39+
private Long bytesWriteRate;
40+
private Long iopsReadRate;
41+
private Long iopsWriteRate;
3842

3943
private HypervisorType hyperType;
4044

@@ -154,4 +158,36 @@ public String getPath() {
154158
public void setSize(long size) {
155159
this.size = size;
156160
}
161+
162+
public void setBytesReadRate(Long bytesReadRate) {
163+
this.bytesReadRate = bytesReadRate;
164+
}
165+
166+
public Long getBytesReadRate() {
167+
return bytesReadRate;
168+
}
169+
170+
public void setBytesWriteRate(Long bytesWriteRate) {
171+
this.bytesWriteRate = bytesWriteRate;
172+
}
173+
174+
public Long getBytesWriteRate() {
175+
return bytesWriteRate;
176+
}
177+
178+
public void setIopsReadRate(Long iopsReadRate) {
179+
this.iopsReadRate = iopsReadRate;
180+
}
181+
182+
public Long getIopsReadRate() {
183+
return iopsReadRate;
184+
}
185+
186+
public void setIopsWriteRate(Long iopsWriteRate) {
187+
this.iopsWriteRate = iopsWriteRate;
188+
}
189+
190+
public Long getIopsWriteRate() {
191+
return iopsWriteRate;
192+
}
157193
}

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ public class ApiConstants {
3131
public static final String BOOTABLE = "bootable";
3232
public static final String BIND_DN = "binddn";
3333
public static final String BIND_PASSWORD = "bindpass";
34+
public static final String BYTES_READ_RATE = "bytesreadrate";
35+
public static final String BYTES_WRITE_RATE = "byteswriterate";
3436
public static final String CATEGORY = "category";
3537
public static final String CERTIFICATE = "certificate";
3638
public static final String PRIVATE_KEY = "privatekey";
@@ -104,6 +106,8 @@ public class ApiConstants {
104106
public static final String INTERNAL_DNS1 = "internaldns1";
105107
public static final String INTERNAL_DNS2 = "internaldns2";
106108
public static final String INTERVAL_TYPE = "intervaltype";
109+
public static final String IOPS_READ_RATE = "iopsreadrate";
110+
public static final String IOPS_WRITE_RATE = "iopswriterate";
107111
public static final String IP_ADDRESS = "ipaddress";
108112
public static final String IP6_ADDRESS = "ip6address";
109113
public static final String IP_ADDRESS_ID = "ipaddressid";

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

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,18 @@ public class CreateDiskOfferingCmd extends BaseCmd {
6262
@Parameter(name=ApiConstants.STORAGE_TYPE, type=CommandType.STRING, description="the storage type of the disk offering. Values are local and shared.")
6363
private String storageType = ServiceOffering.StorageType.shared.toString();
6464

65+
@Parameter(name=ApiConstants.BYTES_READ_RATE, type=CommandType.LONG, required=false, description="bytes read rate of the disk offering")
66+
private Long bytesReadRate;
67+
68+
@Parameter(name=ApiConstants.BYTES_WRITE_RATE, type=CommandType.LONG, required=false, description="bytes write rate of the disk offering")
69+
private Long bytesWriteRate;
70+
71+
@Parameter(name=ApiConstants.IOPS_READ_RATE, type=CommandType.LONG, required=false, description="io requests read rate of the disk offering")
72+
private Long iopsReadRate;
73+
74+
@Parameter(name=ApiConstants.IOPS_WRITE_RATE, type=CommandType.LONG, required=false, description="io requests write rate of the disk offering")
75+
private Long iopsWriteRate;
76+
6577
@Parameter(name=ApiConstants.DISPLAY_OFFERING, type=CommandType.BOOLEAN, description="an optional field, whether to display the offering to the end user or not.")
6678
private Boolean displayOffering;
6779

@@ -93,6 +105,22 @@ public Long getDomainId(){
93105
return domainId;
94106
}
95107

108+
public Long getBytesReadRate() {
109+
return bytesReadRate;
110+
}
111+
112+
public Long getBytesWriteRate() {
113+
return bytesWriteRate;
114+
}
115+
116+
public Long getIopsReadRate() {
117+
return iopsReadRate;
118+
}
119+
120+
public Long getIopsWriteRate() {
121+
return iopsWriteRate;
122+
}
123+
96124
public String getStorageType() {
97125
return storageType;
98126
}

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

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,18 @@ public class CreateServiceOfferingCmd extends BaseCmd {
9393
@Parameter(name = ApiConstants.SERVICE_OFFERING_DETAILS, type = CommandType.MAP, description = "details for planner, used to store specific parameters")
9494
private Map<String, String> details;
9595

96+
@Parameter(name=ApiConstants.BYTES_READ_RATE, type=CommandType.LONG, required=false, description="bytes read rate of the disk offering")
97+
private Long bytesReadRate;
98+
99+
@Parameter(name=ApiConstants.BYTES_WRITE_RATE, type=CommandType.LONG, required=false, description="bytes write rate of the disk offering")
100+
private Long bytesWriteRate;
101+
102+
@Parameter(name=ApiConstants.IOPS_READ_RATE, type=CommandType.LONG, required=false, description="io requests read rate of the disk offering")
103+
private Long iopsReadRate;
104+
105+
@Parameter(name=ApiConstants.IOPS_WRITE_RATE, type=CommandType.LONG, required=false, description="io requests write rate of the disk offering")
106+
private Long iopsWriteRate;
107+
96108
/////////////////////////////////////////////////////
97109
/////////////////// Accessors ///////////////////////
98110
/////////////////////////////////////////////////////
@@ -171,6 +183,22 @@ public Map<String, String> getDetails() {
171183
return params;
172184
}
173185

186+
public Long getBytesReadRate() {
187+
return bytesReadRate;
188+
}
189+
190+
public Long getBytesWriteRate() {
191+
return bytesWriteRate;
192+
}
193+
194+
public Long getIopsReadRate() {
195+
return iopsReadRate;
196+
}
197+
198+
public Long getIopsWriteRate() {
199+
return iopsWriteRate;
200+
}
201+
174202
/////////////////////////////////////////////////////
175203
/////////////// API Implementation///////////////////
176204
/////////////////////////////////////////////////////

api/src/org/apache/cloudstack/api/response/DiskOfferingResponse.java

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,18 @@ public class DiskOfferingResponse extends BaseResponse {
5858
@SerializedName("storagetype") @Param(description="the storage type for this disk offering")
5959
private String storageType;
6060

61+
@SerializedName("diskBytesReadRate") @Param(description="bytes read rate of the disk offering")
62+
private Long bytesReadRate;
63+
64+
@SerializedName("diskBytesWriteRate") @Param(description="bytes write rate of the disk offering")
65+
private Long bytesWriteRate;
66+
67+
@SerializedName("diskIopsReadRate") @Param(description="io requests read rate of the disk offering")
68+
private Long iopsReadRate;
69+
70+
@SerializedName("diskIopsWriteRate") @Param(description="io requests write rate of the disk offering")
71+
private Long iopsWriteRate;
72+
6173
@SerializedName("displayoffering") @Param(description="whether to display the offering to the end user or not.")
6274
private Boolean displayOffering;
6375

@@ -149,4 +161,20 @@ public String getStorageType() {
149161
public void setStorageType(String storageType) {
150162
this.storageType = storageType;
151163
}
164+
165+
public void setBytesReadRate(Long bytesReadRate) {
166+
this.bytesReadRate = bytesReadRate;
167+
}
168+
169+
public void setBytesWriteRate(Long bytesWriteRate) {
170+
this.bytesWriteRate = bytesWriteRate;
171+
}
172+
173+
public void setIopsReadRate(Long iopsReadRate) {
174+
this.iopsReadRate = iopsReadRate;
175+
}
176+
177+
public void setIopsWriteRate(Long iopsWriteRate) {
178+
this.iopsWriteRate = iopsWriteRate;
179+
}
152180
}

api/src/org/apache/cloudstack/api/response/ServiceOfferingResponse.java

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,18 @@ public class ServiceOfferingResponse extends BaseResponse {
8787
@SerializedName(ApiConstants.NETWORKRATE) @Param(description="data transfer rate in megabits per second allowed.")
8888
private Integer networkRate;
8989

90+
@SerializedName("diskBytesReadRate") @Param(description="bytes read rate of the service offering")
91+
private Long bytesReadRate;
92+
93+
@SerializedName("diskBytesWriteRate") @Param(description="bytes write rate of the service offering")
94+
private Long bytesWriteRate;
95+
96+
@SerializedName("diskIopsReadRate") @Param(description="io requests read rate of the service offering")
97+
private Long iopsReadRate;
98+
99+
@SerializedName("diskIopsWriteRate") @Param(description="io requests write rate of the service offering")
100+
private Long iopsWriteRate;
101+
90102
@SerializedName(ApiConstants.DEPLOYMENT_PLANNER) @Param(description="deployment strategy used to deploy VM.")
91103
private String deploymentPlanner;
92104

@@ -248,4 +260,20 @@ public boolean getVolatileVm() {
248260
public void setVolatileVm(boolean isVolatile) {
249261
this.isVolatile = isVolatile;
250262
}
263+
264+
public void setBytesReadRate(Long bytesReadRate) {
265+
this.bytesReadRate = bytesReadRate;
266+
}
267+
268+
public void setBytesWriteRate(Long bytesWriteRate) {
269+
this.bytesWriteRate = bytesWriteRate;
270+
}
271+
272+
public void setIopsReadRate(Long iopsReadRate) {
273+
this.iopsReadRate = iopsReadRate;
274+
}
275+
276+
public void setIopsWriteRate(Long iopsWriteRate) {
277+
this.iopsWriteRate = iopsWriteRate;
278+
}
251279
}

api/src/org/apache/cloudstack/api/response/VolumeResponse.java

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,18 @@ public class VolumeResponse extends BaseResponse implements ControlledViewEntity
110110
@Param(description = "shared or local storage")
111111
private String storageType;
112112

113+
@SerializedName("diskBytesReadRate") @Param(description="bytes read rate of the disk volume")
114+
private Long bytesReadRate;
115+
116+
@SerializedName("diskBytesWriteRate") @Param(description="bytes write rate of the disk volume")
117+
private Long bytesWriteRate;
118+
119+
@SerializedName("diskIopsReadRate") @Param(description="io requests read rate of the disk volume")
120+
private Long iopsReadRate;
121+
122+
@SerializedName("diskIopsWriteRate") @Param(description="io requests write rate of the disk volume")
123+
private Long iopsWriteRate;
124+
113125
@SerializedName(ApiConstants.HYPERVISOR)
114126
@Param(description = "Hypervisor the volume belongs to")
115127
private String hypervisor;
@@ -258,6 +270,38 @@ public void setStorageType(String storageType) {
258270
this.storageType = storageType;
259271
}
260272

273+
public void setBytesReadRate(Long bytesReadRate) {
274+
this.bytesReadRate = bytesReadRate;
275+
}
276+
277+
public Long getBytesReadRate() {
278+
return bytesReadRate;
279+
}
280+
281+
public void setBytesWriteRate(Long bytesWriteRate) {
282+
this.bytesWriteRate = bytesWriteRate;
283+
}
284+
285+
public Long getBytesWriteRate() {
286+
return bytesWriteRate;
287+
}
288+
289+
public void setIopsReadRate(Long iopsReadRate) {
290+
this.iopsReadRate = iopsReadRate;
291+
}
292+
293+
public Long getIopsReadRate() {
294+
return iopsReadRate;
295+
}
296+
297+
public void setIopsWriteRate(Long iopsWriteRate) {
298+
this.iopsWriteRate = iopsWriteRate;
299+
}
300+
301+
public Long getIopsWriteRate() {
302+
return iopsWriteRate;
303+
}
304+
261305
public void setHypervisor(String hypervisor) {
262306
this.hypervisor = hypervisor;
263307
}

client/WEB-INF/classes/resources/messages.properties

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -466,6 +466,10 @@ label.disable.vpn=Disable VPN
466466
label.disabled=Disabled
467467
label.disabling.vpn.access=Disabling VPN Access
468468
label.disk.allocated=Disk Allocated
469+
label.disk.bytes.read.rate=Disk Read Rate (BPS)
470+
label.disk.bytes.write.rate=Disk Write Rate (BPS)
471+
label.disk.iops.read.rate=Disk Read Rate (IOPS)
472+
label.disk.iops.write.rate=Disk Write Rate (IOPS)
469473
label.disk.offering=Disk Offering
470474
label.disk.read.bytes=Disk Read (Bytes)
471475
label.disk.read.io=Disk Read (IO)

0 commit comments

Comments
 (0)