Skip to content

Commit 3b1e91b

Browse files
committed
Merge remote-tracking branch 'upstream/main' into nasbnr
2 parents 81d6631 + 6089c16 commit 3b1e91b

File tree

73 files changed

+1238
-230
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+1238
-230
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ enum State {
3737
State getState();
3838

3939
enum DiskCacheMode {
40-
NONE("none"), WRITEBACK("writeback"), WRITETHROUGH("writethrough");
40+
NONE("none"), WRITEBACK("writeback"), WRITETHROUGH("writethrough"), HYPERVISOR_DEFAULT("hypervisor_default");
4141

4242
private final String _diskCacheMode;
4343

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ public class ApiConstants {
2727
public static final String ACTIVATION_RULE = "activationrule";
2828
public static final String ACTIVITY = "activity";
2929
public static final String ADAPTER_TYPE = "adaptertype";
30+
public static final String ADDITONAL_CONFIG_ENABLED = "additionalconfigenabled";
3031
public static final String ADDRESS = "address";
3132
public static final String ALGORITHM = "algorithm";
3233
public static final String ALIAS = "alias";

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ public class CreateDiskOfferingCmd extends BaseCmd {
151151
@Parameter(name = ApiConstants.CACHE_MODE,
152152
type = CommandType.STRING,
153153
required = false,
154-
description = "the cache mode to use for this disk offering. none, writeback or writethrough",
154+
description = "the cache mode to use for this disk offering. none, writeback, writethrough or hypervisor default. If the hypervisor default cache mode is used on other hypervisors than KVM, it will fall back to none cache mode",
155155
since = "4.14")
156156
private String cacheMode;
157157

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ public class CreateServiceOfferingCmd extends BaseCmd {
190190
@Parameter(name = ApiConstants.CACHE_MODE,
191191
type = CommandType.STRING,
192192
required = false,
193-
description = "the cache mode to use for this disk offering. none, writeback or writethrough",
193+
description = "the cache mode to use for this disk offering. none, writeback, writethrough or hypervisor default. If the hypervisor default cache mode is used on other hypervisors than KVM, it will fall back to none cache mode",
194194
since = "4.14")
195195
private String cacheMode;
196196

api/src/main/java/org/apache/cloudstack/api/command/user/config/ListCapabilitiesCmd.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ public void execute() {
7575
response.setInstanceLeaseEnabled((Boolean) capabilities.get(ApiConstants.INSTANCE_LEASE_ENABLED));
7676
response.setExtensionsPath((String)capabilities.get(ApiConstants.EXTENSIONS_PATH));
7777
response.setDynamicScalingEnabled((Boolean) capabilities.get(ApiConstants.DYNAMIC_SCALING_ENABLED));
78+
response.setAdditionalConfigEnabled((Boolean) capabilities.get(ApiConstants.ADDITONAL_CONFIG_ENABLED));
7879
response.setObjectName("capability");
7980
response.setResponseName(getCommandName());
8081
this.setResponseObject(response);

api/src/main/java/org/apache/cloudstack/api/response/CapabilitiesResponse.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,10 @@ public class CapabilitiesResponse extends BaseResponse {
149149
@Param(description = "true if dynamically scaling for instances is enabled", since = "4.21.0")
150150
private Boolean dynamicScalingEnabled;
151151

152+
@SerializedName(ApiConstants.ADDITONAL_CONFIG_ENABLED)
153+
@Param(description = "true if additional configurations or extraconfig can be passed to Instances", since = "4.20.2")
154+
private Boolean additionalConfigEnabled;
155+
152156
public void setSecurityGroupsEnabled(boolean securityGroupsEnabled) {
153157
this.securityGroupsEnabled = securityGroupsEnabled;
154158
}
@@ -272,4 +276,8 @@ public void setExtensionsPath(String extensionsPath) {
272276
public void setDynamicScalingEnabled(Boolean dynamicScalingEnabled) {
273277
this.dynamicScalingEnabled = dynamicScalingEnabled;
274278
}
279+
280+
public void setAdditionalConfigEnabled(Boolean additionalConfigEnabled) {
281+
this.additionalConfigEnabled = additionalConfigEnabled;
282+
}
275283
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ public class ServiceOfferingResponse extends BaseResponseWithAnnotations {
197197
private Boolean isCustomized;
198198

199199
@SerializedName("cacheMode")
200-
@Param(description = "the cache mode to use for this disk offering. none, writeback or writethrough", since = "4.14")
200+
@Param(description = "the cache mode to use for this disk offering. none, writeback, writethrough or hypervisor default", since = "4.14")
201201
private String cacheMode;
202202

203203
@SerializedName("vspherestoragepolicy")

api/src/main/java/org/apache/cloudstack/api/response/StoragePoolResponse.java

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,19 +77,24 @@ public class StoragePoolResponse extends BaseResponseWithAnnotations {
7777
@Param(description = "the name of the cluster for the storage pool")
7878
private String clusterName;
7979

80+
@SerializedName(ApiConstants.CAPACITY_BYTES)
81+
@Param(description = "bytes CloudStack can provision from this storage pool", since = "4.22.0")
82+
private Long capacityBytes;
83+
84+
@Deprecated(since = "4.22.0")
8085
@SerializedName("disksizetotal")
8186
@Param(description = "the total disk size of the storage pool")
8287
private Long diskSizeTotal;
8388

8489
@SerializedName("disksizeallocated")
85-
@Param(description = "the host's currently allocated disk size")
90+
@Param(description = "the pool's currently allocated disk size")
8691
private Long diskSizeAllocated;
8792

8893
@SerializedName("disksizeused")
89-
@Param(description = "the host's currently used disk size")
94+
@Param(description = "the pool's currently used disk size")
9095
private Long diskSizeUsed;
9196

92-
@SerializedName("capacityiops")
97+
@SerializedName(ApiConstants.CAPACITY_IOPS)
9398
@Param(description = "IOPS CloudStack can provision from this storage pool")
9499
private Long capacityIops;
95100

@@ -288,6 +293,14 @@ public void setClusterName(String clusterName) {
288293
this.clusterName = clusterName;
289294
}
290295

296+
public Long getCapacityBytes() {
297+
return capacityBytes;
298+
}
299+
300+
public void setCapacityBytes(Long capacityBytes) {
301+
this.capacityBytes = capacityBytes;
302+
}
303+
291304
public Long getDiskSizeTotal() {
292305
return diskSizeTotal;
293306
}

api/src/main/java/org/apache/cloudstack/userdata/UserDataManager.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,23 @@
2222

2323
import com.cloud.utils.component.Manager;
2424

25+
import java.io.IOException;
26+
2527
public interface UserDataManager extends Manager, Configurable {
2628
String VM_USERDATA_MAX_LENGTH_STRING = "vm.userdata.max.length";
2729
ConfigKey<Integer> VM_USERDATA_MAX_LENGTH = new ConfigKey<>("Advanced", Integer.class, VM_USERDATA_MAX_LENGTH_STRING, "32768",
2830
"Max length of vm userdata after base64 encoding. Default is 32768 and maximum is 1048576", true);
2931

3032
String concatenateUserData(String userdata1, String userdata2, String userdataProvider);
3133
String validateUserData(String userData, BaseCmd.HTTPMethod httpmethod);
34+
35+
/**
36+
* This method validates the user data uuid for system VMs and returns the user data
37+
* after compression and base64 encoding for the system VM to consume.
38+
*
39+
* @param userDataUuid
40+
* @return a String containing the user data after compression and base64 encoding
41+
* @throws IOException
42+
*/
43+
String validateAndGetUserDataForSystemVM(String userDataUuid) throws IOException;
3244
}

core/src/main/java/org/apache/cloudstack/storage/to/VolumeObjectTO.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,8 @@ public VolumeObjectTO(VolumeInfo volume) {
116116
iopsWriteRate = volume.getIopsWriteRate();
117117
iopsWriteRateMax = volume.getIopsWriteRateMax();
118118
iopsWriteRateMaxLength = volume.getIopsWriteRateMaxLength();
119-
cacheMode = volume.getCacheMode();
120119
hypervisorType = volume.getHypervisorType();
120+
setCacheMode(volume.getCacheMode());
121121
setDeviceId(volume.getDeviceId());
122122
this.migrationOptions = volume.getMigrationOptions();
123123
this.directDownload = volume.isDirectDownload();
@@ -343,6 +343,10 @@ public void setDeviceId(Long deviceId) {
343343
}
344344

345345
public void setCacheMode(DiskCacheMode cacheMode) {
346+
if (DiskCacheMode.HYPERVISOR_DEFAULT.equals(cacheMode) && !Hypervisor.HypervisorType.KVM.equals(hypervisorType)) {
347+
this.cacheMode = DiskCacheMode.NONE;
348+
return;
349+
}
346350
this.cacheMode = cacheMode;
347351
}
348352

0 commit comments

Comments
 (0)