You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by "bhouse-nexthop (via GitHub)" <gi...@apache.org> on 2026/09/10 14:37:48 UTC
[PR] Fix two bugs in the virtual router's HAProxy config [cloudstack]
bhouse-nexthop opened a new pull request, #14131:
URL: https://github.com/apache/cloudstack/pull/14131
### Description
Two bugs in the HAProxy config the virtual router generates. Both are in
`HAProxyConfigurator`, both are independent of each other, and each is one commit.
#### 1. `option forceclose` is not a valid keyword
With keepalive enabled, an LB rule that also uses HTTP-based stickiness or SSL offload emits
`no option forceclose`. HAProxy has rejected that keyword since 2.0, and the system VM is Debian 12
(HAProxy 2.6):
```
[ALERT] config : parsing [haproxy.cfg:22]: option 'forceclose' is not supported any more
since HAProxy 2.0, please just remove it, or use 'option httpclose' if absolutely
needed.
[ALERT] config : Fatal errors found in configuration.
```
The whole file is rejected, so haproxy keeps serving the previous config and the rule silently
never takes effect. Replaced with `option http-keep-alive`, which expresses the same intent and is
valid on every version the system VM has shipped.
#### 2. One rule's settings leak into every rule generated afterwards
`globalSection` and `defaultsSection` are `static String[]`. The generator wraps them in
`Arrays.asList(...)` and calls `set()`, which writes **through** to the arrays, so the value
survives the call:
| set once by | leaks as |
|---|---|
| keepalive on any rule | `no option httpclose` in the defaults for every later rule, any network, any account |
| `idleTimeout` > 0 | that timeout becomes the default for the next rule |
| `idleTimeout` == 0 | timeouts blanked permanently |
Copying the arrays fixes it. Output is unchanged for a single rule.
### Types of changes
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
- [ ] New feature (non-breaking change which adds functionality)
- [x] 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)
- [ ] Build/CI
- [ ] Test (unit or integration test code)
### Feature/Enhancement Scale or Bug Severity
#### Bug Severity
- [ ] BLOCKER
- [ ] Critical
- [x] Major
- [ ] Minor
- [ ] Trivial
### How Has This Been Tested?
Three new cases in `HAProxyConfiguratorTest`, each of which fails without the corresponding fix:
- keepalive + SSL offload emits no `forceclose` and does emit `option http-keep-alive`
- a keepalive config followed by a non-keepalive one does not leave `no option httpclose` behind
- an idle timeout followed by an unset one falls back to the built-in default
`Tests run: 8, Failures: 0`. Reverting the two fixes gives `Failures: 3`.
The generated snippets were also checked against a real `haproxy -c`, which is where the alert text
above comes from. `option http-keep-alive` and `no option httpclose` both parse clean; per-listen
directives coexist with TCP listeners in the same file.
--
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-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] LB: per-rule keepalive and timeouts, plus three HAProxy config fixes [cloudstack]
Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #14131:
URL: https://github.com/apache/cloudstack/pull/14131#issuecomment-6360689539
<b>[SF] Trillian Build Failed (tid-17222)<b/>
--
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-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] LB: per-rule keepalive and timeouts, plus three HAProxy config fixes [cloudstack]
Posted by "blueorangutan (via GitHub) via commits" <co...@cloudstack.apache.org>.
blueorangutan commented on PR #14131:
URL: https://github.com/apache/cloudstack/pull/14131#issuecomment-6808418731
Packaging result [SF]: ✖️ el8 ✖️ el9 ✖️ debian ✖️ suse15. SL-JID 20007
--
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-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] LB: per-rule keepalive and timeouts, plus three HAProxy config fixes [cloudstack]
Posted by "bhouse-nexthop (via GitHub)" <gi...@apache.org>.
bhouse-nexthop commented on PR #14131:
URL: https://github.com/apache/cloudstack/pull/14131#issuecomment-5623444727
@weizhouapache good catch, thanks - added in the latest commit.
`haproxy_check.py` knew about `maxconn` and the global idle timeout, so the new per rule settings
could drift with nothing noticing. The health check data now carries all three, and the check
validates them in that rule's own `listen` section:
| data | checked |
|---|---|
| `ruleKeepAlive` | `option http-keep-alive`, or `option httpclose` |
| `ruleIdleTimeout` | `timeout client`, `timeout server` |
| `ruleKeepAliveTimeout` | `timeout http-keep-alive` |
The http mode test needed widening as well, otherwise a rule that sets keepalive itself stopped
being checked at all:
```
before port 80 and the offering has keepalive off
after port 80 and (the rule sets keepalive, or the offering has it off)
```
Compatibility: an older management server sends none of these keys, and a rule that inherits sends
them empty. Both read as nothing to check, so an updated system VM template against an older
management server still passes.
I ran the script against generated configs rather than only reading it - a matching config passes,
and each of a wrong keepalive option, a drifted `timeout client` and a missing
`timeout http-keep-alive` fails.
--
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-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] LB: per-rule keepalive and timeouts, plus three HAProxy config fixes [cloudstack]
Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #14131:
URL: https://github.com/apache/cloudstack/pull/14131#issuecomment-6289682637
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 19626
--
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-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] LB: per-rule keepalive and timeouts, plus three HAProxy config fixes [cloudstack]
Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #14131:
URL: https://github.com/apache/cloudstack/pull/14131#issuecomment-6380660046
<b>[SF] Trillian test result (tid-17228)</b>
Environment: kvm-ol8 (x2), zone: Advanced Networking with Mgmt server ol8
Total time taken: 61697 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr14131-t17228-kvm-ol8.zip
Smoke tests completed. 156 look OK, 1 have errors, 0 did not run
Only failed and skipped tests results shown below:
Test | Result | Time (s) | Test File
--- | --- | --- | ---
test_04_dhcp_dns_userdata | `Error` | 7.36 | test_network_extension_namespace.py
--
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-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] LB: per-rule keepalive and timeouts, plus three HAProxy config fixes [cloudstack]
Posted by "blueorangutan (via GitHub) via commits" <co...@cloudstack.apache.org>.
blueorangutan commented on PR #14131:
URL: https://github.com/apache/cloudstack/pull/14131#issuecomment-6804408945
Packaging result [SF]: ✖️ el8 ✖️ el9 ✖️ debian ✖️ suse15. SL-JID 20002
--
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-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] LB: per-rule keepalive and timeouts, plus three HAProxy config fixes [cloudstack]
Posted by "DaanHoogland (via GitHub) via commits" <co...@cloudstack.apache.org>.
DaanHoogland commented on PR #14131:
URL: https://github.com/apache/cloudstack/pull/14131#issuecomment-6856843617
@blueorangutan test
--
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-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] LB: per-rule keepalive and timeouts, plus three HAProxy config fixes [cloudstack]
Posted by "blueorangutan (via GitHub) via commits" <co...@cloudstack.apache.org>.
blueorangutan commented on PR #14131:
URL: https://github.com/apache/cloudstack/pull/14131#issuecomment-6804484782
Packaging result [SF]: ✖️ el8 ✖️ el9 ✖️ debian ✖️ suse15. SL-JID 20003
--
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-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] LB: per-rule keepalive and timeouts, plus three HAProxy config fixes [cloudstack]
Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #14131:
URL: https://github.com/apache/cloudstack/pull/14131#issuecomment-6359328722
@DaanHoogland a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests
--
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-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] LB: per-rule keepalive and timeouts, plus three HAProxy config fixes [cloudstack]
Posted by "Damans227 (via GitHub)" <gi...@apache.org>.
Damans227 commented on code in PR #14131:
URL: https://github.com/apache/cloudstack/pull/14131#discussion_r4209147792
##########
server/src/main/java/com/cloud/network/lb/LoadBalancingRulesManagerImpl.java:
##########
@@ -2285,6 +2289,42 @@ public List<LbDestination> getExistingDestinations(long lbId) {
return dstList;
}
+ /**
+ * Haproxy rejects a negative timeout, and a rejected file leaves every rule on the router
+ * running its previous config. Refuse the value here rather than let it reach the VR.
+ */
+ protected void validateConnectionTimeout(String name, Long value) {
+ if (value != null && value < 0) {
+ throw new InvalidParameterValueException(String.format("%s must be 0 or greater, got [%s]. 0 means no timeout.", name, value));
+ }
+ }
+
+ @Override
+ public boolean updateLoadBalancerConnectionSettings(long lbRuleId, Boolean keepAlive, Long idleTimeout, Long keepAliveTimeout) {
+ validateConnectionTimeout(ApiConstants.IDLE_TIMEOUT, idleTimeout);
+ validateConnectionTimeout(ApiConstants.KEEPALIVE_TIMEOUT, keepAliveTimeout);
+
+ boolean changed = storeDetail(lbRuleId, LoadBalancer.KEEPALIVE, keepAlive == null ? null : keepAlive.toString());
+ changed |= storeDetail(lbRuleId, LoadBalancer.IDLE_TIMEOUT, idleTimeout == null ? null : idleTimeout.toString());
+ changed |= storeDetail(lbRuleId, LoadBalancer.KEEPALIVE_TIMEOUT, keepAliveTimeout == null ? null : keepAliveTimeout.toString());
+ return changed;
+ }
+
+ private boolean storeDetail(long lbRuleId, String key, String value) {
+ if (value == null) {
Review Comment:
that covers it, thanks
##########
server/src/main/java/com/cloud/network/lb/LoadBalancingRulesManagerImpl.java:
##########
@@ -2342,6 +2382,9 @@ public LoadBalancer updateLoadBalancerRule(UpdateLoadBalancerRuleCmd cmd) {
lb.setCidrList(cidrListStr);
}
+ // lb.getId() rather than the id off the command, which is a Long and unboxes badly
+ boolean settingsChanged = updateLoadBalancerConnectionSettings(lb.getId(), cmd.getKeepAlive(), cmd.getIdleTimeout(), cmd.getKeepAliveTimeout());
Review Comment:
that covers it, thanks
--
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-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] LB: per-rule keepalive and timeouts, plus three HAProxy config fixes [cloudstack]
Posted by "DaanHoogland (via GitHub) via commits" <co...@cloudstack.apache.org>.
DaanHoogland commented on PR #14131:
URL: https://github.com/apache/cloudstack/pull/14131#issuecomment-6828597892
@blueorangutan package
--
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-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] LB: per-rule keepalive and timeouts, plus three HAProxy config fixes [cloudstack]
Posted by "Damans227 (via GitHub)" <gi...@apache.org>.
Damans227 commented on code in PR #14131:
URL: https://github.com/apache/cloudstack/pull/14131#discussion_r4273607305
##########
server/src/main/java/com/cloud/network/lb/LoadBalancingRulesManagerImpl.java:
##########
@@ -2348,6 +2421,12 @@ public LoadBalancer updateLoadBalancerRule(UpdateLoadBalancerRuleCmd cmd) {
throw new InvalidParameterValueException(String.format("Modifications in lb rule %s are not supported.", lb));
}
+ // The settings are written straight to the details table, unlike the fields above that wait
+ // for _lbDao.update, so they are stored only once nothing else can reject the update
+ Map<String, String> settingsBackup = getConnectionSettings(lbRuleId);
+ boolean settingsChanged = updateLoadBalancerConnectionSettings(lbRuleId, cmd.getKeepAlive(), cmd.getIdleTimeout(), cmd.getKeepAliveTimeout(),
Review Comment:
that covers it, the test sets the rule id now in 4433e91187
--
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-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] LB: per-rule keepalive and timeouts, plus three HAProxy config fixes [cloudstack]
Posted by "Damans227 (via GitHub)" <gi...@apache.org>.
Damans227 commented on code in PR #14131:
URL: https://github.com/apache/cloudstack/pull/14131#discussion_r4221017356
##########
server/src/main/java/com/cloud/network/lb/LoadBalancingRulesManagerImpl.java:
##########
@@ -2348,6 +2421,12 @@ public LoadBalancer updateLoadBalancerRule(UpdateLoadBalancerRuleCmd cmd) {
throw new InvalidParameterValueException(String.format("Modifications in lb rule %s are not supported.", lb));
}
+ // The settings are written straight to the details table, unlike the fields above that wait
+ // for _lbDao.update, so they are stored only once nothing else can reject the update
+ Map<String, String> settingsBackup = getConnectionSettings(lbRuleId);
+ boolean settingsChanged = updateLoadBalancerConnectionSettings(lbRuleId, cmd.getKeepAlive(), cmd.getIdleTimeout(), cmd.getKeepAliveTimeout(),
Review Comment:
the build is red here: UpdateLoadBalancerTest.testValidateRuleBeforeUpdateLB crashes because its command has no rule id. can we set the id in that test? https://github.com/apache/cloudstack/actions/runs/37645766377/job/112876606063
--
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-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] LB: per-rule keepalive and timeouts, plus three HAProxy config fixes [cloudstack]
Posted by "bhouse-nexthop (via GitHub) via commits" <co...@cloudstack.apache.org>.
bhouse-nexthop commented on PR #14131:
URL: https://github.com/apache/cloudstack/pull/14131#issuecomment-6953431139
@RosiKyu thanks for the thorough test, and for the clear repro. You're right about the leftover rule. Fixed in 8d3ec34af9.
**The leftover rule.** `createLoadBalancerRule` created the rule first and stored the per rule settings after it, so the timeout check ran too late. The command now checks `idletimeout` and `keepalivetimeout` before the rule is created. A refused create leaves no rule and no firewall rule, the same as `algorithm=foo`. A new unit test (`CreateLoadBalancerRuleCmdTest`) checks that a refused value never reaches `createPublicLoadBalancerRule`. Any rule already left behind by the old build still needs deleting by hand, as you did.
**`idletimeout=99999999999`.** Taken up: the API now refuses a timeout above 2147483647 ms, the largest HAProxy accepts. The error says so, so the user no longer gets only "Failed to update load balancer rule". The check covers both timeouts, on create and on update.
**`idletimeout=0`.** I've left this one as it is. `0` means no timeout, the same as for the global `network.loadbalancer.haproxy.idle.timeout` from #12586. When the global is 0, the generator removes `timeout client` and `timeout server` from `defaults`, and `haproxy -c` gives the same "missing timeouts" warning. The per rule value matches that meaning. The warning is HAProxy's advice against unlimited timeouts, and the parameter description already says what 0 does.
--
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-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] LB: per-rule keepalive and timeouts, plus three HAProxy config fixes [cloudstack]
Posted by "RosiKyu (via GitHub) via commits" <co...@cloudstack.apache.org>.
RosiKyu commented on PR #14131:
URL: https://github.com/apache/cloudstack/pull/14131#issuecomment-6973448246
@blueorangutan package
--
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-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix two bugs in the virtual router's HAProxy config [cloudstack]
Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #14131:
URL: https://github.com/apache/cloudstack/pull/14131#issuecomment-5620602358
## [Codecov](https://app.codecov.io/gh/apache/cloudstack/pull/14131?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
:white_check_mark: All modified and coverable lines are covered by tests.
:white_check_mark: Project coverage is 4.02%. Comparing base ([`d0d49bc`](https://app.codecov.io/gh/apache/cloudstack/commit/d0d49bc864ad2558671552d6f526a1137cba5aea?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`a8f56df`](https://app.codecov.io/gh/apache/cloudstack/commit/a8f56df746a0f4f8592adf93477574b4779df8c8?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
> :exclamation: There is a different number of reports uploaded between BASE (d0d49bc) and HEAD (a8f56df). Click for more details.
>
> <details><summary>HEAD has 1 upload less than BASE</summary>
>
>| Flag | BASE (d0d49bc) | HEAD (a8f56df) |
>|------|------|------|
>|unittests|1|0|
></details>
<details><summary>Additional details and impacted files</summary>
```diff
@@ Coverage Diff @@
## 4.22 #14131 +/- ##
=============================================
- Coverage 17.93% 4.02% -13.92%
=============================================
Files 5928 449 -5479
Lines 535174 38239 -496935
Branches 65494 7082 -58412
=============================================
- Hits 95981 1538 -94443
+ Misses 428266 36489 -391777
+ Partials 10927 212 -10715
```
| [Flag](https://app.codecov.io/gh/apache/cloudstack/pull/14131/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
|---|---|---|
| [uitests](https://app.codecov.io/gh/apache/cloudstack/pull/14131/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `4.02% <ø> (ø)` | |
| [unittests](https://app.codecov.io/gh/apache/cloudstack/pull/14131/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
</details>
[:umbrella: View full report in Codecov by Harness](https://app.codecov.io/gh/apache/cloudstack/pull/14131?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
<details><summary> :rocket: New features to boost your workflow: </summary>
- :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
- :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
</details>
--
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-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] LB: per-rule keepalive and timeouts, plus three HAProxy config fixes [cloudstack]
Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #14131:
URL: https://github.com/apache/cloudstack/pull/14131#issuecomment-6288153669
@DaanHoogland a [SL] Jenkins job has been kicked to build packages. It will be bundled with no SystemVM templates. I'll keep you posted as I make progress.
--
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-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] LB: per-rule keepalive and timeouts, plus three HAProxy config fixes [cloudstack]
Posted by "blueorangutan (via GitHub) via commits" <co...@cloudstack.apache.org>.
blueorangutan commented on PR #14131:
URL: https://github.com/apache/cloudstack/pull/14131#issuecomment-6804038204
@RosiKyu a [SL] Jenkins job has been kicked to build packages. It will be bundled with no SystemVM templates. I'll keep you posted as I make progress.
--
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-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] LB: per-rule keepalive and timeouts, plus three HAProxy config fixes [cloudstack]
Posted by "blueorangutan (via GitHub) via commits" <co...@cloudstack.apache.org>.
blueorangutan commented on PR #14131:
URL: https://github.com/apache/cloudstack/pull/14131#issuecomment-6806718121
@RosiKyu a [SL] Jenkins job has been kicked to build packages. It will be bundled with no SystemVM templates. I'll keep you posted as I make progress.
--
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-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] LB: per-rule keepalive and timeouts, plus three HAProxy config fixes [cloudstack]
Posted by "bhouse-nexthop (via GitHub) via commits" <co...@cloudstack.apache.org>.
bhouse-nexthop commented on PR #14131:
URL: https://github.com/apache/cloudstack/pull/14131#issuecomment-6733519502
### Test report: per-rule keepalive and timeouts, and the HAProxy fixes, on running virtual routers
**Environment**
- A CloudStack 24.0 (main) build with this PR applied, alongside some of my other open PRs. This PR targets main, so no backport caveat applies.
- Three KVM hosts on Ubuntu 24.04, nested virtualisation; Ceph RBD primary storage.
- System VM template 4.22.0 (Debian 12, HAProxy 2.6.12). The routers were created on this build. Their `configure.py` and `/root/health_checks/haproxy_check.py` match the build's.
- Two isolated networks:
- N1 on `DefaultIsolatedNetworkOfferingWithSourceNatService`, with backends B1 and B2 (Ubuntu 24.04, nginx). nginx logs `X-Forwarded-For`, `$connection` and `$connection_requests`, and sets `JSESSIONID=sess-<name>`.
- N2 on a copy of that offering with `keepaliveenabled=true`, with backend B3.
- I moved N2's router onto N1's KVM host, so that one agent JVM generated both routers' configs.
- The client was a host on the public network.
**1. An http rule with all three settings**
`createLoadBalancerRule ... publicport=80 keepalive=true idletimeout=600000 keepalivetimeout=15000`, with B1 and B2:
```
listen <P1>-80
bind <P1>:80
mode http
option http-keep-alive
timeout http-keep-alive 15000
timeout client 600000
timeout server 600000
balance roundrobin
server <P1>-80_0 <B2>:80 check
server <P1>-80_1 <B1>:80 check
```
- `haproxy -c` reports the file valid.
- `listLoadBalancerRules` returns `keepalive=true, idletimeout=600000, keepalivetimeout=15000`.
- `curl -v` with four URLs on one command line: `Connected`, then `Re-using existing connection` three times. The answers alternate B2, B1, B2, B1.
- nginx on each backend shows the client address in XFF, and two requests on one backend connection: `xff="<client>" conn=2 reqs=1` and then `conn=2 reqs=2`.
So keep-alive and `X-Forwarded-For` work together on one rule. They could not before.
**2. A tcp rule with only an idle timeout** (`publicport=3306 idletimeout=120000`)
```
listen <P1>-3306
bind <P1>:3306
timeout client 120000
timeout server 120000
balance roundrobin
server <P1>-3306_0 <B1>:3306 check
```
**3. Rules that set nothing** render as before:
- Port 80: `mode http`, `option httpclose`, `balance`, `server` lines. The client gets `connection: close` on every response.
- Port 8080: `bind`, `balance`, `server` only.
- The `defaults` section keeps `option httpclose` and `timeout client/server 50000`.
**4. `no option forceclose` is gone (keepalive with LbCookie stickiness)**
- On rule 1 (per-rule keepalive), and on an N2 rule (keepalive from the offering, which is the old trigger), I added an `LbCookie` policy.
- Both render `mode http`, `option http-keep-alive`, the `cookie ... insert` line and the per-server cookies.
- `grep -c forceclose` is 0, and `haproxy -c` passes.
- haproxy is listening, and the haproxy cookie pins the client: four requests with it all go to the same backend.
- For comparison, the same file with `no option forceclose` in place of `option http-keep-alive` fails `haproxy -c`:
```
[ALERT] config : parsing [/tmp/fc.cfg:36]: option 'forceclose' is not supported any more since HAProxy 2.0 ...
[ALERT] config : Fatal errors found in configuration.
```
**5. AppCookie renders as a stick table.**
Since #13315 (merged 10-21; this PR's branch does not include it yet), `createLBStickinessPolicy methodname=AppCookie` is refused for Virtual Router networks:
```
AppCookie based stickiness (HAProxy 'appsession') is not supported on a Virtual Router, as this directive was removed in HAProxy 1.6
```
So the generator path is reached only by an AppCookie policy stored before an upgrade. To test that case, I inserted one (`cookie-name=JSESSIONID&length=52&holdtime=3h`) into `load_balancer_stickiness_policies` for a port 80 rule. Then I regenerated the config by editing another rule on the network.
```
stick-table type string len 52 size 10k expire 3h
stick store-response res.cook(JSESSIONID)
stick match req.cook(JSESSIONID)
```
- There is no `appsession`, and `haproxy -c` passes.
- Six requests with `Cookie: JSESSIONID=sess-B1` all go to B1, and six with `sess-B2` all go to B2. Without a cookie they alternate.
- `show table` holds both keys.
- The same file with `appsession JSESSIONID len 52 timeout 3h` fails `haproxy -c` with `'appsession' is not supported anymore since HAProxy 1.6`.
The PR description says AppCookie "is reachable from the API". That is no longer true on main because of #13315. The fix still matters for policies stored before that change.
**6. No leak between configs from one agent**
- I regenerated N2's config (keepalive offering: its `defaults` has `no option httpclose`), and then N1's config, on the same agent.
- N1's `defaults` still has `option httpclose`, and its port 80 rule without settings still has `option httpclose`.
- The 600000 and 120000 rule timeouts never reach either `defaults`, which stays at 50000.
**7. Health check**
- `getRouterHealthCheckResults performfreshchecks=true`: `haproxy_check.py` reports `All checks pass`.
- I changed `timeout client 45000` to `45001` by hand in the rule's listen section. The next fresh check failed with:
```
Expected 'timeout client 45000' in listen <P1>-80 but found 45001
```
- A real re-apply (an algorithm change on another rule) rewrote the file, and the check passed again.
**8. Back to defaults**
- `updateLoadBalancerRule cleanupconnectionsettings=true` returns success, and the three fields come back empty (retested on the fixed build, see below). The rule renders `mode http` / `option httpclose`, with the LbCookie lines kept.
- With `cleanupconnectionsettings=true keepalive=true`, the update returns success and only keepalive remains: `option http-keep-alive`, no timeouts. Connection reuse works again.
**9. Validation**
`idletimeout=-1` is refused on create (`idletimeout must be 0 or greater, got [-1]. 0 means no timeout.`) and on update. `keepalivetimeout=-1` is refused on update with the same wording.
**10. Rollback when the router update fails**
I reran this step on the build with both update fixes, so that only an unreachable router can make the update fail.
- `updateLoadBalancerRule idletimeout=30000 keepalivetimeout=20000` returned success.
- I stopped the agent of the router's host, so the update could not reach the router.
- `updateLoadBalancerRule idletimeout=45000 keepalivetimeout=25000` then failed with `Failed to update load balancer rule`.
- `listLoadBalancerRules` and `firewall_rule_details` still held the old 30000 / 20000, and the management server logged `LB Rollback rule`.
- With the agent back, the same update returned success, and the router shows `timeout client/server 45000` and `timeout http-keep-alive 25000`.
The test plan's first idea for this step was `chattr +i /etc/haproxy/haproxy.cfg` on the router. That does not fail the update: the router logs `Could not copy /etc/haproxy/haproxy.cfg.new to /etc/haproxy/haproxy.cfg`, reloads the old file and reports success. So the management server has nothing to roll back. That is router-side behaviour, unchanged by this PR.
**Result:** pass.
- Every generated config passes `haproxy -c` and is live.
- Keep-alive and XFF work together.
- Rules without settings render as before.
- There is no leak between configs.
- The health check notices drift.
- Reset to defaults and rollback behave as described.
**Two update bugs the lab found, both fixed in the PR**
The first run found two ways `updateLoadBalancerRule` returned job result 530 although the change had been applied:
- A rule created through the API without `protocol` has a NULL `lb_protocol`, and the SSL check after the apply threw an NPE on it. The PR now compares null-safely.
- An update that changes only connection settings failed with `Failed to update load balancer rule`. These settings live in `firewall_rule_details`, so no column of the rule changed and the DAO update reported no row updated. The PR now treats a settings change as a successful update.
I retested on a build with both fixes, on two rules: one created without `protocol`, and one with `protocol=tcp` as the UI sends it. Every update below returned success. `listLoadBalancerRules` showed the new values, the router's listen section had them, and `haproxy -c` passed after each.
| Rule | Update | Router listen section after it |
|---|---|---|
| no protocol | `keepalive=true idletimeout=600000 keepalivetimeout=15000` | `option http-keep-alive`, `timeout http-keep-alive 15000`, `timeout client/server 600000` |
| no protocol | `idletimeout=120000` | `timeout client 120000`, keep-alive timeout kept at 15000 |
| no protocol | `keepalivetimeout=20000` | `timeout http-keep-alive 20000` |
| no protocol | `algorithm=leastconn` | `balance leastconn`, timeouts kept |
| no protocol | `cleanupconnectionsettings=true` | no timeouts, no `http-keep-alive` |
| no protocol | `cleanupconnectionsettings=true keepalive=true` | `option http-keep-alive` only |
| no protocol | `idletimeout=45000` | `timeout client 45000`, keep-alive kept |
| `protocol=tcp` | `idletimeout=90000` | `timeout client/server 90000` |
| `protocol=tcp` | `keepalive=true` | timeouts kept |
| `protocol=tcp` | `keepalivetimeout=12000` | timeouts kept |
| `protocol=tcp` | `cleanupconnectionsettings=true` | no timeouts |
| `protocol=tcp` | `algorithm=source idletimeout=70000` | `balance source`, `timeout client/server 70000` |
- The management server log has no `getLbProtocol` / `NullPointerException` line over the retest.
- Requests through the rule still alternate between both backends.
- An update that names only the rule id and changes nothing still fails with `Failed to update load balancer rule`, as on stock. That is the only `Failed to update` line in the log.
**Not covered**
- The UI edit form (blank = "Use default", clearing a field sends `cleanupconnectionsettings`). I had no browser on the lab network.
- SSL offload rules, and the `tcp-proxy` protocol.
--
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-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] LB: per-rule keepalive and timeouts, plus three HAProxy config fixes [cloudstack]
Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #14131:
URL: https://github.com/apache/cloudstack/pull/14131#issuecomment-6346818120
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 19684
--
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-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] LB: per-rule keepalive and timeouts, plus three HAProxy config fixes [cloudstack]
Posted by "RosiKyu (via GitHub) via commits" <co...@cloudstack.apache.org>.
RosiKyu commented on PR #14131:
URL: https://github.com/apache/cloudstack/pull/14131#issuecomment-6804439869
@blueorangutan package
--
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-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] LB: per-rule keepalive and timeouts, plus three HAProxy config fixes [cloudstack]
Posted by "blueorangutan (via GitHub) via commits" <co...@cloudstack.apache.org>.
blueorangutan commented on PR #14131:
URL: https://github.com/apache/cloudstack/pull/14131#issuecomment-6831211579
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 20030
--
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-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] LB: per-rule keepalive and timeouts, plus three HAProxy config fixes [cloudstack]
Posted by "bhouse-nexthop (via GitHub) via commits" <co...@cloudstack.apache.org>.
bhouse-nexthop commented on PR #14131:
URL: https://github.com/apache/cloudstack/pull/14131#issuecomment-6828523569
@DaanHoogland thanks for the heads-up. #14166 removed the test's `java.util.Collections` import along with its last use, and this PR adds a new use, so the merged result didn't compile. I've merged main into the branch and restored the import (3f69e75a50). `LoadBalancingRulesManagerImplTest` (28), `UpdateLoadBalancerTest` (2) and `HAProxyConfiguratorTest` (17) pass on the merged code.
--
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-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] LB: per-rule keepalive and timeouts, plus three HAProxy config fixes [cloudstack]
Posted by "DaanHoogland (via GitHub)" <gi...@apache.org>.
DaanHoogland commented on code in PR #14131:
URL: https://github.com/apache/cloudstack/pull/14131#discussion_r4197572359
##########
server/src/main/java/com/cloud/network/lb/LoadBalancingRulesManagerImpl.java:
##########
@@ -2342,6 +2382,9 @@ public LoadBalancer updateLoadBalancerRule(UpdateLoadBalancerRuleCmd cmd) {
lb.setCidrList(cidrListStr);
}
+ // lb.getId() rather than the id off the command, which is a Long and unboxes badly
+ boolean settingsChanged = updateLoadBalancerConnectionSettings(lb.getId(), cmd.getKeepAlive(), cmd.getIdleTimeout(), cmd.getKeepAliveTimeout());
Review Comment:
if `lbRuleId` is not a valid Long, line 2336 would have not yielded a valid `lb`. why do you think this is needed?
Also `lb.getId()` does not return a LoadBalancerRuleId but a LoadBalancerId, which is not as `updateLoadBalancerConnectionSettings` seems to require.
```suggestion
boolean settingsChanged = updateLoadBalancerConnectionSettings(lbRuleId, cmd.getKeepAlive(), cmd.getIdleTimeout(), cmd.getKeepAliveTimeout());
```
--
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-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] LB: per-rule keepalive and timeouts, plus three HAProxy config fixes [cloudstack]
Posted by "bhouse-nexthop (via GitHub)" <gi...@apache.org>.
bhouse-nexthop commented on code in PR #14131:
URL: https://github.com/apache/cloudstack/pull/14131#discussion_r4273543852
##########
server/src/main/java/com/cloud/network/lb/LoadBalancingRulesManagerImpl.java:
##########
@@ -2348,6 +2421,12 @@ public LoadBalancer updateLoadBalancerRule(UpdateLoadBalancerRuleCmd cmd) {
throw new InvalidParameterValueException(String.format("Modifications in lb rule %s are not supported.", lb));
}
+ // The settings are written straight to the details table, unlike the fields above that wait
+ // for _lbDao.update, so they are stored only once nothing else can reject the update
+ Map<String, String> settingsBackup = getConnectionSettings(lbRuleId);
+ boolean settingsChanged = updateLoadBalancerConnectionSettings(lbRuleId, cmd.getKeepAlive(), cmd.getIdleTimeout(), cmd.getKeepAliveTimeout(),
Review Comment:
Fixed in 4433e91187: the test now sets the rule id on the command and stubs `findById`/`update` with it. It also mocks `FirewallRuleDetailsDao`, which the settings are read from. I left the production code as it is: `id` is `required = true` on the API, and `lbRuleId` here is what @DaanHoogland asked for earlier, so only the test could reach the null. `testRuleNotValidated` used to pass only because the null id missed the lookup. It now finds the rule and fails on validation, as it was meant to. The other red checks were Sonar (same test) and a simulator smoke failure where the SSVM never reached Running, which this PR does not touch.
--
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-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] LB: per-rule keepalive and timeouts, plus three HAProxy config fixes [cloudstack]
Posted by "blueorangutan (via GitHub) via commits" <co...@cloudstack.apache.org>.
blueorangutan commented on PR #14131:
URL: https://github.com/apache/cloudstack/pull/14131#issuecomment-6874182495
<b>[SF] Trillian test result (tid-17577)</b>
Environment: kvm-ol8 (x2), zone: Advanced Networking with Mgmt server ol8
Total time taken: 56783 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr14131-t17577-kvm-ol8.zip
Smoke tests completed. 157 look OK, 0 have errors, 0 did not run
Only failed and skipped tests results shown below:
Test | Result | Time (s) | Test File
--- | --- | --- | ---
--
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-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] LB: per-rule keepalive and timeouts, plus three HAProxy config fixes [cloudstack]
Posted by "RosiKyu (via GitHub) via commits" <co...@cloudstack.apache.org>.
RosiKyu commented on PR #14131:
URL: https://github.com/apache/cloudstack/pull/14131#issuecomment-6803997620
@blueorangutan package
--
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-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] LB: per-rule keepalive and timeouts, plus three HAProxy config fixes [cloudstack]
Posted by "RosiKyu (via GitHub) via commits" <co...@cloudstack.apache.org>.
RosiKyu commented on PR #14131:
URL: https://github.com/apache/cloudstack/pull/14131#issuecomment-6806695809
@blueorangutan package
--
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-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] LB: per-rule keepalive and timeouts, plus three HAProxy config fixes [cloudstack]
Posted by "DaanHoogland (via GitHub) via commits" <co...@cloudstack.apache.org>.
DaanHoogland commented on PR #14131:
URL: https://github.com/apache/cloudstack/pull/14131#issuecomment-6828074528
@bhouse-nexthop FYI:
```
22:05:40 [ERROR] /jenkins/workspace/acs-centos8-pkg-builder/dist/rpmbuild/BUILD/cloudstack-24.0.0-SNAPSHOT/server/src/test/java/com/cloud/network/lb/LoadBalancingRulesManagerImplTest.java:[586,28] error: cannot find symbol
22:05:40 symbol: variable Collections
22:05:40 location: class LoadBalancingRulesManagerImplTest
```
--
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-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] LB: per-rule keepalive and timeouts, plus three HAProxy config fixes [cloudstack]
Posted by "bhouse-nexthop (via GitHub)" <gi...@apache.org>.
bhouse-nexthop commented on code in PR #14131:
URL: https://github.com/apache/cloudstack/pull/14131#discussion_r4208822665
##########
server/src/main/java/com/cloud/network/lb/LoadBalancingRulesManagerImpl.java:
##########
@@ -2342,6 +2382,9 @@ public LoadBalancer updateLoadBalancerRule(UpdateLoadBalancerRuleCmd cmd) {
lb.setCidrList(cidrListStr);
}
+ // lb.getId() rather than the id off the command, which is a Long and unboxes badly
+ boolean settingsChanged = updateLoadBalancerConnectionSettings(lb.getId(), cmd.getKeepAlive(), cmd.getIdleTimeout(), cmd.getKeepAliveTimeout());
Review Comment:
Agreed, the comment was wrong: `lb` is found by `lbRuleId` and is non-null here, so the unboxing is safe. Switched to `lbRuleId` in b5ff105b8e, matching `applyLoadBalancerConfig(lbRuleId)` further down. They are the same id though: `LoadBalancerVO` extends `FirewallRuleVO` and joins `load_balancing_rules` on `id`, so `lb.getId()` is the `firewall_rules` id, i.e. the rule id. A cleanup, not a behaviour change.
##########
server/src/main/java/com/cloud/network/lb/LoadBalancingRulesManagerImpl.java:
##########
@@ -2285,6 +2289,42 @@ public List<LbDestination> getExistingDestinations(long lbId) {
return dstList;
}
+ /**
+ * Haproxy rejects a negative timeout, and a rejected file leaves every rule on the router
+ * running its previous config. Refuse the value here rather than let it reach the VR.
+ */
+ protected void validateConnectionTimeout(String name, Long value) {
+ if (value != null && value < 0) {
+ throw new InvalidParameterValueException(String.format("%s must be 0 or greater, got [%s]. 0 means no timeout.", name, value));
+ }
+ }
+
+ @Override
+ public boolean updateLoadBalancerConnectionSettings(long lbRuleId, Boolean keepAlive, Long idleTimeout, Long keepAliveTimeout) {
+ validateConnectionTimeout(ApiConstants.IDLE_TIMEOUT, idleTimeout);
+ validateConnectionTimeout(ApiConstants.KEEPALIVE_TIMEOUT, keepAliveTimeout);
+
+ boolean changed = storeDetail(lbRuleId, LoadBalancer.KEEPALIVE, keepAlive == null ? null : keepAlive.toString());
+ changed |= storeDetail(lbRuleId, LoadBalancer.IDLE_TIMEOUT, idleTimeout == null ? null : idleTimeout.toString());
+ changed |= storeDetail(lbRuleId, LoadBalancer.KEEPALIVE_TIMEOUT, keepAliveTimeout == null ? null : keepAliveTimeout.toString());
+ return changed;
+ }
+
+ private boolean storeDetail(long lbRuleId, String key, String value) {
+ if (value == null) {
Review Comment:
Right, there was no way back: leaving it out keeps the value, negatives are refused, and keepalive is a boolean. e974792cfa adds `cleanupconnectionsettings` to updateLoadBalancerRule, following `cleanupdetails` on updateVirtualMachine/updateTemplate. It drops the rule's own keepalive/idletimeout/keepalivetimeout, then sets again any passed in the same call, so one call can clear one and keep the rest. 07af93829d makes the edit dialog send it when a field the rule had set is cleared.
##########
server/src/main/java/com/cloud/network/lb/LoadBalancingRulesManagerImpl.java:
##########
@@ -2342,6 +2382,9 @@ public LoadBalancer updateLoadBalancerRule(UpdateLoadBalancerRuleCmd cmd) {
lb.setCidrList(cidrListStr);
}
+ // lb.getId() rather than the id off the command, which is a Long and unboxes badly
+ boolean settingsChanged = updateLoadBalancerConnectionSettings(lb.getId(), cmd.getKeepAlive(), cmd.getIdleTimeout(), cmd.getKeepAliveTimeout());
Review Comment:
Yes, 5ae177450c restores the previous settings along with name/description/algorithm/cidrs when the apply fails. Same commit moves the settings write after `validateLbRule`: they went straight to the details table before validation, so a rule the provider rejected kept them. Unit tests cover both.
--
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-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] LB: per-rule keepalive and timeouts, plus three HAProxy config fixes [cloudstack]
Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #14131:
URL: https://github.com/apache/cloudstack/pull/14131#issuecomment-6344450227
@DaanHoogland a [SL] Jenkins job has been kicked to build packages. It will be bundled with no SystemVM templates. I'll keep you posted as I make progress.
--
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-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] LB: per-rule keepalive and timeouts, plus three HAProxy config fixes [cloudstack]
Posted by "DaanHoogland (via GitHub)" <gi...@apache.org>.
DaanHoogland commented on PR #14131:
URL: https://github.com/apache/cloudstack/pull/14131#issuecomment-6344430316
@blueorangutan package
--
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-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] LB: per-rule keepalive and timeouts, plus three HAProxy config fixes [cloudstack]
Posted by "blueorangutan (via GitHub) via commits" <co...@cloudstack.apache.org>.
blueorangutan commented on PR #14131:
URL: https://github.com/apache/cloudstack/pull/14131#issuecomment-6828631095
@DaanHoogland a [SL] Jenkins job has been kicked to build packages. It will be bundled with no SystemVM templates. I'll keep you posted as I make progress.
--
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-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] LB: per-rule keepalive and timeouts, plus three HAProxy config fixes [cloudstack]
Posted by "bhouse-nexthop (via GitHub) via commits" <co...@cloudstack.apache.org>.
bhouse-nexthop commented on PR #14131:
URL: https://github.com/apache/cloudstack/pull/14131#issuecomment-6906060779
Thanks @DaanHoogland. Trillian is clean on the build with main merged in (157 OK, 0 errors). The one Simulator CI failure is in `test_affinity_groups_projects`: all 16 of its tests passed, and only the suite's teardown failed, when deleting its test domain. That isn't related to this PR. From my side it's ready to merge.
--
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-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] LB: per-rule keepalive and timeouts, plus three HAProxy config fixes [cloudstack]
Posted by "blueorangutan (via GitHub) via commits" <co...@cloudstack.apache.org>.
blueorangutan commented on PR #14131:
URL: https://github.com/apache/cloudstack/pull/14131#issuecomment-6856870182
@DaanHoogland a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests
--
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-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] LB: per-rule keepalive and timeouts, plus three HAProxy config fixes [cloudstack]
Posted by "RosiKyu (via GitHub) via commits" <co...@cloudstack.apache.org>.
RosiKyu merged PR #14131:
URL: https://github.com/apache/cloudstack/pull/14131
--
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-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] LB: per-rule keepalive and timeouts, plus three HAProxy config fixes [cloudstack]
Posted by "Damans227 (via GitHub)" <gi...@apache.org>.
Damans227 commented on code in PR #14131:
URL: https://github.com/apache/cloudstack/pull/14131#discussion_r4199313582
##########
server/src/main/java/com/cloud/network/lb/LoadBalancingRulesManagerImpl.java:
##########
@@ -2285,6 +2289,42 @@ public List<LbDestination> getExistingDestinations(long lbId) {
return dstList;
}
+ /**
+ * Haproxy rejects a negative timeout, and a rejected file leaves every rule on the router
+ * running its previous config. Refuse the value here rather than let it reach the VR.
+ */
+ protected void validateConnectionTimeout(String name, Long value) {
+ if (value != null && value < 0) {
+ throw new InvalidParameterValueException(String.format("%s must be 0 or greater, got [%s]. 0 means no timeout.", name, value));
+ }
+ }
+
+ @Override
+ public boolean updateLoadBalancerConnectionSettings(long lbRuleId, Boolean keepAlive, Long idleTimeout, Long keepAliveTimeout) {
+ validateConnectionTimeout(ApiConstants.IDLE_TIMEOUT, idleTimeout);
+ validateConnectionTimeout(ApiConstants.KEEPALIVE_TIMEOUT, keepAliveTimeout);
+
+ boolean changed = storeDetail(lbRuleId, LoadBalancer.KEEPALIVE, keepAlive == null ? null : keepAlive.toString());
+ changed |= storeDetail(lbRuleId, LoadBalancer.IDLE_TIMEOUT, idleTimeout == null ? null : idleTimeout.toString());
+ changed |= storeDetail(lbRuleId, LoadBalancer.KEEPALIVE_TIMEOUT, keepAliveTimeout == null ? null : keepAliveTimeout.toString());
+ return changed;
+ }
+
+ private boolean storeDetail(long lbRuleId, String key, String value) {
+ if (value == null) {
Review Comment:
once a rule has its own timeout, how does someone go back to the default? clearing the field in the ui looks like it just keeps the old value
##########
server/src/main/java/com/cloud/network/lb/LoadBalancingRulesManagerImpl.java:
##########
@@ -2342,6 +2382,9 @@ public LoadBalancer updateLoadBalancerRule(UpdateLoadBalancerRuleCmd cmd) {
lb.setCidrList(cidrListStr);
}
+ // lb.getId() rather than the id off the command, which is a Long and unboxes badly
+ boolean settingsChanged = updateLoadBalancerConnectionSettings(lb.getId(), cmd.getKeepAlive(), cmd.getIdleTimeout(), cmd.getKeepAliveTimeout());
Review Comment:
if pushing the config to the router fails, should these settings be rolled back too? looks like only the name, algorithm and cidrs get restored
--
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-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] LB: per-rule keepalive and timeouts, plus three HAProxy config fixes [cloudstack]
Posted by "weizhouapache (via GitHub)" <gi...@apache.org>.
weizhouapache commented on PR #14131:
URL: https://github.com/apache/cloudstack/pull/14131#issuecomment-5622956097
@bhouse-nexthop
could you make some changes for VR health check ?
similar to https://github.com/apache/cloudstack/pull/12596 which fixes #12591
--
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-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] LB: per-rule keepalive and timeouts, plus three HAProxy config fixes [cloudstack]
Posted by "DaanHoogland (via GitHub)" <gi...@apache.org>.
DaanHoogland commented on PR #14131:
URL: https://github.com/apache/cloudstack/pull/14131#issuecomment-6314723061
@blueorangutan test
--
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-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] LB: per-rule keepalive and timeouts, plus three HAProxy config fixes [cloudstack]
Posted by "DaanHoogland (via GitHub)" <gi...@apache.org>.
DaanHoogland commented on PR #14131:
URL: https://github.com/apache/cloudstack/pull/14131#issuecomment-6359312006
@blueorangutan test
--
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-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] LB: per-rule keepalive and timeouts, plus three HAProxy config fixes [cloudstack]
Posted by "DaanHoogland (via GitHub)" <gi...@apache.org>.
DaanHoogland commented on PR #14131:
URL: https://github.com/apache/cloudstack/pull/14131#issuecomment-6288128765
@blueorangutan package
--
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-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] LB: per-rule keepalive and timeouts, plus three HAProxy config fixes [cloudstack]
Posted by "blueorangutan (via GitHub) via commits" <co...@cloudstack.apache.org>.
blueorangutan commented on PR #14131:
URL: https://github.com/apache/cloudstack/pull/14131#issuecomment-6804466160
@RosiKyu a [SL] Jenkins job has been kicked to build packages. It will be bundled with no SystemVM templates. I'll keep you posted as I make progress.
--
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-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] LB: per-rule keepalive and timeouts, plus three HAProxy config fixes [cloudstack]
Posted by "blueorangutan (via GitHub) via commits" <co...@cloudstack.apache.org>.
blueorangutan commented on PR #14131:
URL: https://github.com/apache/cloudstack/pull/14131#issuecomment-6973488459
@RosiKyu a [SL] Jenkins job has been kicked to build packages. It will be bundled with no SystemVM templates. I'll keep you posted as I make progress.
--
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-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] LB: per-rule keepalive and timeouts, plus three HAProxy config fixes [cloudstack]
Posted by "blueorangutan (via GitHub) via commits" <co...@cloudstack.apache.org>.
blueorangutan commented on PR #14131:
URL: https://github.com/apache/cloudstack/pull/14131#issuecomment-6974755710
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 20091
--
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-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org