Bug 1733546 - MOM passes floating point values for 'sleep_millisecs' when calling VDSM's 'Host.setKsmTune' API verb
Summary: MOM passes floating point values for 'sleep_millisecs' when calling VDSM's 'H...
Keywords:
Status: VERIFIED
Alias: None
Product: mom
Classification: oVirt
Component: General
Version: 0.5.12
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified vote
Target Milestone: ovirt-4.4.0
: 0.6.0
Assignee: Andrej Krejcir
QA Contact: Polina
URL:
Whiteboard:
Depends On:
Blocks: 1722884
TreeView+ depends on / blocked
 
Reported: 2019-07-26 13:28 UTC by Marcin Sobczyk
Modified: 2020-01-27 08:39 UTC (History)
3 users (show)

Fixed In Version: mom-0.6.0
Doc Type: No Doc Update
Doc Text:
Clone Of:
Environment:
Last Closed:
oVirt Team: Virt
rbarry: ovirt-4.4?


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
oVirt gerrit 102220 master MERGED Convert rule outputs from float to int 2020-01-23 15:24:03 UTC

Description Marcin Sobczyk 2019-07-26 13:28:37 UTC
Description of problem:

When you run OST's basic suite you can see in the 'vdsm.log':

2019-07-25 10:26:50,567-0400 DEBUG (jsonrpc/4) [jsonrpc.JsonRpcServer] Calling 'Host.setKsmTune' in bridge with {u'tuningParams': {u'pages_to_scan': 64, u'run': 1, u'sleep_millisecs': 89.25152465623417}} (__init__:329)
2019-07-25 10:26:50,583-0400 ERROR (jsonrpc/4) [vds] setKsmTune API call failed. (API:1660)
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/vdsm/API.py", line 1657, in setKsmTune
    supervdsm.getProxy().ksmTune(tuningParams)
  File "/usr/lib/python2.7/site-packages/vdsm/common/supervdsm.py", line 56, in __call__
    return callMethod()
  File "/usr/lib/python2.7/site-packages/vdsm/common/supervdsm.py", line 54, in <lambda>
    **kwargs)
  File "<string>", line 2, in ksmTune
  File "/usr/lib64/python2.7/multiprocessing/managers.py", line 773, in _callmethod
    raise convert_to_error(kind, result)
IOError: [Errno 22] Invalid argument

This error is caused by trying to write a floating point value to '/sys/kernel/mm/ksm/sleep_millisecs' and can be reproduced manually with i.e.:

echo 5.4 > /sys/kernel/mm/ksm/sleep_millisecs

'ksm' interfaces accept ints only and VDSM's verb schema follows these rules:

https://github.com/oVirt/vdsm/blob/master/lib/vdsm/api/vdsm-api.yml#L3258

The default policy shipped with VDSM uses some math to obtain the 'sleep_millisecs' value:

https://github.com/oVirt/vdsm/blob/e5c4450f58e119aed34cf23fcca39ecbd345fab4/static/etc/vdsm/mom.d/03-ksm.policy#L108

But the result of that calculation is a floating point number - it should be trimmed/rounded to an int.


How reproducible:

Always.

Steps to Reproduce:
1. Run OST's basic suite
2. Look for 'setKsmTune'-related errors in 'vdsm.log', 'supervdsm.log' and 'mom.log'

Actual results:

MOM passes a floating point value for 'sleep_millisecs' field when calling 'Host.setKsmTune' VDSM's verb.

Expected results:

MOM passes a trimmed/rounded integer value for 'sleep_millisecs' field when calling 'Host.setKsmTune' VDSM's verb.

Comment 1 Polina 2020-01-27 08:39:31 UTC
Verified on 4.4.0-0.17 by running the automation tests which check triggering KSM (check ksmState in Host,getStats).
'RPC call Host.setKsmTune succeeded' strings with no error in vdsm.log, no errors in mom.log.
The tests work while /sys/kernel/mm/ksm/sleep_millisecs is 10.
Tried manually insert the float number, like described - echo 9.9 > /sys/kernel/mm/ksm/sleep_millisecs - and got write error: Invalid argument.


Note You need to log in before you can comment on or make changes to this bug.