winterhazel opened a new pull request, #10546:
URL: https://github.com/apache/cloudstack/pull/10546

   ### 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:
   
   ```js
   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:
   
   ```js
   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)
   - [X] 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
   
   - [X] 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
   ```
   
   2. 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.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to