fix(topology/allocator): widen default subnet base to /12 for mass-scale
A 30-LAN generate request already fits in 172.20.0.0/16, but trees
with depth/branching that multiply past 256 (e.g. depth=6,
branching=4 ≈ 5k LANs) hit AllocatorExhausted before the first
write.
SubnetAllocator now accepts a full CIDR base ("172.16.0.0/12" →
4096 /24s) in addition to the legacy two-octet shorthand ("172.20",
auto-lifted to /16). The parent must be ≤/24; a /24 base yields
exactly one slot. Iteration order is preserved for /16 bases so
existing topologies keep their third-octet sweep; /12 adds a
second-octet dimension underneath.
Defaults bumped to 172.16.0.0/12: TopologyConfig.subnet_base_prefix,
/next-subnet query param, and the mutator's add-LAN fallback. The
field pattern widens to accept CIDR. create-blank and manual LAN
CRUD still use "10.0" (lifts to /16) — one DMZ LAN per topology,
256 is plenty.
This commit is contained in:
@@ -85,7 +85,10 @@ async def api_list_archetypes(
|
||||
)
|
||||
@_traced("api.topology.catalog.next_subnet")
|
||||
async def api_next_subnet(
|
||||
base: str = Query(default="172.20", pattern=r"^\d{1,3}\.\d{1,3}$"),
|
||||
base: str = Query(
|
||||
default="172.16.0.0/12",
|
||||
pattern=r"^\d{1,3}\.\d{1,3}(\.\d{1,3}\.\d{1,3}/\d{1,2})?$",
|
||||
),
|
||||
_viewer: dict = Depends(require_viewer),
|
||||
) -> NextSubnetResponse:
|
||||
reserved = await reserved_subnets(repo)
|
||||
|
||||
Reference in New Issue
Block a user