ravening opened a new pull request #4215:
URL: https://github.com/apache/cloudstack/pull/4215
## Description
<!--- Describe your changes in detail -->
All the account settings can't be configured under domain
level settings right now.
By default, if account setting is not configured then
its value will be taken from global setting.
Add a global setting "enable.account.settings.for.domain"
so that if its enabled then all the account level settings
will be visible under domain levelsettings also.
If account level setting is configured then that value will
be considered else it will take domain scope value. If
domain scope value is not configured then it will pick
it up from global setting.
If domain level setting is not configured then by default
the value will be taken from global setting
Add another global setting "enable.domain.settings.for.child.domain"
so that when its true, if a value for domain setting is not
configured then its parent domain value is considered until
it reaches ROOT domain. If no value is configured till ROOT
domain then global setting value will be taken.
Also display all the settings configured under the domain level
in list domains api response
<!-- For new features, provide link to FS, dev ML discussion etc. -->
<!-- In case of bug fix, the expected and actual behaviours, steps to
reproduce. -->
<!-- When "Fixes: #<id>" is specified, the issue/PR will automatically be
closed when this PR gets merged -->
<!-- For addressing multiple issues/PRs, use multiple "Fixes: #<id>" -->
<!-- Fixes: # -->
## Types of changes
<!--- What types of changes does your code introduce? Put an `x` in all the
boxes that apply: -->
- [ ] 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)
- [X] Enhancement (improves an existing feature and functionality)
- [ ] Cleanup (Code refactoring and cleanup, that may add test cases)
## Screenshots (if appropriate):
## How Has This Been Tested?
<!-- Please describe in detail how you tested your changes. -->
<!-- Include details of your testing environment, and the tests you ran to
-->
<!-- see how your change affects other areas of the code, etc. -->
This has been tested both from UI and cloudmonkey api
Cretae a domain relationship like
ROOT -> test1 -> test11
setting "enable.account.settings.for.domain" to false
The below output should not display config value
```
local) mgt01 > list configurations accountid=1431e-347c-4bae-a2ec-7c892cb
name=router.service.offering
{
"configuration": [
{
"category": "Advanced",
"description": "Uuid of the service offering used by virtual routers;
if NULL - system offering will be used",
"isdynamic": true,
"name": "router.service.offering",
"scope": "account",
"value": ""
}
],
"count": 1
}
```
After setting enable.account.settings.for.domain to true and set global
value to f2d9-3803-4af-b84-96a369
The value should be of global setting value
```
(local) mgt01 > list configurations
accountid=188b431e-347c-4bae-a2ec-7c8f1e4792cb name=router.service.offering
{
"configuration": [
{
"category": "Advanced",
"description": "Uuid of the service offering used by virtual routers;
if NULL - system offering will be used",
"isdynamic": true,
"name": "router.service.offering",
"scope": "account",
"value": "f2d9-3803-4aef-b84-93ee69" <<<<<<<<<<<<< displays global
value
}
],
"count": 1
}
```
Assign different value for router.service.offering to domain test1 which is
parent of test11
set the value of router.service.offering of domain "test1" to
fca42701-6d28-4bc4-8c14-896d0878d07e
```
(local) mgt01 > list configurations name=router.service.offering
domainid=e3a8ea3a-2318-4e81-99b3-8392513b80b0
{
"configuration": [
{
"category": "Advanced",
"description": "Uuid of the service offering used by virtual routers;
if NULL - system offering will be used",
"isdynamic": true,
"name": "router.service.offering",
"scope": "domain",
"value": "fca42701-6d28-4bc4-8c14-896d0878d07e" <<<<<<<<<<<<<
different value compared to global setting
}
],
"count": 1
}
```
setting "enable.account.settings.for.domain" to true
The value should still point to global setting
```
(local) mgt01 > list configurations name=router.service.offering
accountid=188b431e-347c-4bae-a2ec-7c8f1e4792cb
{
"configuration": [
{
"category": "Advanced",
"description": "Uuid of the service offering used by virtual routers;
if NULL - system offering will be used",
"isdynamic": true,
"name": "router.service.offering",
"scope": "account",
"value": "f2c5d7d9-3803-4aef-b884-9652f0a3ee69"
}
],
"count": 1
}
```
Now change the value of enable.domain.settings.for.child.domain to true
It should be display the value of test1 domain instead of global setting
```
(local) mgt01 > list configurations name=router.service.offering
accountid=188b431e-347c-4bae-a2ec-7c8f1e4792cb
{
"configuration": [
{
"category": "Advanced",
"description": "Uuid of the service offering used by virtual routers;
if NULL - system offering will be used",
"isdynamic": true,
"name": "router.service.offering",
"scope": "account",
"value": "fca42701-6d28-4bc4-8c14-896d0878d07e" <<<<<<<<<<<<< value
assigned to test1 domain
}
],
"count": 1
}
```
All the settings enabled under domain will be displayed in list domains
response
```
(local) mgt01 > list domains id=04dfd1c6-c28e-11ea-9a43-0617bc003377
{
"count": 1,
"domain": [
{
"cpuavailable": "Unlimited",
"cpulimit": "Unlimited",
"cputotal": 1,
"domaindetails": {
"vmsnapshot.expire.interval": "30"
},
```
Running integration test cases
```
nosetests --with-marvin --marvin-config=<config file>
test_enable_account_settings_for_domain.py
Disable account settings for domain ... === TestName:
test_01_disable_account_settings_for_domain | Status : SUCCESS ===
ok
Enable account settings for domain ... === TestName:
test_02_enable_account_settings_for_domain | Status : SUCCESS ===
ok
----------------------------------------------------------------------
Ran 2 tests in 6.770s
OK
```
<!-- Please read the
[CONTRIBUTING](https://github.com/apache/cloudstack/blob/master/CONTRIBUTING.md)
document -->
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]