sureshanaparti opened a new pull request #5458:
URL: https://github.com/apache/cloudstack/pull/5458
### Description
This PR introduces a new API endpoint to update pod management network 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.
This PR extends from #4010
- 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 one of them should be specified. When anyone
is 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"
}
]
}
```
<!--- Describe your changes in DETAIL - And how has behaviour functionally
changed. -->
<!-- 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: # -->
<!---
*********************************************************************************
-->
<!--- NOTE: AUTOMATATION USES THE DESCRIPTIONS TO SET LABELS AND PRODUCE
DOCUMENTATION. -->
<!--- PLEASE PUT AN 'X' in only **ONE** box -->
<!---
*********************************************************************************
-->
### Types of changes
- [ ] 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)
### Feature/Enhancement Scale or Bug Severity
#### Feature/Enhancement Scale
- [ ] Major
- [ ] Minor
#### Bug Severity
- [ ] BLOCKER
- [ ] Critical
- [ ] Major
- [ ] Minor
- [ ] Trivial
### 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. -->
**Manual Tests** (with PR# 4010)
- 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 to reduce existing IP range to not include already allocated IPs
<!-- Please read the
[CONTRIBUTING](https://github.com/apache/cloudstack/blob/main/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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]