Skip to content

Commit ededc75

Browse files
Revert "Update backup.framework.enabled config to Global scope"
This reverts commit b0b037f.
1 parent b0b037f commit ededc75

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

api/src/main/java/org/apache/cloudstack/backup/BackupManager.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public interface BackupManager extends BackupService, Configurable, PluggableSer
4040
ConfigKey<Boolean> BackupFrameworkEnabled = new ConfigKey<>("Advanced", Boolean.class,
4141
"backup.framework.enabled",
4242
"false",
43-
"Is backup and recovery framework enabled.", false);
43+
"Is backup and recovery framework enabled.", false, ConfigKey.Scope.Zone);
4444

4545
ConfigKey<String> BackupProviderPlugin = new ConfigKey<>("Advanced", String.class,
4646
"backup.framework.provider.plugin",

server/src/main/java/org/apache/cloudstack/backup/BackupManagerImpl.java

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -946,13 +946,13 @@ public boolean configure(String name, Map<String, Object> params) throws Configu
946946
return true;
947947
}
948948

949-
public boolean isDisabled() {
950-
return !(BackupFrameworkEnabled.value());
949+
public boolean isDisabled(final Long zoneId) {
950+
return !(BackupFrameworkEnabled.valueIn(zoneId));
951951
}
952952

953953
private void validateForZone(final Long zoneId) {
954-
if (zoneId == null || isDisabled()) {
955-
throw new CloudRuntimeException("Backup and Recovery feature is disabled");
954+
if (zoneId == null || isDisabled(zoneId)) {
955+
throw new CloudRuntimeException("Backup and Recovery feature is disabled for the zone");
956956
}
957957
}
958958

@@ -1127,7 +1127,7 @@ public void scheduleBackups() {
11271127
continue;
11281128
}
11291129

1130-
if (isDisabled()) {
1130+
if (isDisabled(vm.getDataCenterId())) {
11311131
continue;
11321132
}
11331133

@@ -1236,11 +1236,12 @@ protected void runInContext() {
12361236
if (logger.isTraceEnabled()) {
12371237
logger.trace("Backup sync background task is running...");
12381238
}
1239-
if (isDisabled()) {
1240-
logger.debug("Backup Sync Task is not enabled. Skipping!");
1241-
return;
1242-
}
12431239
for (final DataCenter dataCenter : dataCenterDao.listAllZones()) {
1240+
if (dataCenter == null || isDisabled(dataCenter.getId())) {
1241+
logger.debug("Backup Sync Task is not enabled in zone [{}]. Skipping this zone!", dataCenter == null ? "NULL Zone!" : dataCenter);
1242+
continue;
1243+
}
1244+
12441245
final BackupProvider backupProvider = getBackupProvider(dataCenter.getId());
12451246
if (backupProvider == null) {
12461247
logger.warn("Backup provider not available or configured for zone {}", dataCenter);

0 commit comments

Comments
 (0)