设备池与绑定体系 (P1–P3)、批量操作与 WebUI 全面升级
Device pool & binding (P1–P3), batch operations and a major WebUI upgrade
中文版
v0.2.0 引入设备实体与「设备池 → 绑定 Worker → 挂盘」三实体模型:新机器上报指纹自动入池,管理员在 WebUI 将其绑定到 Worker 并克隆系统盘后,机器自动进入目标系统。自动注册语义已反转(新 MAC 入池而非自动建 Worker),升级前请阅读「升级注意」。
新增
- 设备台账(P1)——
state/devices.yml三层实体模型落地,设备状态pooled/bound/revoked;新增GET /devices(state 过滤)、GET /devices/{mac}、POST /devices(手动注册)、POST /devices/import(批量入池,逐项独立、重复跳过)、DELETE /devices/{mac}(注销,绑定设备须先解绑) - 设备指纹上报——
GET /devices/report(不鉴权):iPXE 上报 11 字段指纹(MAC/UUID/SMBIOS/CPU/内存/网卡),未知 MAC 且自动注册开启时自动入池;boot.ipxe.cfg在/boot-vars前先上报,失败静默不影响引导 - 设备↔Worker 一对一绑定(P2)——绑定权威在设备侧:
POST /devices/{mac}/bind(force=true原子换绑,失败回滚台账快照)、DELETE /devices/{mac}/bind(解绑回池,盘留 Worker)、POST /devices/bind/batch/preview+POST /devices/bind/batch(清单配对 / 顺序配对,逐项独立、幂等、逐条审计) - boot-vars 防冒领(D2,绑定即认证)——带
mac的/boot-vars请求须来自命中 Worker 的绑定设备,不符拒绝下发空脚本 - 批量创建 Worker(P3)——
POST /workers/batch:count+name_prefix一次生成(如worker-→worker-01…),可选 MAC 清单逐项校验并直接绑定 - Worker 就绪度派生字段——
bound_device+readiness(ready/partial/idle) - 旧数据迁移——启动时幂等扫描存量
workers.yml+dhcp-hosts.conf,为存量绑定生成设备实体
WebUI
- 设备池页(
/devices)——状态过滤 / 搜索 / 行展开完整指纹、自动注册开关、手动注册、批量登记入池、多选解绑、绑定历史(换绑显示旧→新)、MAC 复制、「页面介绍」弹层 - 绑定向导——图形化顺序分配(默认,双栏勾选按序对应,Worker 不足按前缀自动补建)/ 清单配对两种模式,预览配对表 → 导出 TSV → 二次确认 → 失败项保留重试
- Workers 页——批量创建 Worker、批量创建系统盘(母盘克隆/空白盘,接管/拖拽/均摊分配存储节点)、批量删除、readiness 三态徽章、绑定列、「页面介绍」弹层
- Agents 页——「页面介绍」弹层
- Dashboard——新增设备数量统计卡(Workers / 设备池 / Agents 三卡)
- 文案消歧——「导入清单」更名为「登记设备入池」,悬停提示「不涉及绑定」
变更
- 自动注册语义反转(P1)——新 MAC 不再自动创建 Worker + dnsmasq 绑定,只入设备池等待绑定;
IPXE_CP_AUTO_REGISTER开关语义同步为「是否自动入池」,开关位置移至 Devices 页工具栏 POST /workers的mac改为可选——不传 = 纯空转 Worker;传 = 校验设备池并直接绑定,池外/已绑定 → 409PUT /workers/{worker_id}/mac映射为设备换绑、删除 Worker 联动解绑设备(失败中止删除)GET /operations支持mac过滤,批量绑定逐条审计- WebUI 版本号升至 0.2.0
修复
/boot-varsreboot 循环 payload 缺worker_id导致 500(池中未绑定设备场景)
文档
- 新增《WebUI 使用指南》(中英双语):页面分区、核心流程(入池 → 绑定 → 克隆建盘 → 默认启动)、常见问题
- 快速部署系列修正 P1 反转前的过期流程(自动入池 + 绑定向导)、2.4 节补充 WebUI 登记 Agent 方式
升级注意
- 自动注册语义反转:旧行为(新 MAC 自动成为 Worker)已移除,新设备仅入池,须在 WebUI「绑定向导」绑定后才会按 Worker 配置引导;未绑定设备保持 reboot 循环等待
- 新增运行时状态文件
state/devices.yml(不入库);settings.json纳入 .gitignore - 存量部署启动时自动迁移旧绑定,无需手工处理
English Version
v0.2.0 introduces the device entity and the three-entity model — pool → bind to Worker → mount disk. New machines report fingerprints and are auto-admitted into the device pool; the admin binds them to a Worker and clones a system disk in the WebUI, after which the machine boots straight into the target system. The auto-register semantics have flipped (new MACs enter the pool instead of auto-creating Workers) — read Upgrade Notes before upgrading.
New
- Device ledger (P1) —
state/devices.ymlimplements the three-entity model; device statespooled/bound/revoked; new endpointsGET /devices(state filter),GET /devices/{mac},POST /devices(manual register),POST /devices/import(bulk intake, per-item independent, duplicates skipped),DELETE /devices/{mac}(revoke; bound devices must be unbound first) - Fingerprint reporting —
GET /devices/report(unauthenticated): iPXE reports an 11-field fingerprint (MAC / UUID / SMBIOS / CPU / memory / NIC); unknown MACs are auto-admitted when auto-register is on;boot.ipxe.cfgreports before/boot-vars, failing silently without blocking boot - 1:1 device↔Worker binding (P2) — authority on the device side:
POST /devices/{mac}/bind(force=trueatomic rebind with ledger-snapshot rollback),DELETE /devices/{mac}/bind(back to pool, disk stays on the Worker),POST /devices/bind/batch/preview+POST /devices/bind/batch(manifest / sequential pairing, per-item independent, idempotent, per-item audit) - boot-vars anti-theft (D2, binding = authentication) —
/boot-varsrequests carrying amacmust come from the device bound to the matched Worker; otherwise an empty script is returned - Batch Worker creation (P3) —
POST /workers/batch:count+name_prefixin one go (e.g.worker-→worker-01…), optional MAC list validated and bound per item - Worker readiness projection —
bound_device+readiness(ready/partial/idle) - Legacy migration — on startup, existing
workers.yml+dhcp-hosts.confbindings are migrated into device entities idempotently
WebUI
- Devices page (
/devices) — state filter / search / expanded fingerprint, auto-register switch, manual register, bulk intake, multi-select unbind, binding history (rebinds show old → new), MAC copy, page guide popover - Bind wizard — graphical sequential allocation (default; two columns checked in order, missing Workers auto-created by prefix) / manifest pairing; preview → TSV export → confirm → retry with failed items kept
- Workers page — batch Worker creation, batch system-disk creation (master clone / empty disk; takeover / drag / spread node assignment), bulk delete, readiness badge, bound-device column, page guide popover
- Agents page — page guide popover
- Dashboard — device counter card (Workers / Device Pool / Agents)
- Naming disambiguation — "Import list" renamed to "Register to Pool" with a "No binding involved" hover hint
Changed
- Auto-register semantic flip (P1) — new MACs no longer auto-create a Worker + dnsmasq binding; they only enter the device pool awaiting binding; the
IPXE_CP_AUTO_REGISTERswitch now means "auto-admit to pool" and moved to the Devices page toolbar POST /workersmacis now optional — omitted = idle Worker (hostname only); provided = validated against the pool and bound directly; outside pool / already bound → 409PUT /workers/{worker_id}/macnow performs a device rebind; deleting a Worker unbinds its device first (aborts on failure)GET /operationssupportsmacfiltering; batch bindings are audited per item- WebUI version bumped to 0.2.0
Fixed
- 500 on
/boot-varsreboot-loop payload missingworker_id(pooled-but-unbound devices)
Docs
- New bilingual WebUI User Guide: page walkthrough, core flow (pool → bind → clone disk → default boot), troubleshooting
- Quick-deploy guides fixed to post-P1 flows (auto-pool + bind wizard); §2.4 adds WebUI agent registration
Upgrade Notes
- Auto-register semantic flip: the old behavior (new MAC auto-becomes a Worker) is gone; new devices only enter the pool and are guided only after being bound via the Bind wizard; unbound devices keep rebooting until configured
- New runtime state file
state/devices.yml(not committed);settings.jsonadded to .gitignore - Existing deployments migrate legacy bindings automatically at startup — no manual steps