metal3-io / metal3-dev-env

Metal³ Development Environment
Apache License 2.0
112 stars 118 forks source link

Properly manage modular libvirtd on rhel-9 and cs-9 #1312

Closed cjeanner closed 11 months ago

cjeanner commented 11 months ago

Hello team,

We're facing some issues while running this project against rhel-9.2 and centos-stream-9 hypervisor. With those releases, libvirt moves to a modular, socket activated architecture instead of the "old" monolithic libvirtd.service.

After a quick check, it seems multiple occurrences of systemctl restart libvirtd and related ansible tasks are present in this project, and it unfortunately conflicts with the new architecture of the service.

While doing the change in the ansible part is easy, it may be slightly more complicated in the bash scripts or, at least, not that straightforward.

Here are the matches:

01_prepare_host.sh:# Restart libvirtd service to get the new group membership loaded
01_prepare_host.sh:  sudo systemctl restart libvirtd
02_configure_host.sh:        # Restart libvirtd.service as suggested here
02_configure_host.sh:        sudo systemctl restart libvirtd.service
02_configure_host.sh:  source disable_apparmor_driver_libvirtd.sh
03_launch_mgmt_cluster.sh:    sudo systemctl restart libvirtd.service
disable_apparmor_driver_libvirtd.sh:sudo systemctl restart libvirtd
vm-setup/roles/libvirt/defaults/main.yml:libvirtd_service: libvirtd
vm-setup/roles/libvirt/tasks/install_setup_tasks.yml:- name: Start libvirtd
vm-setup/roles/libvirt/tasks/install_setup_tasks.yml:    name: "{{ libvirtd_service }}"

Few comments:

Would you accept a series of patches removing those libvirtd.service restarts? I can probably get something over this week already - since we're consuming the project, we have to stabilize the virtualization provider asap.

Cheers,

C.

[1] I've done the logic in pure ansible in the ci-framework, an ansible project allowing to deploy OSP on OCP (think "NextGen OSP"): https://github.com/openstack-k8s-operators/ci-framework/blob/main/ci_framework/roles/libvirt_manager/tasks/virsh_checks.yml#L30-L64

tuminoid commented 11 months ago

/cc @Rozzii @lentzi90

lentzi90 commented 11 months ago

I would say patches are very welcome!

cjeanner commented 11 months ago

I've opened a PR, let's see how it goes. I focused on the things I know, mostly "modular is for centos-stream-9 and rhel-9+" - meaning I didn't do anything for Ubuntu. It will defaults to the "systemctl restart libvirtd" and related "libvirtd monolithic management". But at least, it should be easy to update the patch later in case of need - I tried to make it as comprehensive as possible.

Rozzii commented 11 months ago

/triage accepted

Rozzii commented 11 months ago

Thanks for the help @cjeanner