Skip to content

Commit e036a51

Browse files
Revert "Revert "Update backup.framework.enabled config to Global scope""
This reverts commit 1543511.
1 parent 8d02dc0 commit e036a51

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
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, ConfigKey.Scope.Zone);
43+
"Is backup and recovery framework enabled.", false);
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: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -947,13 +947,13 @@ public boolean configure(String name, Map<String, Object> params) throws Configu
947947
return true;
948948
}
949949

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

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

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

1131-
if (isDisabled(vm.getDataCenterId())) {
1131+
if (isDisabled()) {
11321132
continue;
11331133
}
11341134

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

0 commit comments

Comments
 (0)