Skip to content

Adds seapath provided generic qemu hook#808

Open
insatomcat wants to merge 1 commit intomainfrom
hook
Open

Adds seapath provided generic qemu hook#808
insatomcat wants to merge 1 commit intomainfrom
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

Copy link
Copy Markdown
Member

@ebail ebail left a comment

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 on lines +16 to +22
print("Usage: configure_guest.py <vm_name> <vm_action>")
print(" vm_name : name of the guest VM")
print(" vm_action : one of the following:")
print(" started - run commands for real")
print(" started-dry - dry-run, print commands only")
print(" any other - do nothing and exit")
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.

I would use a logger

sys.exit(0)

def parse_xml(guest_name):
filename = f"/etc/pacemaker/{guest_name}.xml"
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.

I would use a variable for /etc/pacemaker

return pid
time.sleep(delay)
count += 1
print("No qemu process found")
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.

I would raise an exception

if len(sys.argv) < 3:
usage()

guest_name = sys.argv[1]
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.

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>
@ebail
Copy link
Copy Markdown
Member

ebail commented Aug 25, 2025

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
Copy link
Copy Markdown
Member

eroussy commented Mar 6, 2026

I didn't took so much time to test that, but it seems that this is the default behaviour of QEMU 10 running on SEAPATH main now.
On my setup, I just configured the emulatorpin variable, and the priority and affinity of the vhost thread are already correctly configured.

This is worth checking out in more details.

@eroussy
Copy link
Copy Markdown
Member

eroussy commented Mar 9, 2026

I didn't took so much time to test that, but it seems that this is the default behaviour of QEMU 10 running on SEAPATH main now. On my setup, I just configured the emulatorpin variable, and the priority and affinity of the vhost thread are already correctly configured.

This is worth checking out in more details.

Okay, I double checked and I had just another hook installed doing the same, So you can ignore previous message, we still need this hook

@eroussy
Copy link
Copy Markdown
Member

eroussy commented Mar 9, 2026

Also, please be aware that this hook put all the vhost thread to RT priority, even the one on br0
This one should not be RT in my opinion

@eroussy eroussy mentioned this pull request Mar 11, 2026
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