合并受阻
变更摘要
本 PR 的核心目标是将 volume 挂载参数校验提前到请求入口(CreateSandbox 阶段),使非法挂载在创建 sandbox 状态之前即被拒绝。具体做法是:在 internal/conchruntime 的 Service 中新增 VolumeManager 字段与 SetVolumeManager 注入方法,新增 validateVolumeMounts 在 CreateSandbox 中调用,并将原本分散在 internal/sandbox/manager.go 与 internal/volume/manager.go 的校验逻辑抽取为 volume.Manager.ValidateMounts(mounts, resumeBoot),其中"快照恢复(warm)模板不支持 volume_mounts"的拒绝逻辑从 sandbox 管理器上移至此入口校验。此外该 PR 还顺带改进了 netstack.Pool.Close 的并发清理逻辑、重写了 examples/volume.py 示例脚本,并将 Makefile 的 build-offline 目标替换为 static 目标。
主要改动
- 入口处校验 volume 挂载:在
conchruntime.Service中新增VolumeManager字段、SetVolumeManager注入方法与validateVolumeMounts方法,在CreateSandbox中(网络配置校验之后)调用,基于模板的BootMode是否为BootModeResume判断是否允许挂载,并由internal/daemon/daemon.go完成SetVolumeManager的装配。 - 抽取
ValidateMounts校验逻辑:internal/volume/manager.go将原本内嵌于PrepareSandbox的校验(最大挂载数、目标路径绝对/禁阻/去重、源路径非空且绝对等)抽成独立的ValidateMounts(mounts, resumeBoot),PrepareSandbox改为先调用该校验(以非 resume 方式),错误信息中补充了volume.max_mounts配置项说明。 - 移除 sandbox 层的 resume 拒绝逻辑:
internal/sandbox/manager.go的prepareVolumes不再接收resume参数,也不再在创建流程中直接拒绝"带 volumeMounts 的快照恢复启动",该判断统一上移到入口校验。 netstack.Pool.Close并发清理:internal/netstack/pool.go在关闭时将缓冲的Slot全部弹出并脱离队列,随后通过信号量限定的固定并发数(cleanupWorkers = 16)配合sync.WaitGroup并行销毁网络槽位,并增加耗时追踪日志,避免停机清理压垮主机网络栈。- volume 示例脚本与构建目标调整:
examples/volume.py改为支持通过-n参数一次性挂载多个卷(1–99 个)、以CONCH_TEMPLATE_ID环境变量传入模板 ID、挂载基路径改为./debug/shared,并重构了写入/读取/删除流程;Makefile将build-offline替换为静态构建的static目标。


Welcome To openEuler Community
Hey @jing-rui , thanks for your contribution to the community.
Bot Usage Manual
I'm the Bot here serving you. You can find the instructions on how to interact with me at Here . That means you can comment below every pull request or issue to trigger Bot Commands.
Contact Guide
If you have any questions, please contact the SIG: sig-CloudNative ,
and any of the maintainers: @duguhaotian, @gaodaweiky, @jimmieme, @lu-wei-army, @weibaohui, @wonleing, @yangzhao_kl, @zhaoyifan28, @zmr_2020 ,
and any of the committers: @Yekelu .


Was This PR authored or co-authored using generative AI tooling?
[ ] No
[x] Yes
__1. AI Agent : Codex:GPT-5.6-sol
__2. AI Model :
__3. Prompt :
Reference: openEuler Community Generative AI Use and Open Source Contribution Policy
What this PR does / why we need it:
Which issue this PR fixes
(optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)format, will close that issue when PR gets merged): fixes #Special notes for your reviewer: