fix(reservation): an instance type with an unlisted hugepage size reserves no memory
维护者通常 3 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 72/100
调研方向
Read pkg/reservation/instancetype.go around line 95 and the declaration keys in packages/system/vm-instance-rd/cozyrds/vm-instance.yaml and packages/system/kubernetes-nodes-rd/cozyrds/kubernetes-nodes.yaml. Trace how ClassifyInstancetype handles hugepage sizes and how its result is consumed; confirm the current behavior for an unlisted size such as 32Mi. Done means unsupported sizes are counted or evaluation returns a clear error, with a test covering that case.
由索引模型根据 Issue 内容生成。
描述
Describe the bug
ClassifyInstancetype puts a hugepages instance type's memory under hugepages-<pageSize> for any page size (pkg/reservation/instancetype.go:95). The consumption declarations read only hugepages-2Mi and hugepages-1Gi (packages/system/vm-instance-rd/cozyrds/vm-instance.yaml:70-71, packages/system/kubernetes-nodes-rd/cozyrds/kubernetes-nodes.yaml:80-81), and instancetypeZeroKeys (pkg/reservation/evaluator.go:268-271) pre-fills only those two. An instance type with any other spec.memory.hugepages.pageSize, for example 32Mi, produces a key nothing reads, so the VM's memory is reserved as zero. That is fail-open, while the reservation design is meant to fail closed on what it cannot count.
Environment
- Cozystack version: main at 8cab9b7d7bbc
- Provider: any; page sizes other than 2Mi and 1Gi exist mainly on arm64
To Reproduce
- Define a
VirtualMachineClusterInstancetypewithspec.memory.hugepages.pageSize: 32Miandspec.memory.guest: 8Gi. - Evaluate the VMInstance declaration for a VM of that type.
- No memory class in the result is non-zero.
Expected behaviour
Either the memory is counted, or evaluation fails with an error naming the class no declaration reads.
Actual behaviour
The memory is counted as zero.
Logs
None; derived from the code.
Screenshots
Not applicable.
Additional context
The zero keys exist so a declaration can read any class of a type without guarding it, and that should stay. The smallest fix is in the classifier: refuse a page size outside the set the declarations know, with an error that says so. It gives up those types in tenants with quotas until a declaration counts them, which is the point of failing closed. The more general option is for the evaluator to fail when an instanceType() result carries a non-zero key no declaration names.
Nothing on main calls the evaluator yet; #5397 and #5401 wire it in, so this is latent until one of them lands. I have not checked which page sizes KubeVirt itself accepts.
Checklist
- I have checked the documentation
- I have searched for similar issues
- I have included all required information
- I have provided clear steps to reproduce
- I have included relevant logs
- 主要语言
- Go
- 星标
- 2.2k
- 派生
- 209
- 平均合并
- 4 天 14 小时
- 30 天内合并 PR
- 140
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
cozystack/cozystack 的其他 Issue
-
triage/needs-triage
难度 2/5 1-3 小时 新手友好度 78/100
cozystack/cozystack#5464 · 1 个 reaction ·
维护者通常 3 天内回复
-
test(kubernetes-nodes): stop hand-typing the default Talos version in tests that are not about it未关闭area/testing kind/cleanup triage/needs-triage
难度 2/5 1-3 小时 新手友好度 74/100
cozystack/cozystack#5456 · 1 个 reaction ·
维护者通常 3 天内回复
-
area/testing kind/cleanup triage/needs-triage
难度 2/5 1-3 小时 新手友好度 83/100
cozystack/cozystack#5447 · 1 个 reaction ·
维护者通常 3 天内回复
-
area/kubernetes kind/bug triage/needs-triage
难度 2/5 1-3 小时 新手友好度 72/100
cozystack/cozystack#5445 · 1 个 reaction ·
维护者通常 3 天内回复
-
kind/bug triage/needs-triage
难度 2/5 1-3 小时 新手友好度 74/100
cozystack/cozystack#5438 · 1 个 reaction ·
维护者通常 3 天内回复
查看 cozystack/cozystack 的全部 Issue
相似的 Issue
-
internal/core: cleanAttachmentName splits a rune at the 255-byte cap and stores invalid UTF-8可能已有人在做 @pacwestnobody 今天认领。 未关闭go good first issue help wanted
难度 2/5 1-3 小时 新手友好度 88/100
维护者通常 1 天内回复
-
TestLaunchGolden spends about 98 seconds on fake-agent exit delays under -race可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 2/5 1-3 小时 新手友好度 76/100
维护者通常 1 天内回复
-
factory:subtask
难度 1/5 1 小时以内 新手友好度 95/100
维护者通常 1 天内回复
-
bug good first issue
难度 2/5 1-3 小时 新手友好度 90/100
NotAFlightRisk/patchcall#11 ·
维护者通常 1 天内回复
-
documentation enhancement good first issue
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复