Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix secondary storage selectors feature #10546

Open
wants to merge 2 commits into
base: 4.20
Choose a base branch
from

Conversation

winterhazel
Copy link
Member

@winterhazel winterhazel commented Mar 11, 2025

Description

The secondary storage selectors feature is not working in the 4.20 and main branches.

PR #9873 changed the return of org.apache.cloudstack.storage.heuristics.presetvariables.GenericHeuristicPresetVariable#toString; however, as this method is used to build the secondary storage selection script, the changes made it stop working.

Here's how the script looked like before #9873:

secondaryStorages = [{"id":"f7e21c42-f621-4412-8994-36e077f0faec","protocol":"nfs","totalDiskSize":104028176384,"usedDiskSize":47059042304,"name":"sec"}, {"id":"0d88afc2-93eb-4070-8fbf-d8909f62364d","protocol":"nfs","totalDiskSize":104028176384,"usedDiskSize":47059042304,"name":"sec-2"}]; snapshot = {"hypervisorType":"KVM","size":52428800,"name":"e"}; account = {"domain":{"id":"40815ad7-28b2-11ef-a04e-6ac09c2b3d6b","name":"ROOT"},"id":"60b92e66-28b2-11ef-a04e-6ac09c2b3d6b","name":"admin"}; '0d88afc2-93eb-4070-8fbf-d8909f62364d';

And how it looks like now:

secondaryStorages = [GenericHeuristicPresetVariable {"id":"865197af-0bcc-4041-b031-8e6590cf41c4","protocol":"nfs","totalDiskSize":51460964352,"usedDiskSize":37255905280,"name":"sec-a-zn-1"}, GenericHeuristicPresetVariable {"id":"16babc8c-a6e8-4bb3-b581-c37afad4b442","protocol":"nfs","totalDiskSize":51460964352,"usedDiskSize":37255905280,"name":"sec-b-zn-1"}]; snapshot = GenericHeuristicPresetVariable {"hypervisorType":"KVM","size":52428800,"name":"a"}; account = GenericHeuristicPresetVariable {"domain":"GenericHeuristicPresetVariable {\"id\":\"40815ad7-28b2-11ef-a04e-6ac09c2b3d6b\",\"name\":\"ROOT\"}","id":"60b92e66-28b2-11ef-a04e-6ac09c2b3d6b","name":"admin"}; '16babc8c-a6e8-4bb3-b581-c37afad4b442';

This PR reverts the method to its previous state.

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

Bug Severity

  • BLOCKER
  • Critical
  • Major
  • Minor
  • Trivial

How Has This Been Tested?

  1. I created a heuristic rule to direct snapshots to a specific secondary storage
(admin) 🐢 > create secondarystorageselector description=a name=a zoneid=065b0fd8-f562-480a-b278-ea3d9306a326  heuristicrule="'0d88afc2-93eb-4070-8fbf-d8909f62364d';" type=SNAPSHOT
  1. I tried to take a snapshot

Before the changes, the snapshot process would fail due to an exception thrown by the JS interpreter. Applying the patch made it work again and correctly directed the snapshot to the secondary storage that I specified.

@winterhazel
Copy link
Member Author

@blueorangutan package

@blueorangutan
Copy link

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

Copy link

codecov bot commented Mar 11, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 16.01%. Comparing base (b8359e8) to head (f5859f0).
Report is 13 commits behind head on 4.20.

Additional details and impacted files
@@            Coverage Diff            @@
##               4.20   #10546   +/-   ##
=========================================
  Coverage     16.00%   16.01%           
- Complexity    13104    13115   +11     
=========================================
  Files          5651     5651           
  Lines        495841   495841           
  Branches      60044    60045    +1     
=========================================
+ Hits          79365    79411   +46     
+ Misses       407613   407566   -47     
- Partials       8863     8864    +1     
Flag Coverage Δ
uitests 4.00% <ø> (ø)
unittests 16.85% <100.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.

@blueorangutan
Copy link

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

@DaanHoogland DaanHoogland requested a review from vishesh92 March 12, 2025 09:28
@DaanHoogland
Copy link
Contributor

lgtm, @vishesh92 , can you check if there was a pressing reason the string GenericHeuristicPresetVariable was included in toString()?

@vishesh92
Copy link
Member

lgtm, @vishesh92 , can you check if there was a pressing reason the string GenericHeuristicPresetVariable was included in toString()?

It was just to improve logging.

@winterhazel
Copy link
Member Author

@blueorangutan package

@blueorangutan
Copy link

@winterhazel 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 12795

@winterhazel winterhazel requested a review from vishesh92 March 18, 2025 13:13
@Pearl1594 Pearl1594 added this to the 4.20.1 milestone Mar 18, 2025
@Pearl1594
Copy link
Contributor

@blueorangutan test

@blueorangutan
Copy link

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

@blueorangutan
Copy link

[SF] Trillian test result (tid-12802)
Environment: kvm-ol8 (x2), Advanced Networking with Mgmt server ol8
Total time taken: 61383 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr10546-t12802-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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

6 participants