nova scheduler utils parse_option needs more sanity check
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenStack Compute (nova) |
Invalid
|
Undecided
|
Surojit Pathak |
Bug Description
nova/scheduler/
>>> from nova.scheduler import utils
>>> utils.parse_
[('a>', '5')]
>>>
The default separator is '='. So '>' gets filtered out but '>=' gets allowed. This is even worse as it pollutes the key for the config opt.
One possible solution is to apply a grammar compatibility, what can be an accepted opt-name, like variable name in a language. for the LeftHandSide of the opt expression, the way it applies 'converter' to the RightHandSide.
reported version of nova
[suro@oxy-dev nova (master)]$ git log -1
commit 78db34c0b59cc04
[1] - https:/
Changed in lma-toolchain: | |
assignee: | nobody → Surojit Pathak (suro-patz) |
affects: | lma-toolchain → nova |
tags: | added: scheduler |
Changed in nova: | |
status: | New → Confirmed |
I can confirm that the behavior demonstrated happens. What I can't decide is if this matters. The defined syntax for a scheduler option (in nova.conf) is <name>=<value>, <name>=<value> and the interface to parse_options is to split on sep (which defaults to '=').
By that logic everything is working exactly as defined.
The assertion is that parse_options should be defensive in the face of what amounts to typos, because it already is to some extent.
I think there are two ways we could go here:
* switch to making parse_options accept a class of characters for name and do an rpartition or rpslit (limited to one split) instead of partition. The let ValueError happen on either converter failing on value or name not being comprised of the character class (this is effectively the same as the right hand grammar suggestion described above).
* stop filtering bad things at all, just split on sep and let the bad names bubble up: if we filter them people will never know to fix them.