Skip to content

Conversation

sureshanaparti
Copy link
Contributor

@sureshanaparti sureshanaparti commented Sep 3, 2025

Description

This PR enables backup framework when the config 'backup.framework.enabled' is set to true in Zone scope and not in Global setting. It checks backup framework enabled config is set to true or not in any of the zone scope setting when disabled in Global scope, thus supporting backup in a specific zone (and not entire cloud deployment).

Doc PR: apache/cloudstack-documentation#579

Types of changes

  • Breaking change (fix or feature that would cause existing functionality to change)
  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (improves an existing feature and functionality)
  • Cleanup (Code refactoring and cleanup, that may add test cases)
  • build/CI
  • test (unit or integration test code)

Feature/Enhancement Scale or Bug Severity

Feature/Enhancement Scale

  • Major
  • Minor

Bug Severity

  • BLOCKER
  • Critical
  • Major
  • Minor
  • Trivial

Screenshots (if appropriate):

How Has This Been Tested?

  • Enable 'backup.framework.enabled' config in zone, Keep it disabled (by default) in Global scope.
  • Restart management server, notice the backup APIs discovered and relevant sections shown in UI.
BackupFrameworkEnabled_Config_Global_False BackupFrameworkEnabled_Config_Zone_True
mysql> SELECT * FROM cloud.configuration WHERE name LIKE 'backup.framework.enabled'\G;
*************************** 1. row ***************************
     category: Advanced
     instance: DEFAULT
    component: BackupService
         name: backup.framework.enabled
        value: false
  description: Is backup and recovery framework enabled.
default_value: false
      updated: 2025-09-25 10:40:30
        scope: Zone
   is_dynamic: 0
     group_id: 1
  subgroup_id: 38
       parent: NULL
 display_text: Backup framework enabled
         kind: NULL
      options: NULL
1 row in set (0.00 sec)

ERROR: 
No query specified

mysql> SELECT * FROM cloud.data_center_details;
+----+-------+--------------------------+-------+---------+
| id | dc_id | name                     | value | display |
+----+-------+--------------------------+-------+---------+
|  2 |     1 | backup.framework.enabled | true  |       1 |
+----+-------+--------------------------+-------+---------+
1 row in set (0.00 sec)

How did you try to break this feature and the system with this change?

@sureshanaparti
Copy link
Contributor Author

@blueorangutan package

Copy link

codecov bot commented Sep 3, 2025

Codecov Report

❌ Patch coverage is 0% with 30 lines in your changes missing coverage. Please review.
✅ Project coverage is 16.17%. Comparing base (36cfd76) to head (2dffcda).

Files with missing lines Patch % Lines
...udstack/framework/config/impl/ConfigDepotImpl.java 0.00% 16 Missing ⚠️
.../apache/cloudstack/framework/config/ConfigKey.java 0.00% 5 Missing ⚠️
...udstack/resourcedetail/ResourceDetailsDaoBase.java 0.00% 4 Missing ⚠️
...oudstack/framework/config/ScopedConfigStorage.java 0.00% 3 Missing ⚠️
...rg/apache/cloudstack/backup/BackupManagerImpl.java 0.00% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               4.20   #11567      +/-   ##
============================================
- Coverage     16.17%   16.17%   -0.01%     
- Complexity    13296    13297       +1     
============================================
  Files          5656     5656              
  Lines        498219   498247      +28     
  Branches      60451    60455       +4     
============================================
+ Hits          80579    80580       +1     
- Misses       408672   408698      +26     
- Partials       8968     8969       +1     
Flag Coverage Δ
uitests 4.00% <ø> (ø)
unittests 17.02% <0.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Collaborator

@abh1sar abh1sar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should remove this at line 983. Otherwise backup apis won't show if backup framework is enabled at zone but disabled globally.

        if (!BackupFrameworkEnabled.value()) {
            return cmdList;
        }

