Proposal: reusable CTID ranges and CTID-derived MAC/IP defaults
维护者通常 1 天内回复
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 30/100
- Issue 类型
- 功能
- 描述清晰度
- 描述清楚
- 活跃度
- 停滞
- 技术栈
- bash
调研方向
Start with the existing defaults parser, allocation helper, and network-option builder described in the issue, then compare them with the draft implementation in core#143. Run the isolated Bash regression fixtures for range allocation, template expansion, overrides, API failures, and collision handling. Done means the approved settings select a reusable cluster-wide ID, derive or override valid network values consistently, prevent truncation and collisions, reject unsupported configurations, and leave Proxmox and Incus behavior distinct.
由索引模型根据 Issue 内容生成。
描述
Proposal
Draft implementation: core#143, with configuration examples, executable regression tests, and explicit runtime-validation limits.
Add opt-in defaults for selecting a free Proxmox container ID within a configured range, then deriving network values from that ID. Keep existing defaults unchanged when these settings are absent.
My use case is a homelab where container IDs, MAC suffixes, and addresses are deliberately related:
Minimum automatic CTID: 604
Selected CTID: 612
MAC suffix: 06:12
IPv4 suffix: .6.12
VLAN: 6
The range, network prefix, and VLAN are administrator supplied; 6xx is only this example. A different profile can start at 3001, select CTID 3042, and map it to MAC suffix 30:42 and IPv4 suffix .30.42. Allocation bounds and address-template representability are validated separately. The MAC example uses decimal digits as visible hexadecimal characters: 612 becomes 06:12, not the hexadecimal conversion 02:64.
Deleting a container should make its ID reusable. The next installation should choose the lowest available ID at or above the configured minimum, considering both VMs and containers throughout the cluster. An optional upper bound prevents a profile spilling into another address range.
Why this belongs in core
This affects shared defaults, ID selection, and the final container network configuration rather than any application installer. The contribution guide routes engine changes here.
There is related demand in the Container Defaults System discussion: users asked about deriving IP addresses from CTIDs and using a CTID prefix with an address suffix. This proposal would extend the existing defaults mechanism.
Existing alternatives
Proxmox already supports a datacenter-wide automatic VMID range through next-id.lower and next-id.upper. Its nextid implementation searches from the lower bound and reuses holes. That is sufficient when every automatic guest allocation should share one range. Passing --vmid checks that exact ID; it is not a starting-point argument.
A Community Scripts profile would instead scope the range to these installations or to an app-specific defaults file, without changing datacenter policy. Network templates are useful with either approach.
Proposed behavior
- Optional minimum/maximum CTID settings in the existing defaults system; an explicitly chosen CTID remains possible.
- Optional MAC, IPv4, and IPv6 templates with a small documented token vocabulary. No shell expressions,
eval, or arbitrary formatting programs. - Keep VLAN, bridge, gateway, DNS, and IPv6 mode in their existing settings.
- Support MAC template + DHCP for an existing OPNsense/router reservation. Static address templates are optional; this feature must not create or modify DHCP reservations.
- Validate the expanded values before creating a container. Reject unknown tokens, invalid addresses, and IDs that cannot fit the selected representation without truncation.
- Explicit network values take precedence. Persist templates as templates, not as the generated address of one container.
- If a concurrent installer claims the selected ID, either regenerate all derived settings consistently or stop with a clear error. Never create a different ID with the previous ID's addresses.
- Make backend support explicit. Proxmox-only settings must not silently affect Incus.
Validation and limits
An isolated Bash harness exercised the actual defaults parser, allocation helper, network-option builder, and extracted collision branch at core commit fbc2e15c848d11010a9d0e82c55e99d1dfe40e97. It confirmed that literal CTID/MAC/IPv4/VLAN settings reach the builder; placeholder MAC/IP values are rejected and unknown template/minimum keys are ignored. Searching from 604 with CT 604 and VM 605 occupied returns 606, and an orphan LVM volume for 606 makes it return 607.
The collision fixture also demonstrates why templates need lifecycle handling: the existing retry changes CTID 612 to 613 while passing the unchanged MAC suffix 06:12 and IPv4 .6.12. The PoC must prevent that mismatch for generated addresses. These are executed command-boundary fixtures with external operations stubbed, not provisioned containers.
I executed the upstream Proxmox nextid callback from the pinned revision above with isolated cluster/config fixtures. Five checks passed: lower 604 with occupied 604/605/607 selects 606; freeing 604 selects 604; vmid=604 rejects an occupied exact ID; absent range settings start at 100; and native upper 606 excludes 606. This checks the upstream algorithm, not a live Proxmox API call.
The accompanying draft PoC at e6e29df has 40 passing isolated scenarios on macOS and Debian 13 ARM64, covering hole reuse, cluster-wide VM/CT occupancy, API failures, template expansion, literal overrides, defaults round trips, wizard navigation, and collision handling. Generic cases include IDs 1201, 3042, and 20012 with compatible templates and overflow rejection. Three independent review rounds resolved all reproduced findings; seven injected networking faults are detected by the tests. Upstream executable CI still awaits maintainer authorization, and real Proxmox provisioning remains unverified.
This is not an IP address manager: a free CTID does not prove that the generated IP/MAC is unused on the network. Administrators still own subnet design, DHCP exclusions/reservations, routing, and uniqueness across separate clusters. No live infrastructure changes are part of this proposal.
The configuration names and token syntax are proposed for discussion, not an established public API.
- 主要语言
- Shell
- 星标
- 11
- 派生
- 17
- 平均合并
- 7 小时 39 分钟
- 30 天内合并 PR
- 89
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
community-scripts/core 的其他 Issue
-
bug
难度 2/5 1-3 小时 新手友好度 68/100
community-scripts/core#217 ·
维护者通常 1 天内回复
-
NVIDIA: userspace installation fails because exact-version dependencies are not pinned可能已有人在做 @MickLesk 今天认领。 未关闭
难度 3/5 1-2 天 新手友好度 76/100
community-scripts/core#209 · 1 条评论 ·
维护者通常 1 天内回复
查看 community-scripts/core 的全部 Issue
相似的 Issue
-
enhancement
难度 2/5 1-3 小时 新手友好度 68/100
Frogging-Family/linux-tkg#1265 ·
-
known-red S3: friction & debt
难度 2/5 1-3 小时 新手友好度 82/100
MedakaLang/medaka#4969 ·
维护者通常 1 天内回复
-
enhancement needs:sonnet ready-for-agent
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
area/tooling contribfest No AI type/cleanup type/feature
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
oracle/vagrant-projects#594 ·