CodeBleu opened a new pull request, #10968: URL: https://github.com/apache/cloudstack/pull/10968
### Description This PR will allow the updating of a loadbalancer rules `CIDR list` via the API. * Should fix https://github.com/apache/cloudstack/issues/9313 Not 100% sure this is the correct place to base and create PR for, but this issue does exist in `4.19`, `4.20`, and `main`. I figure I'd start here and see what is needed to get this into the code base so `>= 4.19` will have the fixes. I have tested this code in `4.19`, `4.20`, and `main` branches via simulator and all works, just not sure of the process to get this fix into those branches. <!--- 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: AUTOMATION 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) - [ ] 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) - [ ] build/CI - [ ] test (unit or integration test code) ### Feature/Enhancement Scale or Bug Severity #### Feature/Enhancement Scale - [ ] Major - [x] Minor #### Bug Severity - [ ] BLOCKER - [ ] Critical - [ ] Major - [x] Minor - [ ] Trivial ### Screenshots (if appropriate): Before, the Source CIDR list was blank (Simulator env)  ``` (localcloud) :penguin: > list loadbalancerrules { "count": 1, "loadbalancerrule": [ { "account": "admin", "algorithm": "roundrobin", "cidrlist": "", "domain": "ROOT", "domainid": "5b6a2947-416b-11f0-9a39-564a8191c23c", "domainpath": "/", "fordisplay": true, "id": "0d8e3cb9-767b-45f3-834d-3f9ce85df901", "name": "newlbtest", "networkid": "5bb3ecfb-cde3-4821-8822-0c4c8a8e9559", "privateport": "3306", "protocol": "tcp", "publicip": "192.168.2.10", "publicipid": "9b2638d7-7330-49c7-9d6e-5b5777f6ca16", "publicport": "3306", "state": "Add", "tags": [], "zoneid": "7cb86a09-676e-4f00-ad39-012f0eb2e69d", "zonename": "Sandbox-simulator" } ] } (localcloud) :penguin: > update loadbalancerrule id="0d8e3cb9-767b-45f3-834d-3f9ce85df901" cidrlist="1.2.3.4/32" { "loadbalancer": { "account": "admin", "algorithm": "roundrobin", "cidrlist": "1.2.3.4/32", "domain": "ROOT", "domainid": "5b6a2947-416b-11f0-9a39-564a8191c23c", "domainpath": "/", "fordisplay": true, "id": "0d8e3cb9-767b-45f3-834d-3f9ce85df901", "name": "newlbtest", "networkid": "5bb3ecfb-cde3-4821-8822-0c4c8a8e9559", "privateport": "3306", "protocol": "tcp", "publicip": "192.168.2.10", "publicipid": "9b2638d7-7330-49c7-9d6e-5b5777f6ca16", "publicport": "3306", "state": "Add", "tags": [], "zoneid": "7cb86a09-676e-4f00-ad39-012f0eb2e69d", "zonename": "Sandbox-simulator" } } (localcloud) :penguin: > update loadbalancerrule id="0d8e3cb9-767b-45f3-834d-3f9ce85df901" cidrlist= { "loadbalancer": { "account": "admin", "algorithm": "roundrobin", "cidrlist": "", "domain": "ROOT", "domainid": "5b6a2947-416b-11f0-9a39-564a8191c23c", "domainpath": "/", "fordisplay": true, "id": "0d8e3cb9-767b-45f3-834d-3f9ce85df901", "name": "newlbtest", "networkid": "5bb3ecfb-cde3-4821-8822-0c4c8a8e9559", "privateport": "3306", "protocol": "tcp", "publicip": "192.168.2.10", "publicipid": "9b2638d7-7330-49c7-9d6e-5b5777f6ca16", "publicport": "3306", "state": "Add", "tags": [], "zoneid": "7cb86a09-676e-4f00-ad39-012f0eb2e69d", "zonename": "Sandbox-simulator" } } ``` Tested on `actual test environment` and below is where you can see when it was restricted it didn't connect to mysql, but when opened up and CIDR set to 0.0.0.0/0 it worked. I tested with specific Public IP in CIDR as well (x.x.0.118/32) and this works and you can see in the virtual router for haproxy it set the ACL. **Restricted with wrong IP in source CIDR of LB** ``` тоб $ mysql -h x.x.x.110 -u root -p Enter password: ERROR 2013 (HY000): Lost connection to MySQL server at 'reading initial communication packet', system error: 104 ``` **With correct source CIDR or 0.0.0.0/0** ``` $ mysql -h x.x.x.110 -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 4730216 Server version: 8.0.33 MySQL Community Server - GPL Copyright (c) 2000, 2024, Oracle and/or its affiliates. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> quit Bye ```   ### 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 --> #### How did you try to break this feature and the system with this change? Ran multiple tests with Cloudmonkey against simulator and actual test environment. See above for testing info <!-- see how your change affects other areas of the code, etc. --> <!-- 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: commits-unsubscr...@cloudstack.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org