@sureshanaparti sureshanaparti changed the title Check backup framework enabled config in zone scope first (before checking in global scope) [WIP] Check backup framework enabled config in zone scope first (before checking in global scope) Sep 4, 2025
@sureshanaparti sureshanaparti force-pushed the check-backup-framework-disable-in-zone branch from 2f0ee6d to b0b037f Compare September 9, 2025 10:35
@sureshanaparti sureshanaparti changed the title [WIP] Check backup framework enabled config in zone scope first (before checking in global scope) Update backup framework enabled config to global scope Sep 9, 2025
@sureshanaparti
Copy link
Contributor Author

@blueorangutan package

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR moves the backup framework enabled configuration from zone-scoped to global-scoped, simplifying the backup management by removing per-zone enablement checks. The change affects how the backup framework determines if it's enabled, removing the need to check individual zones.

Key Changes

  • Removed zone-specific backup framework configuration support
  • Simplified backup enablement logic to use global configuration only
  • Updated error messages to reflect global scope

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
api/src/main/java/org/apache/cloudstack/backup/BackupManager.java Removes zone scope from backup framework configuration key
server/src/main/java/org/apache/cloudstack/backup/BackupManagerImpl.java Updates backup enablement checks to use global configuration and removes zone-specific logic

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@blueorangutan
Copy link

@sureshanaparti a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

@blueorangutan
Copy link

Packaging result [SF]: ✖️ el8 ✖️ el9 ✖️ debian ✖️ suse15. SL-JID 14918

@sureshanaparti sureshanaparti changed the title Update backup framework enabled config to global scope [WIP] Update backup framework enabled config to global scope Sep 10, 2025
@sureshanaparti sureshanaparti force-pushed the check-backup-framework-disable-in-zone branch 2 times, most recently from 233ce0d to 08aaaaf Compare September 24, 2025 07:09
@sureshanaparti
Copy link
Contributor Author

@blueorangutan package

@blueorangutan
Copy link

@sureshanaparti a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

@blueorangutan
Copy link

Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 15153

@sureshanaparti sureshanaparti force-pushed the check-backup-framework-disable-in-zone branch from 08aaaaf to 2dffcda Compare September 25, 2025 07:48
@sureshanaparti
Copy link
Contributor Author

@blueorangutan package

@blueorangutan
Copy link

@sureshanaparti a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

@blueorangutan
Copy link

Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 15163

@sureshanaparti sureshanaparti changed the title [WIP] Update backup framework enabled config to global scope Check backup framework enabled config in zone scope first (before checking in global scope) Sep 26, 2025
@sureshanaparti
Copy link
Contributor Author

@blueorangutan test

@blueorangutan
Copy link

@sureshanaparti a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests

@sureshanaparti sureshanaparti marked this pull request as ready for review September 26, 2025 08:42
@blueorangutan
Copy link

[SF] Trillian test result (tid-14446)
Environment: kvm-ol8 (x2), zone: Advanced Networking with Mgmt server ol8
Total time taken: 57034 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr11567-t14446-kvm-ol8.zip
Smoke tests completed. 141 look OK, 0 have errors, 0 did not run
Only failed and skipped tests results shown below:

Test Result Time (s) Test File

@DaanHoogland DaanHoogland added this to the 4.20.2 milestone Sep 30, 2025
@weizhouapache
Copy link
Member

@sureshanaparti
I think it is not a bug. I suggest to move to 4.22.0

please check other zone-level settings too
a doc PR may be also needed to describe the behaviour

@weizhouapache weizhouapache modified the milestones: 4.20.2, 4.22.0 Oct 8, 2025
@sureshanaparti
Copy link
Contributor Author

sureshanaparti commented Oct 10, 2025

@sureshanaparti I think it is not a bug. I suggest to move to 4.22.0

please check other zone-level settings too a doc PR may be also needed to describe the behaviour

