bhouse-nexthop opened a new issue, #14638:
URL: https://github.com/apache/cloudstack/issues/14638

   ### problem
   
   On main, `updateConfiguration` with a scope id (`zoneid`, `clusterid`, 
`storageid`, `accountid`, `domainid`, `imagestoreuuid` or `managementserverid`) 
returns the global value of the setting in its response, not the value that was 
just set. The scoped value is stored correctly. `listConfigurations` with the 
same scope id shows it, and it takes effect.
   
   ```
   $ cmk update configuration name=drs.algorithm value=condensed 
clusterid=<cluster>
   {"name": "drs.algorithm", "value": "balanced", "scope": "cluster", ...}   <- 
global value
   $ cmk list configurations name=drs.algorithm clusterid=<cluster>
   ... "value": "condensed"                                                   
<- the value that was set
   ```
   
   A script or UI that checks the response sees the wrong value.
   
   Cause:
   - `ConfigurationManagerImpl.updateConfiguration(UpdateCfgCmd)` ends with 
`return _configDao.findByName(name);`. That is the global `configuration` row, 
whatever the scope.
   - Since #11770, `UpdateCfgCmd.setResponseValue()` copies `cfg.getValue()` 
into the response. Before that change, it echoed the value from the request. So 
for a scoped update, the response now has the global value.
   
   The same applies to the implicit scope a domain admin or a user gets when 
they call the API without a scope id.
   
   ### versions
   
   main (24.0.0-SNAPSHOT), since #11770. 4.22 and earlier echo the value from 
the request and are not affected.
   
   ### The steps to reproduce the bug
   
   1. Note the global value of a cluster-scoped setting, for example 
`drs.algorithm` (`balanced` by default).
   2. `updateConfiguration name=drs.algorithm value=condensed 
clusterid=<cluster>`.
   3. The response's `value` is `balanced`.
   4. `listConfigurations name=drs.algorithm clusterid=<cluster>` returns 
`condensed`.
   
   ### What to do about it?
   
   Have `updateConfiguration` return the value that was set in the requested 
scope when a scope is given. The inner `updateConfiguration(...)` already 
returns that value, after normalization (for example, lowercased booleans).
   


-- 
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