Topology: YAML topology files and gateway priorities - #679
Conversation
Turn TopologyParser into a thin facade over an internal ConfigParser and an intermediate route list, so that a second configuration format can be added. No behavior change. Signed-off-by: Stephane Thiell <stephane@thiell.com>
feacb1d to
63b60a9
Compare
63b60a9 to
a2755a8
Compare
|
Renamed |
|
Thanks for the patch. routes:
- gateways: admin
targets: gw[1-2]
# gw1 preferred
- gateways:
- nodes: gw1
- nodes: gw2
priority: 2
targets: node[0-9]
# gw2 preferred
- gateways:
- nodes: gw2
- nodes: gw1
priority: 2
targets: node[5-14]
Similarly, we should avoid: gateways:
- nodes: gw[1-2]
- nodes: gw2
priority: 2Minor: we should tell to AI to not add ticket ID or PR ID in code comment, unless we will eventually have this kind of ref every where in the code. |
a2755a8 to
cd14600
Compare
|
Thanks, both confirmed and fixed.
|
cd14600 to
2cc637a
Compare
|
Add a YAML topology file syntax, selected by .yaml/.yml file extension. Routes are a list of gateways/targets objects and the same gateways may appear in several routes. topology.yaml is preferred over topology.conf at each config location. INI stays fully supported. PyYAML is imported lazily, as for YAML group files. Signed-off-by: Stephane Thiell <stephane@thiell.com>
In a YAML topology file, the gateways of a route may be a list of entries with nodes, weight and priority attributes. A lower number means a higher priority: gateways of a given priority are used only when all gateways with a lower priority number are unreachable. Gateways of equal priority share the load using weighted least-connections. Resolved priorities ride the propagation tree sent to gateways; older trees without priorities are still accepted. Signed-off-by: Stephane Thiell <stephane@thiell.com>
Document the topology.yaml syntax, gateway priorities and discovery precedence in config.rst and clush.rst. INI topology.conf remains documented as fully supported. Signed-off-by: Stephane Thiell <stephane@thiell.com>
2cc637a to
2a13f55
Compare
|
I briefly had a strict SafeLoader rejecting duplicate YAML keys (PyYAML keeps the last value silently) but dropped it: |
Implements the design discussed in #374 (see the design comment). Closes #374.
YAML topology files
topology.yamlfile syntax: routes as a list ofgateways/targetsobjects. Selected by file extension (.yaml/.yml), so--topologyworks with both syntaxes; INItopology.confremains fully supported.gatewaysmay appear in several routes: one gateway pool can reach several target groups, with symmetric failback — the core need from the PR Tree: support optional route weights in topology.conf (#374) #678 review.topology.yamlis preferred overtopology.confwhen both exist at the same config location.TopologyParserbecomes a thin facade over per-format backends; graph building and validation are unchanged and format-agnostic. The INI code path is untouched and still covered by the existing tests..yamltopologies fail.Gateway priorities
gatewaysof a route may be a list of entries with descriptive attributes, in the style of modern YAML tools such as lnetctl:nodes(node set, required),weight(load share among gateways of equal priority, default 1) andpriority(failover rank, default 1). A lower number means a higher priority: gateways of a given priority are used only when all gateways with a lower priority number are unreachable:gateways: [gw1, gw2]) is a load-shared pool, equivalent togateways: gw[1-2]— failover is always explicit withpriority, and the entry form keeps the schema extensible for future per-gateway attributes.weight(integers >= 1). Weight 0 is rejected: a standby gateway is a higher priority number, so there is only one mechanism.gatewayslist with different weights or priorities: both are rejected at parse time.TopologyTree; trees from older versions are still accepted, and the wire protocol is unchanged.Error reporting
topology.yaml: route #3: unsupported gateway entry key(s): prio (expected: nodes, priority, weight).topology.confholding YAML syntax now says so, instead of justInvalid configuration file. INI parsing itself is unchanged.Docs and tests
config.rst/clush.rstdocument the YAML syntax, quoting rules (@groupvalues must be quoted), precedence and priorities — including explicitly that a lowerprioritynumber wins;conf/topology.yaml.exampleadded.tests/TreeRouterTest.pycovers gateway selection: priority order, failover, mutual failback, weighted distribution, pool equivalence of plain lists, multi-level trees, pickled-tree round-trip, pre-1.11 tree compatibility. YAML parser tests added toTreeTopologyTest, including INI/YAML tree equivalence.Supersedes PR #678 (now a draft): the INI
[weights]section is not kept, and its weighted least-connections selection is reused as the load-sharing policy among gateways of equal priority.