kioie opened a new pull request #4010: URL: https://github.com/apache/cloudstack/pull/4010
## Description <!--- Describe your changes in detail --> **New API endpoint to update size of Pod Management IP Range.** Currently, pod management IP range can only be expanded under the same subnet. Editing the current pod IP management range is a challenge, especially as the list of IP ranges is greater than one. The purpose of this feature is to allow ADMINS to be able to update size of IP range of management pod, upwards or downwards. PR #2048 and [FS](https://cwiki.apache.org/confluence/display/CLOUDSTACK/Expansion+of+Management+IP+Range) added two APIs(`createManagementNetworkIpRange` & `deleteManagementNetworkIpRange`). This feature is now in addition to the two APIs. **Brief description** - Updatepodmanagementnetworkiprange will update already existing IP ranges. Will not create a new IP range. - Will increase/reduce available IPs within the range. - PodID/Currentstartip/CurrentendIp are mandatory fields. Newstartip and Newendip are optional fields and when left blank, Newstartip will be set to Currentstartip and Newendip will be set to Currentendip. - Api only available to root admin and does not have any sensitive information passed. - Will output success response -true/false - Does not alter structure of DB, but will update contents. **When to use** - Reducing size of existing IP range - Increasing size of existing IP range **How to use** Run `list pods` command to see existing IP ranges ``` > list pods { "count": 1, "pod": [ { "allocationstate": "Enabled", "endip": [ "172.16.15.210", "172.16.15.204" ], "forsystemvms": [ "0", "0" ], "gateway": "172.16.15.1", "id": "1407da22-a131-4dbd-86a3-45210a26897e", "name": "POD0", "netmask": "255.255.255.0", "startip": [ "172.16.15.205", "172.16.15.2" ], "vlanid": [ "vlan://untagged", "vlan://untagged" ], "zoneid": "3ab731d6-efd5-418c-ab2b-cacbfc4b88f0", "zonename": "Sandbox-simulator" } ] } ``` 2. Update the IP range you'd like to change. In our case, we want to increase the range `172.16.15.205-172.16.15.210` to `172.16.15.205-172.16.15.215`. Use the command `update podmanagementnetworkiprange` ``` > update podmanagementnetworkiprange podid=1407da22-a131-4dbd-86a3-45210a26897e currentstartip=172.16.15.205 currentendip=172.16.15.210 newendip=172.16.15.215 { "success": true } ``` To reduce size of range to `172.16.15.205-172.16.15.207` ``` > update podmanagementnetworkiprange podid=1407da22-a131-4dbd-86a3-45210a26897e currentstartip=172.16.15.205 currentendip=172.16.15.215 newendip=172.16.15.207 { "success": true } ``` Confirm by running `list pods` again ``` > list pods { "count": 1, "pod": [ { "allocationstate": "Enabled", "endip": [ "172.16.15.207", "172.16.15.204" ], "forsystemvms": [ "0", "0" ], "gateway": "172.16.15.1", "id": "1407da22-a131-4dbd-86a3-45210a26897e", "name": "POD0", "netmask": "255.255.255.0", "startip": [ "172.16.15.205", "172.16.15.2" ], "vlanid": [ "vlan://untagged", "vlan://untagged" ], "zoneid": "3ab731d6-efd5-418c-ab2b-cacbfc4b88f0", "zonename": "Sandbox-simulator" } ] } ``` Touches on #2797 #2735 #3292 <!-- 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) - [x] 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) ## Tests <!-- 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. --> **Manual Tests** Test for invalid parameters for Currentstartip/Currentendip/Newstartip/Newendip Test for invalid current IP range Test for overlapping IP range extensions Test for non-existent IP range Test for Newstartip>Newendip Test for duplicate IP range Test for invalid Pod ID Test- Reduce existing IP range to not include already allocated IPs <!-- 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: us...@infra.apache.org