Skip to content

Commit 6fc8dda

Browse files
authored
Merge branch 'ablecloud-team:ablestack-diplo' into mold-main#2025
2 parents 8b4a0b4 + e3c8079 commit 6fc8dda

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

server/src/main/java/com/cloud/configuration/ConfigurationManagerImpl.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1254,6 +1254,8 @@ protected String validateConfigurationValue(String name, String value, String sc
12541254

12551255
validateSpecificConfigurationValues(name, value, type);
12561256

1257+
validateDisasterRecoveryValues(name, value, type);
1258+
12571259
boolean isTypeValid = validateValueType(value, type);
12581260
if (!isTypeValid) {
12591261
return String.format("Value [%s] is not a valid [%s].", value, type);
@@ -1415,6 +1417,22 @@ protected void validateSpecificConfigurationValues(String name, String value, Cl
14151417
}
14161418
}
14171419

1420+
protected void validateDisasterRecoveryValues(String name, String value, Class<?> type) {
1421+
if (name.equals("cloud.dr.service.enabled") && value.equals("true")) {
1422+
boolean rbd = false;
1423+
List<StoragePoolVO> pools = _storagePoolDao.listAll();
1424+
for (StoragePoolVO pool : pools) {
1425+
if (pool.getPoolType() == Storage.StoragePoolType.RBD) {
1426+
rbd = true;
1427+
break;
1428+
}
1429+
}
1430+
if (!rbd) {
1431+
throw new InvalidParameterValueException("Disaster recovery service can only be activated if you have rbd type storage.");
1432+
}
1433+
}
1434+
}
1435+
14181436
protected Pair<Boolean, String> validateCommaSeparatedKeyValueConfigWithPositiveIntegerValues(String value) {
14191437
try {
14201438
if (StringUtils.isNotEmpty(value)) {

0 commit comments

Comments
 (0)