I'm trying to configure a libvirt compute resource in Foreman and have both KVM and Foreman installed on the same Centos 7 host.

Adding the compute resource with qemu+ssh://root@hypervisor.example.com/system works but not qemu+ssh://hypervisor.example.com/system which uses the foreman account.

Using the foreman account, I get the following error:

bash-4.2$ virsh -c qemu+ssh://hypervisor.example.com/system list
error: failed to connect to the hypervisor
error: End of file while reading data: : Input/output error

I've added foreman to the libvirtd group and have configured access_drivers = [ "polkit" ] in /etc/libvirt/libvirtd.conf.

I followed https://wiki.libvirt.org/page/SSHPolicyKitSetup and created:

  • /etc/polkit-1/rules.d/90-foreman.rules

    polkit.addRule(function(action, subject) {
        if (action.id == "org.libvirt.unix.manage" && subject.isInGroup("libvirt")) {
            return polkit.Result.YES;
        }
    });
    
  • /etc/polkit-1/localauthority/50-local.d/50-libvirt-remote-access.pkla

    [Allow foreman libvirt management permissions]
    Identity=unix-user:foreman
    Action=org.libvirt.unix.manage
    ResultAny=yes
    ResultInactive=yes
    ResultActive=yes
    

Neither configuration works, what did I miss?

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.