Skip to content

Extend Preferred storage pool setting to Account, Domain and Cluster scope - #9564

Open
nvazquez wants to merge 6 commits into
apache:mainfrom
shapeblue:420-vm-primary-storage-allocation
Open

nvazquez wants to merge 6 commits into
apache:mainfrom
shapeblue:420-vm-primary-storage-allocation

Conversation

@nvazquez

@nvazquez nvazquez commented Aug 21, 2024 •

Copy link
Copy Markdown
Contributor

Description

This PR changes the preferred.storage.pool setting scope from Account to Account, Domain, and Cluster scope.

The Account value takes precedence over the Domain value, the Domain value takes precedence over the Cluster value, which takes precedence over the Global value.

Fixes: #8959

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?

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

@nvazquez

Copy link
Copy Markdown
Contributor Author

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

@nvazquez 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.

@codecov

codecov Bot commented Aug 21, 2024 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 58.69565% with 19 lines in your changes missing coverage. Please review.
✅ Project coverage is 20.77%. Comparing base (b535ae8) to head (45b2f17).
⚠️ Report is 8 commits behind head on main.

Files with missing lines Patch % Lines
...rc/main/java/com/cloud/storage/StorageManager.java 7.69% 12 Missing ⚠️
...om/cloud/deploy/DeploymentPlanningManagerImpl.java 45.45% 3 Missing and 3 partials ⚠️
...stack/engine/orchestration/VolumeOrchestrator.java 90.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #9564      +/-   ##
============================================
+ Coverage     20.66%   20.77%   +0.10%     
- Complexity    21720    21915     +195     
============================================
  Files          6492     6496       +4     
  Lines        590728   591634     +906     
  Branches      72448    72594     +146     
============================================
+ Hits         122101   122886     +785     
- Misses       455355   455408      +53     
- Partials      13272    13340      +68     
Flag Coverage Δ
uitests 3.88% <ø> (ø)
unittests 22.07% <58.69%> (+0.10%) ⬆️

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

☔ View full report in Codecov by Harness.
📢 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.

@blueorangutan

Copy link
Copy Markdown

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

true, ConfigKey.Scope.Zone);
ConfigKey<String> PreferredStoragePool = new ConfigKey<String>(String.class, "preferred.storage.pool", "Advanced", "",
"The UUID of preferred storage pool for allocation.", true, ConfigKey.Scope.Account, null);
ConfigKey<String> PreferredStoragePool = new ConfigKey<>(String.class, "preferred.storage.pool", "Advanced", "",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I wonder if we can have two configurations with same key

  • 1 for global/zone/cluster
  • 2 for global/domain/account

changing from Account to Cluster may be disliked by some users (maybe)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks @weizhouapache - there is now an option to define multiple scopes per setting: https://docs.cloudstack.apache.org/en/4.22.0.0/installguide/configuration.html#granular-global-configuration-parameters. I will explore this

@nvazquez

Copy link
Copy Markdown
Contributor Author

@blueorangutan test

@blueorangutan

Copy link
Copy Markdown

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

@blueorangutan

Copy link
Copy Markdown

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

Test Result Time (s) Test File

@github-actions

github-actions Bot commented Jan 8, 2025

Copy link
Copy Markdown

This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch.

@DaanHoogland

Copy link
Copy Markdown
Contributor

@nvazquez should this target 4.19?

@nvazquez

Copy link
Copy Markdown
Contributor Author

@DaanHoogland the issue this PR fixes was on the 4.19.2 milestone but I think it shouldn't be there as 4.20.0 is already out and changing the scope of the setting would be conflicting, perhaps it should be targeted to 4.20 instead of main?

@DaanHoogland

Copy link
Copy Markdown
Contributor

@nvazquez we can change to v21 as well as it is an enhancement...?

@nvazquez nvazquez added this to the 4.21.0 milestone Jan 23, 2025
@nvazquez

Copy link
Copy Markdown
Contributor Author

Sure @DaanHoogland fixed

@nvazquez
nvazquez marked this pull request as ready for review October 28, 2026 02:15
Copilot AI balanced review requested due to automatic review settings October 28, 2026 02:15

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

@nvazquez

Copy link
Copy Markdown
Contributor Author

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

@nvazquez a [SL] Jenkins job has been kicked to build packages. It will be bundled with no SystemVM templates. I'll keep you posted as I make progress.

@blueorangutan

Copy link
Copy Markdown

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

@nvazquez

Copy link
Copy Markdown
Contributor Author

@blueorangutan test

@blueorangutan

Copy link
Copy Markdown

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

if (accountId != null) {
String uuid = PreferredStoragePool.valueInScope(ConfigKey.Scope.Account, accountId, true);
if (StringUtils.isNotBlank(uuid)) {
return new Pair<>(ConfigKey.Scope.Account, uuid);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@nvazquez if the account's pool isnt usable for this vm, should we still try the cluster and then the global pool? right now it stops at the account value, so the cluster setting is ignored

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I think that may add some complexity to the logic, but can be a good enhancement. Would like to address it in a separate follow up PR, leaving this PR to the extension of the setting only

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@nvazquez fine to move the cluster and domain fallback to a follow up, those are new. can we keep the global fallback here though? main still tries the global pool when the account pool isnt usable, so this would break setups that rely on it today

@blueorangutan

Copy link
Copy Markdown

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

Test Result Time (s) Test File

*/
static Pair<ConfigKey.Scope, String> getPreferredStoragePoolUuid(Long accountId, Long clusterId) {
if (accountId != null) {
String uuid = PreferredStoragePool.valueInScope(ConfigKey.Scope.Account, accountId, true);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Since we are already doing account scope, should we also add a domain scope?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Added, thanks

* Resolves the preferred storage pool UUID, checking the Account scope first, then the Cluster scope and finally the Global value.
* @return a pair of the scope where the value was found and the storage pool UUID, or null if it is not set at any level
*/
static Pair<ConfigKey.Scope, String> getPreferredStoragePoolUuid(Long accountId, Long clusterId) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't understand why implement this in the interface. We should move the implementation to StorageManagerImpl

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks, fixed

Copilot AI balanced review requested due to automatic review settings November 1, 2026 22:47
@nvazquez nvazquez changed the title Extend Preferred storage pool setting to cluster and account scope Extend Preferred storage pool setting to Account, Domain and Cluster scope Nov 1, 2026
@nvazquez

nvazquez commented Nov 1, 2026

Copy link
Copy Markdown
Contributor Author

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

@nvazquez a [SL] Jenkins job has been kicked to build packages. It will be bundled with no SystemVM templates. I'll keep you posted as I make progress.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Pool resolution stops at an unsuitable account-level preference instead of falling back to a suitable global pool, leaving allocation to allocator ordering in both deployment planning and volume orchestration.

1 open issue

Review effort: Balanced

if (preferredStoragePool == null) {
return Optional.empty();
}
Optional<StoragePool> storagePool = getMatchingStoragePool(preferredStoragePool.second(), poolList);
@blueorangutan

Copy link
Copy Markdown

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

@nvazquez

nvazquez commented Nov 2, 2026

Copy link
Copy Markdown
Contributor Author

@blueorangutan test

@blueorangutan

Copy link
Copy Markdown

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

@blueorangutan

Copy link
Copy Markdown

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

Test Result Time (s) Test File

@JoaoJandre JoaoJandre left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

CLGTM. Did not test it

This branch has not been deployed

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

Projects

Status: conflict/waiting

Development

Successfully merging this pull request may close these issues.

VM allocation on Primary Storage