Skip to content

Adds seapath provided generic qemu hook#808

Open
insatomcat wants to merge 4 commits into
mainfrom
hook
Open

Adds seapath provided generic qemu hook#808
insatomcat wants to merge 4 commits into
mainfrom
hook

Conversation

@insatomcat

Copy link
Copy Markdown
Member

This hook will run tasks that needs to be run everytime a guest is started:

  • parse the guest xml
  • override the network speed of all declared network interfaces to 1Gb (instead of the default 10Mb that make all supervision software believe they use more than 100%)
  • set all vhost- threads to RR1 if guest is realtime (= use vcpusched)
  • set cpu affinity of those threads to the same as main qemu thread if guest is realtime

@ebail ebail left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, I think that is a great to streamline the priority setting.

I think that functions should be documented.
Also I would consider adding units tests specially considering that it is a critical component.

Also I am wondering if we could plug this tool to vm-manager (https://github.com/seapath/vm_manager/tree/main) so that Ansible could be optionally used.
Once a VM is started with vm-manager, correct priorities could be applied.

import xml.etree.ElementTree as ET
import subprocess

#logfile = "/tmp/hook.log"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please remove deadcode

Comment thread roles/configure_libvirt/files/qemu_hook.py Outdated
Comment thread roles/configure_libvirt/files/qemu_hook.py Outdated
Comment thread roles/configure_libvirt/files/qemu_hook.py Outdated
Comment thread roles/configure_libvirt/files/qemu_hook.py Outdated
@ebail

ebail commented Aug 25, 2025

Copy link
Copy Markdown
Member

Hi @insatomcat, I am surprised to see this PR closed. I think that it is a good idea.
Do I miss something ?

@ebail ebail reopened this Aug 28, 2025
@eroussy eroussy mentioned this pull request Mar 11, 2026
@eroussy

eroussy commented Jul 21, 2026

Copy link
Copy Markdown
Member

Hi all
I would like to re-open the discussions around this qemu hook.
This is honestly very useful to me when dealing with OVS bridges. I think it would be valuable to be included in SEAPATH, but I see two minor problems:

  1. the vhost-thread of the br0 administration bridge is also put to RT priority which is not useful, we should find a way to avoid it
  2. This script is not needed if you don't used any bridges for time-critical data (SV). I advise to not apply it by default and make it available with a variable in the inventory.

What do you think of that ?

@eroussy

eroussy commented Jul 21, 2026

Copy link
Copy Markdown
Member

Also I am wondering if we could plug this tool to vm-manager (https://github.com/seapath/vm_manager/tree/main) so that Ansible could be optionally used. Once a VM is started with vm-manager, correct priorities could be applied.

This cannot be done by vm-manager, because the script has to be run everytime the VM starts/restarts.

insatomcat and others added 4 commits July 22, 2026 16:18
This hook will run tasks that needs to be run everytime a guest is started:
 - parse the guest xml
 - override the network speed of all declared network interfaces to 1Gb (instead of the default 10Mb that make all supervision software believe they use more than 100%)
 - set all vhost- threads to RR1 if guest is realtime (= use vcpusched)
 - set cpu affinity of those threads to the same as main qemu thread if guest is realtime

Signed-off-by: Florent CARLI <florent.carli@rte-france.com>
Signed-off-by: Erwann Roussy <erwann.roussy@savoirfairelinux.com>
Signed-off-by: Erwann Roussy <erwann.roussy@savoirfairelinux.com>
Only deploy the script when the value is true.

Signed-off-by: Erwann Roussy <erwann.roussy@savoirfairelinux.com>
Signed-off-by: Erwann Roussy <erwann.roussy@savoirfairelinux.com>
@eroussy

eroussy commented Jul 23, 2026

Copy link
Copy Markdown
Member

I pushed the modifications and add some molecule tests.
We could also add some test directly to the script, but it still not done right now.

The last thing that troubles me is this br0 related vhost thread that is also caught by the script and put to RR 41. I would like to put only the correct vhost thread to RR 41.
The only way I know to detect that is to match the sequence of bridges declared in the XML with the sequence of vhost thread associated to the VM (ex: if br0 is declared first, it will be the first vhost of the VM)
But then this will only be compatible with people using the seapath guest.xml.j2 template. And what happen if someone declare another non-critical bridge inside the VM ?

What is your opinion on that ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants