Skip to content

Commit 12d9c26

Browse files
authored
Added support for storpool_qos service (#8755)
1 parent 2a1db67 commit 12d9c26

11 files changed

Lines changed: 1021 additions & 60 deletions

File tree

engine/api/src/main/java/org/apache/cloudstack/engine/subsystem/api/storage/PrimaryDataStoreDriver.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import org.apache.cloudstack.storage.command.CommandResult;
2525

2626
import com.cloud.host.Host;
27+
import com.cloud.offering.DiskOffering;
2728
import com.cloud.storage.StoragePool;
2829
import com.cloud.storage.Volume;
2930
import com.cloud.storage.Storage.StoragePoolType;
@@ -199,4 +200,9 @@ default boolean zoneWideVolumesAvailableWithoutClusterMotion() {
199200
default long getVolumeSizeRequiredOnPool(long volumeSize, Long templateSize, boolean isEncryptionRequired) {
200201
return volumeSize;
201202
}
203+
default boolean informStorageForDiskOfferingChange() {
204+
return false;
205+
}
206+
207+
default void updateStorageWithTheNewDiskOffering(Volume volume, DiskOffering newDiskOffering) {}
202208
}

plugins/storage/volume/storpool/README.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,46 @@ corresponding system disk offering.
345345

346346
CloudStack has no way to specify max BW. Do they want to be able to specify max BW only is sufficient.
347347

348+
================================================================================
349+
350+
StorPool provides the ‘storpool_qos’ service ([QoS user guide](https://kb.storpool.com/storpool_misc/qos.html#storpool-qos-user-guide)) that tracks and configures the storage tier for all volumes based on a specifically provided `qc` tag specifying the storage tier for each volume.
351+
352+
To manage the QoS limits with a `qc` tag, you have to add a `qc` tag resource detail to each disk offering to which a tier should be applied, with a key `SP_QOSCLASS` and the value from the configuration file for the `storpool_qos` service:
353+
354+
add resourcedetail resourceid={diskofferingid} details[0].key=SP_QOSCLASS details[0].value={the name of the tier from the config} resourcetype=DiskOffering
355+
356+
To change the tier via CloudStack, you can use the CloudStack API call `changeOfferingForVolume`. The size is required, but the user could use the current volume size. Example:
357+
358+
change offeringforvolume id={The UUID of the Volume} diskofferingid={The UUID of the disk offering} size={The current or a new size for the volume}
359+
360+
Users who were using the offerings to change the StorPool template via the `SP_TEMPLATE` detail, will continue to have this functionality but should use `changeOfferingForVolume` API call instead of:
361+
- `resizeVolume` API call for DATA disk
362+
- `scaleVirtualMachine` API call for ROOT disk
363+
364+
365+
If the disk offering has both `SP_TEMPLATE` and `SP_QOSCLASS` defined, the `SP_QOSCLASS` detail will be prioritised, setting the volume’s QoS using the respective ‘qc’ tag value. In case the QoS for a volume is changed manually, the ‘storpool_qos’ service will automatically reset the QoS limits following the ‘qc’ tag value once per minute.
366+
367+
<h4>Usage</h4>
368+
369+
Creating Disk Offering for each tier.
370+
371+
Go to Service Offerings > Disk Offering > Add disk offering.
372+
373+
Add disk offering detail with API call in CloudStack CLI.
374+
375+
add resourcedetail resourcetype=diskoffering resourceid=$UUID details[0].key=SP_QOSCLASS details[0].value=$Tier Name
376+
377+
378+
Creating VM with QoS
379+
380+
Deploy virtual machine: Go to Compute> Instances> Add Instances.
381+
- For the ROOT volume, choose the option `Override disk offering`. This will set the required `qc` tag from the disk offering (DO) detail.
382+
383+
Creating DATA disk with QoS
384+
- Create volume via GUI/CLI and choose a disk offering which has the required `SP_QOSCLASS` detail
385+
386+
To update the tier of a ROOT/DATA volume go to Storage> Volumes and select the Volume and click on the Change disk offering for the volume in the upper right corner.
387+
348388
## Supported operations for Volume encryption
349389

350390
Supported Virtual machine operations - live migration of VM to another host, virtual machine snapshots (group snapshot without memory), revert VM snapshot, delete VM snapshot
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
// Licensed to the Apache Software Foundation (ASF) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The ASF licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
17+
18+
package org.apache.cloudstack.storage.datastore.api;
19+
20+
import java.io.Serializable;
21+
import java.util.Map;
22+
23+
public class StorPoolVolumeDef implements Serializable {
24+
25+
private static final long serialVersionUID = 1L;
26+
private transient String name;
27+
private Long size;
28+
private Map<String, String> tags;
29+
private String parent;
30+
private Long iops;
31+
private String template;
32+
private String baseOn;
33+
private String rename;
34+
private Boolean shrinkOk;
35+
36+
public StorPoolVolumeDef() {
37+
}
38+
39+
public StorPoolVolumeDef(String name, Long size, Map<String, String> tags, String parent, Long iops, String template,
40+
String baseOn, String rename, Boolean shrinkOk) {
41+
super();
42+
this.name = name;
43+
this.size = size;
44+
this.tags = tags;
45+
this.parent = parent;
46+
this.iops = iops;
47+
this.template = template;
48+
this.baseOn = baseOn;
49+
this.rename = rename;
50+
this.shrinkOk = shrinkOk;
51+
}
52+
53+
public String getName() {
54+
return name;
55+
}
56+
public void setName(String name) {
57+
this.name = name;
58+
}
59+
public Long getSize() {
60+
return size;
61+
}
62+
public void setSize(Long size) {
63+
this.size = size;
64+
}
65+
public Map<String, String> getTags() {
66+
return tags;
67+
}
68+
public void setTags(Map<String, String> tags) {
69+
this.tags = tags;
70+
}
71+
public String getParent() {
72+
return parent;
73+
}
74+
public void setParent(String parent) {
75+
this.parent = parent;
76+
}
77+
public Long getIops() {
78+
return iops;
79+
}
80+
public void setIops(Long iops) {
81+
this.iops = iops;
82+
}
83+
public String getTemplate() {
84+
return template;
85+
}
86+
public void setTemplate(String template) {
87+
this.template = template;
88+
}
89+
public String getBaseOn() {
90+
return baseOn;
91+
}
92+
public void setBaseOn(String baseOn) {
93+
this.baseOn = baseOn;
94+
}
95+
public String getRename() {
96+
return rename;
97+
}
98+
public void setRename(String rename) {
99+
this.rename = rename;
100+
}
101+
102+
public Boolean getShrinkOk() {
103+
return shrinkOk;
104+
}
105+
106+
public void setShrinkOk(Boolean shrinkOk) {
107+
this.shrinkOk = shrinkOk;
108+
}
109+
}

0 commit comments

Comments
 (0)