Repository navigation
Description
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 8cab9b7
- 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
Activity