part 4 文档:P2 差距表补记三缺陷修复

RETEST3 三个 cell 新缺陷的修复方向与实现位置记入 §6:
起步门 + init pid 轮询、volatile 空根只读绑(/app、CA、
单元专属 resolv.conf/hosts;不绑 nsswitch.conf 的原因)、
唯一身份分配 + broker 多 cell 对照、执行器记 body。
This commit is contained in:
host committed 2026-11-07 10:30:45 +00:00
1 parent f20cbc79cd
commit c4661b64db
1 file changed
+35
+35
View File
@@ -125,3 +125,38 @@ CDP 由单元外 broker 管理。
只做 uid 检查并打日志——该降级须在日志里可见)。
- 性能记录(只记录、不设门):单元启动到 codex 就绪耗时、veth+NAT 下
模型调用往返、qcow2 实际占用(systemd-container 与新脚本的增量)。
## 6. round-11 part 4 补记(2026-11-07,RETEST3 的 3 个 cell 新缺陷)
RETEST3 证实 `--volatile=yes` + 只遮 /usr 的形状本身生效(遮蔽经
mount/ls 实测有效),但引出三个阻塞缺陷,本轮按报告方向修:
1. **启动竞态**:`run_cell` 原顺序是 Popen → 配网 → 单次找 init pid,
快 payload 在配网完成前退出即撞墙(`run -- true` 11 次只成 6 次)。
修:payload 包一层 sh 起步门(等 `/run/chv/.cell-gate-<machine>`
出现再 exec),配网完成后才开门;`find_cell_init_pid` 改带超时
轮询;nspawn 已死时返回它的退出码而不是抛错;veth 等待放宽到
20 秒。验收:连续 15 次 `run -- true` 计数(cellrace4)。
2. **volatile 空根缺文件**:单元根是基本空的 tmpfs,`/app`、
`/etc/resolv.conf`、`/etc/hosts`、`/etc/ssl/certs` 全无,执行器
单元路径一律 ENOENT、DNS/TLS 不可用。修:`--bind-ro=/app` 与
`--bind-ro=/etc/ssl/certs` 固定绑;resolv.conf/hosts 由 run_cell
按客机有效 DNS 生成单元专属文件(`/run/chv/resolv.conf.<machine>`、
`hosts.<machine>`,0644)再只读绑——客机 resolv.conf 可能是
systemd-resolved stub(127.0.0.53),单元内无 resolved,直接绑
即 DNS 全灭。不绑 nsswitch.conf(客机版可能含 resolve 模块,
glibc 默认 files+dns 正是单元需要的)。P2-8 的 example 腿换
v4 目标(gitea.tose.top)。
3. **并发 cell 撞毁**:固定 `ve-chv-cell` 名 + 固定 10.200.0.1/24,
第二个 cell 在 nspawn 建 veth 时即 `File exists`。修:每次
run_cell 在锁下分配唯一身份(CellNet:machine `chv-cell-<xx>`、
`ve-chv-cell-<xx>`、10.200.`<xx>`.0/24;machine 名 11 字符,
ve- 前缀后 14 字符,符合接口名 15 字符上限;扫描活接口 + 地址
+ machinectl 在册名避让注销滞后)。broker 的 pid ns 对照改成
多 cell 版(`cell-<machine>.pid` glob + 兼容旧 `cell.pid`,对端
ns 与任一活单元同 ns 即放行;旧单文件仍由 run_cell 写最新单元,
P2-9 驱动仍读它)。
另:执行器 `_boot_vm` 的 vm.create/vm.boot 失败消息现在带截断后
的响应体(`_truncate_api_body`,500 字符;只留 status 即无法定位
间歇 500 的根因,两轮已提)。