Before this change, both the public LB form (LoadBalancing.vue) and the
internal LB form (network.js Internal LB action) hard-coded the algorithm
dropdown to ['source', 'roundrobin', 'leastconn']. Every Lb provider got the
same three options regardless of what the provider actually supported, so a
user could pick "leastconn" against, e.g., the OVN provider, only to get the
rule rejected later by validateLBRule. The capability is already declared
(NetworkElement.getCapabilities() -> Service.Lb -> Capability.SupportedLBAlgorithms)
and surfaced by listNetworks - we just weren't reading it.
LoadBalancing.vue (public LB - the create modal and the edit-rule modal):
- Replaces the three static <a-select-option>s with a v-for over a new
`supportedAlgorithms` data field defaulting to the legacy
['roundrobin', 'leastconn', 'source'] (so providers/networks that don't
declare the capability behave exactly as before).
- Adds fetchLbCapabilities() (called from fetchData) which:
* resolves the network id from resource.associatednetworkid or
resource.networkid,
* looks up the network via listNetworks,
* walks service[name=Lb].capability[name=SupportedLbAlgorithms] and
splits the CSV into the dropdown list,
* snaps newRule.algorithm to the first supported value if the previous
default falls outside the new set,
* swallows any error so we never break the page on a backend hiccup.
listNetworks is the right endpoint here. listNetworkOfferings hard-codes
only SupportedLBIsolation/ElasticLb/InlineMode/VmAutoScaling for the Lb
service in createNetworkOfferingResponse, while createNetworkResponse
walks the live provider's getCapabilities() and exposes everything we
declared - including SupportedLbAlgorithms.
network.js (internal LB action):
- Leaves the static option list in place but flags the spot with a TODO.
Driving this declaratively requires AutogenView to support an async or
function-valued `mapping[field].options`, which is a framework-level
change and out of scope for this UI patch. A follow-up can convert the
declarative mapping to a SFC and adopt the same approach as the public
LB form.
The change is provider-agnostic: it benefits every Lb provider that
correctly declares SupportedLBAlgorithms. OVN gets {roundrobin, source};
VirtualRouter keeps {roundrobin, leastconn, source}; Netscaler/F5/etc.
will reflect whatever they declare, and providers without the capability
fall back to the legacy three.
This commit is intentionally self-contained on top of the OVN plugin work
so it can be cherry-picked into a dedicated upstream PR.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Description
The LB algorithm dropdown in every Load Balancer form was hard-coded to
['source', 'roundrobin', 'leastconn'] regardless of what the network's Lb
provider actually supports. A user could pick leastconn against a provider
that does not implement it (e.g. a third-party or future provider that
declares only a subset), and the rule would only be rejected later by
validateLBRule on the backend.
The capability is already declared by every NetworkElement via
getCapabilities() -> Service.Lb -> Capability.SupportedLBAlgorithms
and surfaced by listNetworks (createNetworkResponse walks the live
provider's capabilities verbatim). The UI just was not reading it.
This PR makes every LB algorithm dropdown data-driven from that capability,
across the four places where the list was hard-coded:
the VPC details page.
VPC public AutoScale LB.
a TODO; converting it requires AutogenView to support async/function-
valued mapping[field].options, which is a framework-level change out of
scope here).
How it works
Each form gains a supportedAlgorithms data field (default
['roundrobin', 'leastconn', 'source'] — the legacy list) and a
fetchLbCapabilities*() helper that:
resource.networkid / the selected tier.
splits the CSV into the dropdown list.
previous default falls outside the new set.
that do not declare the capability behave exactly as before.
listNetworks is used (not listNetworkOfferings) because the offering
response hard-codes only SupportedLBIsolation / ElasticLb / InlineMode / VmAutoScaling for the Lb service, whereas createNetworkResponse exposes
the full provider capability set including SupportedLbAlgorithms.
Backwards compatibility
Provider-agnostic and fully backwards-compatible:
Types of changes
How Has This Been Tested?
UI exercised against a 4.23-dev environment with two Lb providers declaring
different SupportedLBAlgorithms sets:
Verified that backend errors on listNetworks (simulated by stopping the management server briefly) do not break the dropdown — it falls back to the legacy three and the form remains usable.