On Tue, Apr 25, 2017 at 12:59 AM Gianluca Cecchi <gianluca.cecchi@gmail.com> wrote:
On Fri, Oct 7, 2016 at 3:35 PM, Simone Tiraboschi <stirabos@redhat.com> wrote:



If I can apply the patch also to 4.0.3 I'm going to see if there is then a different behavior. 
Let me know,


I'm trying it right now.
Any other tests will be really appreciated.

The patch is pretty simply, you can apply that on the fly.
You have to shutdown ovirt-ha-broker and ovirt-ha-agent; then you could directly edit 
/usr/lib/python2.7/site-packages/api/vdsmapi.py
around line 97 changing from
loaded_schema = yaml.load(f)
to
loaded_schema = yaml.load(f, Loader=yaml.CLoader)
Please pay attention to keep exactly the same amount of initial spaces.

Then you can simply restart the HA agent and check.



Hello,
I'm again registering high spikes of ovirt-ha-agent with only 2-3 VMs up and with almost no activity
The package of the involved file /usr/lib/python2.7/site-packages/api/vdsmapi.py is now at veriosn vdsm-api-4.19.4-1.el7.centos.noarch and I see that the file contains this kind of lines

    129         try:
    130             for path in paths:
    131                 with open(path) as f:
    132                     if hasattr(yaml, 'CLoader'):
    133                         loader = yaml.CLoader
    134                     else:
    135                         loader = yaml.Loader
    136                     loaded_schema = yaml.load(f, Loader=loader)
    137
    138                 types = loaded_schema.pop('types')
    139                 self._types.update(types)
    140                 self._methods.update(loaded_schema)
    141         except EnvironmentError:
    142             raise SchemaNotFound("Unable to find API schema file")

So there is a conditional statement...
How can I be sure that "loader" is set to "yaml.CLoader" that was what in 4.0 was able to lower the cpu usage of ovirt-ha-agent?

Hi Gianluca,

You can run this on the host:

$ python -c "import yaml; print 'CLoader:', hasattr(yaml, 'CLoader')"
CLoader: True

If you get "CLoader: False", you have some packaging issue, CLoader
is available on all supported platforms.

Nir
 
Thanks,
Gianluca