runtime-spec icon indicating copy to clipboard operation
runtime-spec copied to clipboard

config-linux: allow empty strings in memory policy nodes field

Open askervin opened this issue 4 weeks ago • 1 comments

When runtime-tools validator checks mandatory fields, it expects every string field either to be tagged "omitempty" or contain a non-empty string. Linux memory policy modes MPOL_DEFAULT and MPOL_LOCAL must have empty nodes field. This change adds "omitempty" tag to LinuxMemoryPolicy.Nodes in order to pass runtime-tools validation in these modes.

askervin avatar Dec 01 '25 14:12 askervin

@cyphar, when I was testing https://github.com/opencontainers/runtime-tools/pull/786, I noticed that leaving out "omitempty" from LinuxMemoryPolicy.Nodes causes runtime-tools validation checkMandatoryUnit() to report an error if this field contains an empty string. And we actually require empty nodes string in certain memory policy modes (MPOL_DEFAULT, MPOL_LOCAL). I suppose the best fix would be adding "omitempty" to the field spec. WDYT?

askervin avatar Dec 01 '25 14:12 askervin