SeanMooney / arbiterd

Arbiterd - power and performance arbiter daemon
Apache License 2.0
0 stars 1 forks source link

parse_nova_conf fails when reserving huge pages on more than once numanode #28

Open valleedelisle opened 2 years ago

valleedelisle commented 2 years ago
/ # arbiterd-static arbitrate --cpu-state
Traceback (most recent call last):
  File "/usr/local/bin/arbiterd-static", line 8, in <module>
    sys.exit(run())
  File "/usr/local/lib/python3.8/site-packages/arbiterd/cmd/static.py", line 276, in run
    args.func(args)
  File "/usr/local/lib/python3.8/site-packages/arbiterd/cmd/static.py", line 120, in arbitrate_command
    for core in nova.get_dedicated_cpus(args.nova_config)
  File "/usr/local/lib/python3.8/site-packages/arbiterd/common/nova.py", line 28, in get_dedicated_cpus
    nova = parse_nova_conf(nova_conf)
  File "/usr/local/lib/python3.8/site-packages/arbiterd/common/nova.py", line 12, in parse_nova_conf
    config.read(nova_conf)
  File "/usr/local/lib/python3.8/configparser.py", line 697, in read
    self._read(fp, filename)
  File "/usr/local/lib/python3.8/configparser.py", line 1093, in _read
    raise DuplicateOptionError(sectname, optname,
configparser.DuplicateOptionError: While reading from '/etc/nova/nova.conf' [line 181]: option 'reserved_huge_pages' in section 'DEFAULT' already exists
/ # grep ^reserved_huge /etc/nova/nova.conf
reserved_huge_pages=node:0,size:1GB,count:1
reserved_huge_pages=node:1,size:1GB,count:1
SeanMooney commented 2 years ago

ack so this is caused because im using configparser which is designed to parse ini files to parse .conf files

in an ini file if you repeat an option its a waring and you take the last definition as the value in compatibility mode.

in .conf format there is a value type called multi Opt which allows you to declare array values by repeatiging a value multiple times.

to adres this bug we will need to configure ocnig parser to allow duplicate netires.

in the long term we should use oslo to parse this directly using nova's config module but for now we can workaround this. ill add a testcase for this case as part of the fix.