yuminn-k opened a new pull request, #14708:
URL: https://github.com/apache/cloudstack/pull/14708

   ### Description
   
   `TemplateManagerImpl.validateDetails()` only checked whether a template is 
deploy-as-is when the `UEFI` key was present. For any other key it returned 
early, so settings such as `rootDiskController` could still be added to a 
deploy-as-is template ("Read Instance settings from OVA"), even though those 
settings are read directly from the OVA.
   
   This moves the deploy-as-is check ahead of the early return. For a 
deploy-as-is template, any detail whose key is missing from the template's 
current details, or whose value differs, is rejected with 
`InvalidParameterValueException` ("Deploy-as-is Template ... can not have the 
<key> setting. Settings are read directly from the Template"). Details that are 
identical to what the template already has are accepted, so clients that 
re-send the existing settings keep working.
   
   Policy choice: the issue discussion asks that no new template settings be 
allowed for such templates, so all changed or new keys are rejected. The 
alternative is to reuse the VM-side allow list 
(`vmware.allowed.additional.details.from.ova` in `UserVmManagerImpl`), but that 
list is a zone-scoped setting and templates can be shared across zones, so I 
kept the template check strict. Happy to switch if reviewers prefer the allow 
list.
   
   Targets `4.20` because this is a bug fix (milestone 4.20.4, see 
CONTRIBUTING).
   
   Fixes: #12458
   
   ### 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)
   
   ### How Has This Been Tested?
   
   Unit tests in `TemplateManagerImplTest` (new): a deploy-as-is template 
rejects a new non-UEFI key (failed before the change, passes after), accepts an 
unchanged key, and a regular template still accepts non-UEFI keys.
   
   ```
   mvn -pl server -am -Dtest=TemplateManagerImplTest test
   Tests run: 40, Failures: 0, Errors: 0, Skipped: 0
   ```
   
   Checkstyle reports 0 violations. I did not test against a real VMware 
deploy-as-is template.
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to