@weizhouapache There is no change in config scope, but seems minor doc changes required (I'll raise the doc PR). It fixes the issue when 'backup.framework.enabled' is set to true at zone level and set to false in global settings.

@sureshanaparti
Copy link
Contributor Author

@sureshanaparti I think it is not a bug. I suggest to move to 4.22.0
please check other zone-level settings too a doc PR may be also needed to describe the behaviour

@weizhouapache There is no change in config scope, but seems minor doc changes required (I'll raise the doc PR). It fixes the issue when 'backup.framework.enabled' is set to true at zone level and set to false in global settings.

Raised doc PR - apache/cloudstack-documentation#579

@weizhouapache weizhouapache modified the milestones: 4.22.0, 4.20.2 Oct 10, 2025
@weizhouapache
Copy link
Member

@sureshanaparti I think it is not a bug. I suggest to move to 4.22.0
please check other zone-level settings too a doc PR may be also needed to describe the behaviour

@weizhouapache There is no change in config scope, but seems minor doc changes required (I'll raise the doc PR). It fixes the issue when 'backup.framework.enabled' is set to true at zone level and set to false in global settings.

Raised doc PR - apache/cloudstack-documentation#579

thanks @sureshanaparti
moving back to 4.20.2 milestone

can you check other settings ? for example RoutedNetworkVpcEnabled (I can only find this)

@weizhouapache
Copy link
Member

@rohityadavcloud
the last change on the global setting was introduced in the #4202 , what do you think about this PR ?
cc @sureshanaparti

@sureshanaparti
Copy link
Contributor Author

sureshanaparti commented Oct 13, 2025

thanks @sureshanaparti moving back to 4.20.2 milestone

can you check other settings ? for example RoutedNetworkVpcEnabled (I can only find this)

Hi @weizhouapache Yes, 'routed.network.vpc.enabled' is also Zone scoped, also has to be updated (at the below files/code) to work when 'routed.network.vpc.enabled' is set to true in Zone, and false in Global Settings. If it is set to true in Global Settings, all zones in the deployment are enabled with it by default when the respective Zone setting is not updated to false. Also, any relevant doc changes to be updated if required.

if (!RoutedNetworkVpcEnabled.value()) {
return cmdList;
}
cmdList.add(CreateIpv4SubnetForZoneCmd.class);

if (NetworkOffering.NetworkMode.ROUTED.equals(networkMode)) {
if (!RoutedIpv4Manager.RoutedNetworkVpcEnabled.value()) {
throw new InvalidParameterValueException(String.format("Configuration %s needs to be enabled for Routed VPCs", RoutedIpv4Manager.RoutedNetworkVpcEnabled.key()));
}
if (zoneIds != null) {
for (Long zoneId: zoneIds) {
if (!RoutedIpv4Manager.RoutedNetworkVpcEnabled.valueIn(zoneId)) {
throw new InvalidParameterValueException(String.format("Configuration %s needs to be enabled for Routed VPCs in zone (ID: %s)", RoutedIpv4Manager.RoutedNetworkVpcEnabled.key(), zoneId));
}
}
}
}

if (NetworkOffering.NetworkMode.ROUTED.equals(networkMode)) {
if (!RoutedIpv4Manager.RoutedNetworkVpcEnabled.value()) {
throw new InvalidParameterValueException(String.format("Configuration %s needs to be enabled for Routed networks", RoutedIpv4Manager.RoutedNetworkVpcEnabled.key()));
}
if (zoneIds != null) {
for (Long zoneId: zoneIds) {
if (!RoutedIpv4Manager.RoutedNetworkVpcEnabled.valueIn(zoneId)) {
throw new InvalidParameterValueException(String.format("Configuration %s needs to be enabled for Routed networks in zone (ID: %s)", RoutedIpv4Manager.RoutedNetworkVpcEnabled.key(), zoneId));
}
}

@weizhouapache
Copy link
Member

Hi @weizhouapache Yes, 'routed.network.vpc.enabled' is also Zone scoped, also has to be updated (at the below files/code) to work when 'routed.network.vpc.enabled' is set to true in Zone, and false in Global Settings. If it is set to true in Global Settings, all zones in the deployment are enabled with it by default when the respective Zone setting is not updated to false. Also, any relevant doc changes to be updated if required.

thanks @sureshanaparti for the research

can you check the PR #4202 ?

@sureshanaparti
Copy link
Contributor Author

Hi @weizhouapache Yes, 'routed.network.vpc.enabled' is also Zone scoped, also has to be updated (at the below files/code) to work when 'routed.network.vpc.enabled' is set to true in Zone, and false in Global Settings. If it is set to true in Global Settings, all zones in the deployment are enabled with it by default when the respective Zone setting is not updated to false. Also, any relevant doc changes to be updated if required.

thanks @sureshanaparti for the research

can you check the PR #4202 ?

Checked it @weizhouapache , B&R APIs are not exported when the setting is not enabled globally there because the config framework couldn't check whether any scoped level has the setting enabled or not. This PR introduces config framework to check any scoped level setting is set with any particular value set or not, which provides flexibility to check the value is set or not at the scope level.

@DaanHoogland
Copy link
Contributor

@sureshanaparti , doesn’t ConfigKey.velueInScope(Scope, Long) already address this problem?

Copy link
Collaborator

@abh1sar abh1sar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The approach is ok for 4.20 but this would need some major changes when merging to 4.21, as the _scope variable has been replaced with scopes to support multi-scope settings.

It would make more sense then to Look at all the parents of a given scope and see if any of them have the value set or not.

Comment on lines +313 to +314
ConfigurationVO configurationVO = _configDao.findByName(key);
if (configurationVO != null) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For Global scope value() is good enough, right?
why do we need this code?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@abh1sar some earlier config keys are not part of config framework, so these are fetched directly from the db. it's the same with the current method getConfigStringValueInternal() as well.

Copy link

@rajujith rajujith left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM based on my tests with the NAS plugin.

@sureshanaparti
Copy link
Contributor Author

@sureshanaparti , doesn’t ConfigKey.velueInScope(Scope, Long) already address this problem?

@DaanHoogland No, ConfigKey.valueInScope(Scope, Long) fetches the value in that scope with id specified, if it doesn't exist, picks the global value.

@DaanHoogland
Copy link
Contributor

@DaanHoogland No, ConfigKey.valueInScope(Scope, Long) fetches the value in that scope with id specified, if it doesn't exist, picks the global value.

reading the title of this PR that seems to be the intention?!?

@sureshanaparti sureshanaparti changed the title Check backup framework enabled config in zone scope first (before checking in global scope) Enable backup framework when config 'backup.framework.enabled' is set to true in Zone scope only and not in Global setting Oct 14, 2025
@sureshanaparti sureshanaparti changed the title Enable backup framework when config 'backup.framework.enabled' is set to true in Zone scope only and not in Global setting Enable backup framework when the config 'backup.framework.enabled' is set to true in Zone scope and not in Global setting Oct 14, 2025
@sureshanaparti
Copy link
Contributor Author

@DaanHoogland No, ConfigKey.valueInScope(Scope, Long) fetches the value in that scope with id specified, if it doesn't exist, picks the global value.

reading the title of this PR that seems to be the intention?!?

updated title & description.

public List<Class<?>> getCommands() {
final List<Class<?>> cmdList = new ArrayList<Class<?>>();
if (!BackupFrameworkEnabled.value()) {
if (!BackupFrameworkEnabled.value() && !BackupFrameworkEnabled.hasValueInScope(Boolean.TRUE.toString())) {
Copy link
Contributor

@shwstppr shwstppr Oct 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should not restrict/allow API access based on the zone config value. It might break UI/clients.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shwstppr it doesn't restrict API access. it allows API access if it is enabled in global or in any zone (not mandatory to enable in global scope). previously, enabling at global level is mandatory for API access.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants